nativescript

Change css styles in webview

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-13 03:20:27
问题 I load the page through web viewing in NativeScript, I need to hide some blocks of elements. What is the option to insert css in html I received? Or what are the alternatives? I did not find the answer to my question: c page.xml // XML to display the page <GridLayout class="page-content"> <Label row="1" text="{{ result }}" style="text-align:center; z-index:99" /> <WebView row="2" loaded="onWebViewLoaded" id="myWebView" src="{{ webViewSrc }}" style="z-index:1"> </WebView> </GridLayout> page.ts

NativeScript: addMarkers outside of onMapReady

落花浮王杯 提交于 2019-12-13 02:50:53
问题 I'm new in NativeScript, and I'm playing with maps, using Mapbox. I want add markers, programmatically from a function when tap a buttom, to map. XML ` <Button text="GET" tap="getRequest" /> <<<-- BUTTON! <ContentView> <map:MapboxView accessToken= token mapStyle="streets" zoomLevel="13" showUserLocation="false" disableRotation= "true" disableTilt="false" mapReady="onMapReady"> </map:MapboxView> </ContentView>` JS `function onMapReady(args) { args.map.addMarkers([ { id: 1, lat: -35.30505050,

Empty Image is uploadded

元气小坏坏 提交于 2019-12-13 02:50:35
问题 Image Upload to wordpress is uploading empty image I am working on a mobile application consumes wordpress API. My application uses Nativescript-Vue Framework. I need to upload multiple images to wordpress using remote WP-API. var data=[]; const params = new FormData(); //params.append('file', this.value); this.product.images.forEach(i => { params.append('file',i.src); console.log(i.src); }); const axiosInstance = axios.create({ baseURL: 'https://mah.ttawor.com/wp-json/wp/v2/', timeout: 5000,

Nativescript send camera capture to server

眉间皱痕 提交于 2019-12-13 02:33:10
问题 In my Nativescript application I would like to capture an image using the camera module and then send the bytes directly to the server via http call. Here is my code (incomplete for brevity): var cameraModule = require("camera"); var http = require("http"); ... cameraModule.takePicture().then(function (img) { // how to extract the actual bytes from img??? http.request({ url: some_url, method: "POST", headers: { "Content-Type": "application/octet-stream" }, content: ??? }); }); Is there a way

Using AWS Javascript SDK with NativeScript

六眼飞鱼酱① 提交于 2019-12-13 01:29:19
问题 I'm planning to build an app using Nativescript. However, I want to integrate AWS services in the app architecture. Please, can someone tell me whether I can use AWS JS SDk with nativescript or not. If yes, how? Thank you. 回答1: Yes, you can use AWS SDK with NativeScript. I am using it to upload files to S3. You need to install it using npm i aws-sdk File upload to AWS S2 example In your component file, import it import * as AWS from 'aws-sdk'; const AWSService = AWS; const region = 'Your

How to prevent app from crashing on uncaughtErrorEvent

荒凉一梦 提交于 2019-12-12 22:39:29
问题 Is there a way to prevent the app from crashing when JS uncaught errors occur? Already tried to wrap app.start(...) inside try/catch, but it sure doesn't work:) 回答1: There is indeed, you can register an uncaughtErrorEvent listener. Refer to the official documentation - https://docs.nativescript.org/core-concepts/application-lifecycle#use-application-events You can drop the following in your app.js before bootstrapping the application var application = require("application"); application.on

How to add a side menu with NativeScript + Angular 2 project?

折月煮酒 提交于 2019-12-12 19:14:26
问题 i'm whiling to know how to add a side menu on my current NativeScript + Angular 2 project, I know that has a side menu template, but i started it as blank project and i'm wonder how to add this feature. 回答1: You will want to use Telerik UI for NativeScript (https://www.npmjs.com/package/nativescript-telerik-ui), please refer to this guide on how to integrate: http://docs.telerik.com/devtools/nativescript-ui/Controls/Angular/SideDrawer/getting-started You can see an example of how to wire it

“Error-ReferenceError-ErrorEvent is not defined” for NativeScript app

孤街醉人 提交于 2019-12-12 18:23:35
问题 I am a new learner of NativeScript. I am following a video tutorial on Coursera to create an Android project using NativeScript, and I got the above error that is made by this part of my code: process-httpmsg.service.ts : import { Injectable } from '@angular/core'; import { throwError } from 'rxjs'; import { HttpErrorResponse } from '@angular/common/http'; @Injectable({ providedIn: 'root' }) export class ProcessHTTPMsgService { constructor() { } public handleError(error: HttpErrorResponse |

Android Not Showing Font Icon In NativeScript

萝らか妹 提交于 2019-12-12 17:03:06
问题 I'm trying to use Ionicons with Android and NativeScript. I've included the ionicon.ttf file and my set font-family: "Ionicons" . It's working on iOS, but not Android. 回答1: Android registers font names differently than iOS. For Ionicons, the font name is ionicons.ttf , so the correct CSS is font-family: "Ionicons", ionicons . 来源: https://stackoverflow.com/questions/36652253/android-not-showing-font-icon-in-nativescript

NativeScript: Formatting number typescript

倾然丶 夕夏残阳落幕 提交于 2019-12-12 16:18:50
问题 I am totally new to nativescript and googling for the some basic stuff is harder than it should be... What i want to do is basically this: I have the number 1234567.89 in a variable, and i want to show it in a label with the format "1,234,567.89" Also, always show 2 decimals in case that 89 is 0 instead. Thanks for the help in advance 回答1: If you target to modern browsers you can use: new Intl.NumberFormat('en-us', {minimumFractionDigits: 2}).format(1234567.89) or (1234567.89).toLocaleString(