标签: nativescript

Nativescript获取当前页面

如何获得我正在处理的当前屏幕?例如,我有一个包含按钮的slidedrawer,可以导航到另一个页面.当我在某个页面(关于页面)上,当我点击按钮导航到关于页面时,我想关闭slidedrawer,如果它在同一页面上.

我的想法是获取当前页面并进行比较,但我不知道如何.

注意:slidedrawer内容菜单是一个自定义组件.

nativescript

3
推荐指数
1
解决办法
4458
查看次数

如何将自定义事件添加到NativeScript UI插件

在NativeScript中为UI插件定义自定义事件需要什么?

我想要实现的是触发一个foo与a上的事件类似的tap事件,Button并且可以挂钩如下:

<Page xmlns="http://schemas.nativescript.org/tns.xsd"
      xmlns:fooplugin="nativescript-foo-plugin">
  <StackLayout>
    <Button text="Tap Me!" tap="{{ onTap }}" />
    <fooplugin:FooPlugin foo="{{ onFoo }}" />
  </StackLayout>
</Page>
Run Code Online (Sandbox Code Playgroud)

我所做的基本上归结为在插件代码中使用from 值调用notify函数(忽略内存泄漏注意事项):eventNamefoo

import * as view from 'ui/core/view';

export class FooPlugin extends view.View {
  constructor() {
    super();

    setTimeout(() => {
      this.notify({
        eventName: 'foo',
        object: this,
      });

      // also tried this._emit('foo');
    }, 1000);
  }
}
Run Code Online (Sandbox Code Playgroud)

还有其他我缺少的东西,我需要做些什么来使这项工作?

plugins nativescript

3
推荐指数
1
解决办法
661
查看次数

当显示速度慢时,为什么要使用原生反应

我指的是这一特定的比较,它显示了与nativescript相比更小的反应原生. https://github.com/NativeScript/sample-iOS-Profiling/tree/performance-tests

我是否过分关注速度或这个数字并不意味着什么?

nativescript react-native

3
推荐指数
1
解决办法
535
查看次数

NativeScript:如何将iOS应用程序部署到物理设备?

我在Telerik创建了一个帐户,与Apple Dev Center签署了一个证书并获得了移动配置.我使用Appbuilder将证书和配置导入我的笔记本电脑.但我还是无法在iOS上部署我的应用程序

tns deploy ios
Run Code Online (Sandbox Code Playgroud)

警告说:

重要信息:在构建iOS设备之前,请确认您已在OS X系统上配置了一对有效的证书和配置文件.

但是,当我执行"appbuilder provision"和"appbuilder certificate"时,命令显示我们已成功导入它们.我也尝试过:

appbuilder deploy ios --provision '<name>' --certificate '<title>'
Run Code Online (Sandbox Code Playgroud)

它说没有在路径上或路径上找到任何项目,也没有指定--path.但我在项目文件夹中.:/

ios telerik-appbuilder nativescript

3
推荐指数
1
解决办法
3550
查看次数

图像按钮Nativescript和Angular

我需要创建一个图像按钮,其中包含自定义图像和{N} + Angular中的标签.像这样的东西:

在此输入图像描述

这是我的代码.我正在使用网格布局中的堆栈布局.我看不到图像下方的标签.

<GridLayout columns="*,*" rows="*,*,*,*,*,*"  width="400" height="400">
    <StackLayout class="  btn-sq-lg  " col="0" row="0" (tap)="gotoSRTPage()">
        <Image  col="0" row ="1" src="res://ic_briefcase" > </Image>
        <Label class= "label" textWrap="true" col="0" row="2" text="SRT" horizontalAlignment="center" verticalAlignment="center"></Label>
    </StackLayout>  
    <StackLayout class="  btn-sq-lg  " col="1" row="0" (tap)="">
        <Image  col="1" row ="1" src="res://ic_blog" > </Image>
        <Label  class= "label" col="1" row="2" text="SRT" horizontalAlignment="center" verticalAlignment="center"</Label>
        </StackLayout>    
         <StackLayout class="  btn-sq-lg  " col="0" row="3" (tap)="">
        <Image  col="0" row ="4" src="res://ic_reminder" > </Image>
        <Label class= "label" textWrap="true" col="0" row="5" text="SRT" horizontalAlignment="center" verticalAlignment="center"></Label>
        </StackLayout> …
Run Code Online (Sandbox Code Playgroud)

nativescript angular2-nativescript nativescript-telerik-ui

3
推荐指数
2
解决办法
7659
查看次数

Nativescript将LIstPicker与JS对象一起使用

我正在尝试将ListPicker与对象数组一起使用,并且使用所有元素显示[object Object]的标签来呈现列表。

我想指定哪个属性用作列表选择器的“标签”。

不幸的是,Nativescript ListPicker仅接受一个字符串数组,并且我不能使用我的Object数组,因为标签将调用toString()

我发现了基于以下的替代解决方案:https : //github.com/NativeScript/NativeScript/issues/1677

购买我的应用程序时使用的是page-router-outlet,并且不使用元素,因此我无法使用上述建议的方法。在这种情况下,有没有可能将ListPicker与对象数组一起使用,或者有任何不依赖Page元素加载事件的解决方法?

javascript nativescript angular2-nativescript

3
推荐指数
2
解决办法
1226
查看次数

如何在单击angular2本机脚本时打开按钮上的playstore应用程序URL

单击按钮时,我需要在playstore应用程序的帮助下打开playstore应用程序URL。我有来自Playstore的许多应用程序网址。

例如: https ://play.google.com/store/apps/details?id = com.ninjakiwi.bftg

应用程序不应在浏览器的帮助下打开。单击按钮时,它必须在官方google playstore应用程序的帮助下打开。

typescript nativescript angular2-nativescript angular

3
推荐指数
1
解决办法
1426
查看次数

插件nativescript-fancyalert在Android上不起作用

TNSFancyAlert.showSuccess(
    "Success!",
    "Fancy alerts are nice.",
    "Yes they are!",
)
.then(() => {
    console.log("success")
}).catch(err => {
    console.log(err)
})
Run Code Online (Sandbox Code Playgroud)

错误响应是:[TypeError:cn.refactor.lib.colordialog.PromptDialog不是构造函数]

来自:https : //github.com/NathanWalker/nativescript-fancyalert

我做错什么了吗?

vue.js nativescript nativescript-plugin

3
推荐指数
1
解决办法
200
查看次数

本机脚本:未知URL的HTTP故障响应

我有一种情况,我已经从分支中提取了最新的更改,并尝试使用tns run android命令运行该应用程序。该应用程序已成功启动,但API调用受到限制,因此应用程序启动后会立即引发错误。

我也回答了这个问题,但这似乎不是问题所在。因为对于其他团队成员来说,它工作正常。:/

    err {
JS:   "headers": {
JS:     "normalizedNames": {},
JS:     "lazyUpdate": null,
JS:     "headers": {}
JS:   },
JS:   "status": 0,
JS:   "statusText": "Unknown Error",
JS:   "url": null,
JS:   "ok": false,
JS:   "name": "HttpErrorResponse",
JS:   "message": "Http failure response for (unknown url): 0 Unknown Error",
JS:   "error": {
JS:     "originalStack": "Error: java.io.IOException: Cleartext HTTP traffic to elk.chennai-volunteer-294695.staging.c66.me not permitted\n    at new ZoneAwareError (file:///data/data/org.nativescript.chennaivolunteersapp/files/app/
tns_modules/nativescript-angular/zone-js/dist/zone-nativescript.js:1298:33)\n    at onRequestComplete (file:///data/data/org.nativescript.chennaivolunteersapp/files/app/tns_modules/tns-core-modules/http/http-request/http-request.js:
45:34)\n    at Object.onComplete (file:///data/data/org.nativescript.chennaivolunteersapp/files/app/tns_modules/tns-core-modules/http/http-request/http-request.js:37:13)",
JS:     "zoneAwareStack": "Error: …
Run Code Online (Sandbox Code Playgroud)

typescript nativescript angular

3
推荐指数
2
解决办法
1089
查看次数

Nativescript 6非常慢

我们的应用程序是使用nativescript 4开发的。AndroidStore级别的规则更改迫使我们进入了nativescript6。因为我们的应用程序非常慢。例如,密码输入有时会冻结,在菜单中选择时会有延迟。是否有人遇到相同的问题,并且有解决方案来提高应用程序的响应能力?

ps:我们已经使用了以下编译选项:-env.aot --env.snapshot --env.uglify --production

先感谢您

performance nativescript angular

3
推荐指数
1
解决办法
175
查看次数