nativescript

How to stop timer.setinterval with a tap event or leaving page in nativescript

蹲街弑〆低调 提交于 2019-12-12 03:47:52
问题 I have an counter that loads when starts when a page is loaded and stops when the time == 0 fires a dialog and navigates to another page. But i also want to stop it when the use taps a button or when he gives up and leave the page. Below is my code for starting the timer and ending it when the time === 0 var timeKeep = vm.time; var count = 0; countId = timer.setInterval(() => { timeCountDown(); count += 1; if (count === timeKeep) { timer.clearInterval(countId); dialogs.alert({ message: "Time

NativeScript tap & longPress together not working

為{幸葍}努か 提交于 2019-12-12 03:36:05
问题 On longPress event the tap event also executing <StackLayout (longPress)="onLongPressItem(item)" (tap)="onItemTap(item)">...</StackLayout> is there a way to prevent tap on longPress? I want to work both events on Same layout. In ListView we have 'itemTap' only is there a option for 'longPress'? Please don't suggest me RadListView. 回答1: Maybe this answer is still helpful too. There exists issues concerning your problem: https://github.com/NativeScript/NativeScript/issues/2823 https://github

tns --watch not working

廉价感情. 提交于 2019-12-12 03:24:51
问题 So a few days i started this app and --watch was working just fine until today. This is what i call: tns run android --emulator --device=ANDROID --watch but when i change code, nothing happens, my changes are not present. When i run tns doctor, it shows that everything is up to date except ios emulator( witch i am not using at this time ). Just tried to reinstall the app( from git - https://github.com/nestor94/my-instagram ) and re-created the avd. still --watch not working. Thanks! 回答1: You

Nativescript - How do I properly use placeholder property from ui/image-cache to make it work?

无人久伴 提交于 2019-12-12 02:17:37
问题 I'm trying to create a list view with a set of remote images and while they are loading to display a placeholder image. var imageSource = require("image-source"); var imageCache = require("ui/image-cache"); var cache = new imageCache.Cache(); var defaultImageSource = imageSource.fromResource("img-loading”); cache.enableDownload(); cache.placeholder = defaultImageSource; cache.maxRequests = 5; Tried with fromFile as well instead of fromResource. Any toughts? 回答1: I'm not sure how are you using

Nativescript addSubview

ぃ、小莉子 提交于 2019-12-11 23:22:34
问题 I'm trying to implement the OpenTok SDK into Nativescript and I've run into an issue that I can't seem to wrap my head around. Per their documentation (https://tokbox.com/developer/guides/publish-stream/ios/#create_publisher) once you create a publisher object you call: [self.view addSubview:publisher.view]; I can't figure out how I would tie this into Nativescript, if it's even possible. My first thought is that I would want a UIView or View element on my page in the XML, then I would call

Nativescript: Transferring mp3 files with Sidekick

喜夏-厌秋 提交于 2019-12-11 20:39:26
问题 I'm making a simple app that uses nativescript-audio and I want to play some mp3 samples in the app. The problem is, when I click "Run on Device" in Sidekick, it doesn't transfer any mp3 files I included in the app folder (and therefore I can't play it). What is weird is that if I just change the extension of the file (for example to .jpg), the transfer works fine (and I can even play that file as if it was mp3). So, just to exemplify the problem, if I use this code, it doesn't work: const

Re-enable load on demand [NativeScript Vue]

梦想的初衷 提交于 2019-12-11 18:33:07
问题 I have a Radlistview, where the data switches out based on user query. With loadOnDemandMode="Auto" and when the current query is exhausted, I then call notifyLoadOnDemandFinished(true) . However, when a new query is made, I cannot re-enable loadOnDemand, and new items are not loaded. Is there a way to reactivate loadOnDemand, perhaps with a method on the radListView object? I couldn't find anything in the docs. 回答1: Found the mistake, posting here for anyone else that may have the problem. I

NativeScript Angular RadListView rendering extremely slowly

不羁的心 提交于 2019-12-11 18:26:55
问题 Problem: I have an angular-nativescript app that needs to display some items in a grid. I'm using a RadListView to render the list and after upgrading my angular, {N}, and other library dependencies over the last few months I've noticed the RadListView rendering of the items has gotten unbearably slow. I have multiple "tabs" so you can see different types of items and whenever you switch "tabs" it needs to completely re-render the list with the new times. Before doing some upgrades (which I

RadListView itemTap produces “Calling js method onItemClick failed” error page

浪子不回头ぞ 提交于 2019-12-11 18:24:40
问题 I have a RadListView showing a list of items loaded from server. I want to tap on a single item and go to the detail page. I keep getting the same black error page when I tap anywhere on the listing. Here is the component that populates it. import { RadListView, ListViewEventData } from "nativescript-ui-listview"; ... ... public onListLoaded(args: ListViewEventData) { this.updateService.getReports() .subscribe( (data) => { console.log("report data in reports component onListLoaded = "+JSON

How to handle a missing plugin in NativeScript preview app

回眸只為那壹抹淺笑 提交于 2019-12-11 18:21:18
问题 I've built a basic layout app with NativeScript & Angular and am trying to preview it on my android device. when running tns preview I get a message saying that Plugin nativescript-ng-shadow is not included in preview app on device {{Guid}} and will not work. is there a way to include this plugin on the preview app, or does that mean that that i cannot preview this app? 回答1: There are some limitations of what changes and applications are supported by Playground. The Preview app comes with a