nativescript

How catch android dispatchKeyEvent in nativescript app?

我们两清 提交于 2020-06-29 03:47:14
问题 Extended dispatchKeyEvent in Activity for listening volume up/down key press events in android. (as described here: How to listen for volume up/down key in android with nativescript?) But can't figure out how to catch this events in app. This process described here with all events but dispatchKeyEvent: https://docs.nativescript.org/core-concepts/application-lifecycle#android-activity-events application.android.on( <what should be here?>, function (args) { console.log("Event: " + args

JS: firebase.init error: TypeError: Cannot read property 'database' of undefined

别等时光非礼了梦想. 提交于 2020-06-28 11:10:40
问题 Am getting this error after following the steps mentioned in the nativescript-plugin-firebase readme file. JS: firebase.init error: TypeError: Cannot read property 'database' of undefined https://github.com/EddyVerbruggen/nativescript-plugin-firebase but i dont really understand nor do i know how to solve that. the version of the plugin am using is : 6.4.0 with tns 4.1.2 EDIT: init code, from app.js var firebase = require("nativescript-plugin-firebase"); firebase.init({ persist: true //

Nativescript: Navigate between router-outlets

时光总嘲笑我的痴心妄想 提交于 2020-06-27 07:37:35
问题 For better introduction see the blog post about outlets. I use a TabView to navigate through my mobile app written with nativescript (ProtectedComponent). <TabView #tabView tabsBackgroundColor="#f57c00" selectedTabTextColor="#B23010" [(ngModel)]="selectedIndex" (selectedIndexChanged)="tabViewIndexChange(tabView.selectedIndex)"> <StackLayout *tabItem="{iconSource: 'res://tab-icons/cats'}"> <cats-tab></cats-tab> </StackLayout> <StackLayout *tabItem="{iconSource: 'res://tab-icons/dogs'}"> <dogs

Center and right/left align items in a NativeScript Layout

给你一囗甜甜゛ 提交于 2020-06-24 22:25:29
问题 In the context of a NativeScript app, I've been struggling to find an efficient, non-hacky way to do what seems pretty simple: have one item in the center of a layout, and another item all the way to the right or left of the layout--something like the images in this question: Center and right align flexbox elements. The items should all be in a single row as they are there. (I've looked through those solutions, but I don't want to add a pseudo-element, and a lot of CSS just doesn't work with

Center and right/left align items in a NativeScript Layout

风格不统一 提交于 2020-06-24 22:25:07
问题 In the context of a NativeScript app, I've been struggling to find an efficient, non-hacky way to do what seems pretty simple: have one item in the center of a layout, and another item all the way to the right or left of the layout--something like the images in this question: Center and right align flexbox elements. The items should all be in a single row as they are there. (I've looked through those solutions, but I don't want to add a pseudo-element, and a lot of CSS just doesn't work with

NativeScript ./gradlew failed with exit code 1

ε祈祈猫儿з 提交于 2020-06-17 13:12:25
问题 Problem On Windows Subsystem Linux (WSL), during tns run android command: A problem was found with the configuration of task ':app:signingConfigWriterDebug'. File specified for property 'signingConfig.storeFile' does not exist. ./gradlew failed with exit code 1 回答1: Solution Copy platforms/android/~ directory to platforms/android/app/~ . 来源: https://stackoverflow.com/questions/61028194/nativescript-gradlew-failed-with-exit-code-1

“Error: Cannot read property 'slice' of undefined” when importing apollo-link-ws in nativescript vue?

帅比萌擦擦* 提交于 2020-06-17 09:34:28
问题 My goal is to use subscriptions in GraphQL in a nativescript vue app to avoid google firebase. It works fine using HttpLink, but it doesn't with websockets. The Error: TypeError: Cannot read property 'slice' of undefined occurs on runtime when importing apollo-link-ws or subscription-transport-ws . As soon as I comment both imports out, the code runs again and I can use GraphQL over http. const Vue = require('nativescript-vue'); import { ApolloClient } from 'apollo-client' import { HttpLink }

Stop keyboard overlay when interacting with TextField in a NativeScript application

孤街浪徒 提交于 2020-06-11 04:58:09
问题 When working with a NativeScript application view where a user can enter input, the native application Keyboard Input overlays the TextField component. While this doesn't stop the user from entering text, it disrupts the UX flow and looks bad from a UI perspective. How can I get the Keyboard to not overlay the input, but instead appear underneath it like other native applications can do? Update 2 Now that it no longer overlays, I've noticed that when I leave the application to switch to

How to show keyboard when page loads in android app with nativescript?

点点圈 提交于 2020-06-10 06:53:50
问题 The first page of my android application has one input field. So what I want is when this page loads I want to show keyboard automatically without doing tap on the input field. 回答1: pkanev's comment is true on ios; ie, just focus on the text field and ios will open up the keyboard. But on Android you need to do some extra work -- var utils = require("tns-core-modules/utils/utils"); var myTextfield = page.getViewById("myTextFieldId"); if (myTextfield.ios) { console.log("myTextfield.ios"); //

How to load a local html file into a NativeScript webview

我只是一个虾纸丫 提交于 2020-06-09 06:47:15
问题 I have modified the webpack.config.js to add a local file called index.html the code below : new CopyWebpackPlugin([ { from: { glob: "index.html" } }, { from: { glob: "fonts/**" } }, { from: { glob: "**/*.jpg" } }, { from: { glob: "**/*.png" } }, ], { ignore: [`${relative(appPath, appResourcesFullPath)}/**`] }), new nsWebpack.GenerateNativeScriptEntryPointsPlugin("bundle"), This is how I configured my webview in the main-page.xml file the code below: <WebView row="1" loaded="onWebViewLoaded"