nativescript

Nativescript Switch prevent change event firing on initial binding

混江龙づ霸主 提交于 2019-12-10 21:05:44
问题 Hi my template is something like the below <ListView [items]="modules"> <template let-item="item" > <StackLayout orientation="vertical"> <Switch (checkedChange)="onSwitchModule(item.id,$event)" [checked]="item.active"></Switch> </StackLayout> </template> </ListView> My controller is ngOnInit() { this._moduleService.getUserModules() .subscribe( response=>{ this.modules = response.data; } ) } onSwitchModule(itemId) { console.log(itemID); //Gets called on initial true binding on switch checked }

fetch Promise never gets executed

梦想的初衷 提交于 2019-12-10 19:26:35
问题 I am using the nativescript to develop an app for android. I have something like var fetchModule = require("fetch"); fetchModule.fetch("http://202.120.227.11/") .then(function(resp){ console.log(JSON.stringify(resp)); return resp; }) .catch(function(err){ console.log(JSON.stringify(err)); return err; }); but the then block never gets executed. And sometimes the catch block gets executed and give a network error. But in either case, the request is sent and the response is smoothly received

NativeScript - Bitmap & Canvas

三世轮回 提交于 2019-12-10 18:23:50
问题 I am new in nativescript app development. I want to use android.graphics.Bitmap and android.graphics.Canvas in NativeScript. I googled for creating bitmap and draw it using canvas, but didn't find any solution. Basically i want to draw rectangle. Please help me! Thanks in advance :) This is the result from Android app and same is required to implement on NativeScript. 回答1: For the canvas your javascript would need to be something like: var canvas = new android.graphics.Canvas(); that would

NativeScript: GridLayout Rows Overlapping

末鹿安然 提交于 2019-12-10 18:07:01
问题 I'm new to NativeScript and I'm trying to create my first app. I created the following use interface XML, and it doesn't look as I expected. The image appears at the top of the screen as it should, but then all the labels appear in the row underneath it, stacked on top of each other. <Page xmlns="http://www.nativescript.org/tns.xsd" loaded="onPageLoaded"> <GridLayout columns="auto, *" rows="auto, *"> <Image row="0" col="0" colSpan="2" src="{{ imageUrl }}" /> <Label row="1" col="0" text="row1

Nativescript/angular2: no provider for applicationRef! error after deployment

拥有回忆 提交于 2019-12-10 17:15:32
问题 i'm trying to run a very simple nativescript/angular2 app, it seems to build fine but after the app gets deployed to the android (genymotion) emulator I get the following error message. So it seems like angular isn't bootstrapped??? not sure at all why this is... Any idea what i'm doing wrong? error message: "@angular/core": "2.1.2", "@angular/forms": "2.1.2", "@angular/http": "2.1.2", "@angular/platform-browseBUILD SUCCESSFUL Total time: 1 mins 39.836 secs Project successfully built

How to add an activity-indicator on a page level?

五迷三道 提交于 2019-12-10 16:34:52
问题 I would like to add an activity-indicator widget in my login page but I would like it to cover the whole screen, so I can prevent double click on the Login button. Any idea, thanks! 回答1: If you wrap everything in a GridLayout, add a StackLayout as the last item in the row you want to cover. The StackLayout by default will cover the whole screen. Then you can show/hide via data. For example: <GridLayout> <StackLayout> // All your page content goes here! </StackLayout> <StackLayout class=

Multiline textbox in nativescript

怎甘沉沦 提交于 2019-12-10 16:20:55
问题 How do I get a text area in native script that supports multiline? I have tried using the text field which does not have the support for multiline. Have also tried this code to add multiline to the text field: var myTextfield = this.page.getViewById<TextField>("noteView"); myTextfield.android.setInputType(android.text.InputType.TYPE_TEXT_FLAG_MULTI_LINE); 回答1: After a bit of research was able to make this text box using the "TextVIew" component of the native script and some of its properties.

Android Gradle build error - artifacts for configuration ':classpath' [duplicate]

ぃ、小莉子 提交于 2019-12-10 14:35:55
问题 This question already has answers here : Unable to get dependencies from jcenter with a new project [closed] (10 answers) Closed 9 months ago . I'm getting the errors below, when running the command tns run android or tns debug android . Before it was working fine until I've deleted .gradle/gradle.properties folder from the C:\Users\yash\.gradle\gradle.properties and now I'm not able to UNDO it. There 1 of the 50 error I'm getting is: Could not resolve all artifacts for configuration '

What is alternative of DIV in NativeScript?

99封情书 提交于 2019-12-10 12:25:09
问题 What is alternative of DIV in NativeScript? How to use block inline with content inside? 回答1: Within Browser the behaviour div is determined by display CSS attribute. For example, by default it's block and vertical which is similar to StackLayout with orientation set to vertical . When you make it inline , that's more like a horizontal layout, so again could be StackLayout with orientation set to horizontal . There is again flex , we also have an equivalent in NativeScript, the FlexboxLayout

Nativescript RadDataForm MultilineText not working on Android

不想你离开。 提交于 2019-12-10 11:53:13
问题 I am using RadDataForm in my Nativescript Angular project and when I try to use "MultilineText" it doesn't work on Android, it just appears as a normal "Text" box. I am not able to enter multiple lines. Works fine on iOS. add-store.model.ts export class AddStore { public name: string; public description: string; constructor(name: string, description: string,) { this.name = name; this.description = description; } } add-store-metadata-validation.json { "isReadOnly": false, "commitMode":