nativescript

How do I change the return key type of a text from a prompt in NativeScript?

戏子无情 提交于 2021-01-29 10:12:49
问题 Changing the return key type of TextViews/TextFields is pretty straight forward, however, since prompts don't use any html there's no obvious way to change the return key type. the NativeScript docs don't indicate there being any way to change it either. 回答1: Unfortunately you can not do that. As of today {N} do not expose the underlaying native view for dialogs so it's not possible to override natively. You will have to build the complete custom dialog yourself to achieve what you are

how to build nativescript-vue .apk without submitting it to google store to share with my friends for beta testing

不问归期 提交于 2021-01-29 09:47:32
问题 I see a lot of them in relating topics all involved in submitting to google store. Is it possible to create .apk locally (CLI) so I can share this with few other friends? I'm using Nativescript Vue and I don't want to deal with Google store or Itune at this point. 回答1: All the articles you must have read should already cover building a APK, you stop it one step before you if you don't want to submit it to Google Play. The tns build command should give you the APK, you may just share it with

Nativescript Add ScrollView through Code (Javascript)

若如初见. 提交于 2021-01-29 08:50:36
问题 Using Javascript with Nativescript and I am loading a page through code rather than XML. I have it all working, however I want to add a ScrollView and then place a layout with in that. How would I go about this? I have tried: var scroll = new ScrollView(); var stackLay = new StackLayout(); stackLay.addChild(stuff); .... scroll.addChild(stackLay); However, I get error "scroll.addChild is not a function" Thanks. 回答1: ScrollView is not a layout but inherited from ContentView , therefore you can

Array.sort not working correctly on Nativescript iOS for very large arrays with large numbers

不问归期 提交于 2021-01-29 07:28:28
问题 Because I'm using Nativescript I'm using the same Typescript code for Android and iOS. I have a very large data set of about 1000-2000 (could be bigger) objects with very large data values in an array. const unsorted = [ ..., { name: "name1", value: 10000000 },{ name: "name120", value: 200000000 },{ name: "name42", value: 3 },{ name: "name1203", value: 1000000000000 }, ... ]; const sorted = unsorted.sort((a,b) => (b.value-a.value)); On Android, sorted is always correctly sorted, but iOS is

Android Background Task - Less Than 15 Minutes

女生的网名这么多〃 提交于 2021-01-29 04:08:25
问题 I'm trying to run a background task more often than the 15 minutes minimum set by Android. Battery life isn't a concern and it's for internal use only. I have tried disabling battery optimisation for the app, but that doesn't work either. Is there anyway to opt out of the battery optimisation? const component = new android.content.ComponentName(context, org.nativescript.location.BackgroundService26.class); const builder = new android.app.job.JobInfo.Builder(1, component); builder

How to consume GraphQL API from Nativescript Core application?

跟風遠走 提交于 2021-01-29 03:21:28
问题 I am trying to consume GraphQL ApI from nativescript core application but whole docs and tutorials are around nativescript angular and apollo. Is it possible?, any recommendations about how to start? 回答1: It works fine with apolli-client as @Manoj recommended 来源: https://stackoverflow.com/questions/57237305/how-to-consume-graphql-api-from-nativescript-core-application

Is it possible to display a View written with SwiftUI with NativeScript

陌路散爱 提交于 2021-01-28 21:50:50
问题 I'm currently using native Swift code via the bridging header, but not to something like a View. Is it possible to present a View written in Swift from some event trigger within nativescript code? 来源: https://stackoverflow.com/questions/58399565/is-it-possible-to-display-a-view-written-with-swiftui-with-nativescript

Remote image on NavigationButton in Nativescript/Angular

对着背影说爱祢 提交于 2021-01-28 12:10:34
问题 I want to put the user's avatar on the left of my app's header. It works fine in IOS, but it doesn't work in android. I tried to do this: <NavigationButton [icon]="customImage" color="#a81b38" (tap)="toggleSideDrawer()" *ngIf="isAndroid"> <StackLayout verticalAlignment="center"> <Label id="avatarImg" height="45" width="45" borderRadius="50" backgroundColor="#eeeeee"></Label> </StackLayout> </NavigationButton> but I get an error during compilation. The custom image is a remote image (https:/

Nativescript delete image from library

不羁的心 提交于 2021-01-28 09:00:26
问题 I have a NS 4.1 with TS application. In it, I am allowing the user to select an image using nativescript-imagepicker. If the user chosses to do so, I want to remove the image from the device. I am using the following code: //files is a list of file locations: e.g./storage/emulated/0/DCIM/Camera/IMG_1529637637242.jpg import * as fs from 'tns-core-modules/file-system'; files.forEach(f => { let file: fs.File = fs.File.fromPath(f); if (file) file.remove(); }); When code runs, the file is actually

npm install -g @vue/cli @vue/cli-init errors

时间秒杀一切 提交于 2021-01-28 08:20:13
问题 I am busy setting up NativeScript and I am also adding in Vue.js support for it. Well, I get this error when installing. Should I use --unsafe-perm or is there a better way to do this? npm install -g @vue/cli @vue/cli-init npm WARN deprecated vue-cli@2.9.6: This package has been deprecated in favour of @vue/cli npm WARN deprecated coffee-script@1.12.7: CoffeeScript on NPM has moved to "coffeescript" (no hyphen) /usr/local/bin/vue -> /usr/local/lib/node_modules/@vue/cli/bin/vue.js > fsevents@1