如何获得我正在处理的当前屏幕?例如,我有一个包含按钮的slidedrawer,可以导航到另一个页面.当我在某个页面(关于页面)上,当我点击按钮导航到关于页面时,我想关闭slidedrawer,如果它在同一页面上.
我的想法是获取当前页面并进行比较,但我不知道如何.
注意:slidedrawer内容菜单是一个自定义组件.
在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)
还有其他我缺少的东西,我需要做些什么来使这项工作?
我指的是这一特定的比较,它显示了与nativescript相比更小的反应原生. https://github.com/NativeScript/sample-iOS-Profiling/tree/performance-tests
我是否过分关注速度或这个数字并不意味着什么?
我在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.但我在项目文件夹中.:/
我需要创建一个图像按钮,其中包含自定义图像和{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) 我正在尝试将ListPicker与对象数组一起使用,并且使用所有元素显示[object Object]的标签来呈现列表。
我想指定哪个属性用作列表选择器的“标签”。
不幸的是,Nativescript ListPicker仅接受一个字符串数组,并且我不能使用我的Object数组,因为标签将调用toString()
我发现了基于以下的替代解决方案:https : //github.com/NativeScript/NativeScript/issues/1677
购买我的应用程序时使用的是page-router-outlet,并且不使用元素,因此我无法使用上述建议的方法。在这种情况下,有没有可能将ListPicker与对象数组一起使用,或者有任何不依赖Page元素加载事件的解决方法?
单击按钮时,我需要在playstore应用程序的帮助下打开playstore应用程序URL。我有来自Playstore的许多应用程序网址。
例如: https ://play.google.com/store/apps/details?id = com.ninjakiwi.bftg
应用程序不应在浏览器的帮助下打开。单击按钮时,它必须在官方google playstore应用程序的帮助下打开。
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
我做错什么了吗?
我有一种情况,我已经从分支中提取了最新的更改,并尝试使用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) 我们的应用程序是使用nativescript 4开发的。AndroidStore级别的规则更改迫使我们进入了nativescript6。因为我们的应用程序非常慢。例如,密码输入有时会冻结,在菜单中选择时会有延迟。是否有人遇到相同的问题,并且有解决方案来提高应用程序的响应能力?
ps:我们已经使用了以下编译选项:-env.aot --env.snapshot --env.uglify --production
先感谢您
nativescript ×10
angular ×3
typescript ×2
ios ×1
javascript ×1
performance ×1
plugins ×1
react-native ×1
vue.js ×1