我是新手NativeScript,我尝试使用NativeScript和运行我的 HelloWord 应用程序Angular。我连接了我的 android 设备,然后我运行命令tns run android它如何我跟随错误。
Error: ENOTEMPTY: directory not empty, rmdir 'C:\Users\Admin\AppData\Local\Temp\runtimeDir11923-7308-1ed73lj.8p03\framework\app\libs\runtime-libs' at Object.fs.rmdirSync (fs.js:846:18)
at rmkidsSync (C:\Users\Admin\AppData\Roaming\npm\node_modules\nativescript\node_modules\temp\node_modules\rimraf\rimraf.js:247:11)
at rmdirSync (C:\Users\Admin\AppData\Roaming\npm\node_modules\nativescript\node_modules\temp\node_modules\rimraf\rimraf.js:237:7)
at fixWinEPERMSync (C:\Users\Admin\AppData\Roaming\npm\node_modules\nativescript\node_modules\temp\node_modules\rimraf\rimraf.js:150:5)
at rimrafSync (C:\Users\Admin\AppData\Roaming\npm\node_modules\nativescript\node_modules\temp\node_modules\rimraf\rimraf.js:216:26)
at C:\Users\Admin\AppData\Roaming\npm\node_modules\nativescript\node_modules\temp\node_moules\rimraf\rimraf.js:245:5
Run Code Online (Sandbox Code Playgroud)
我怎么了?你能帮忙吗?
webpack nativescript angular2-nativescript nativescript-angular
一年以来,我们一直在使用storybook来开发我们的 angular web 应用程序,以及我们的 ionic cordova 应用程序。
现在我们要评估 NativeScript 是否是满足我们需求的更好解决方案。我们目前想知道是否可以使用 NativeScript 制作故事书,因为它已被证明对 UI 开发非常有用。
我知道故事书官方不支持 NativeScript - 但 React Native 在理论上应该是可能的,尽管我找不到任何关于此的信息。
我现在的问题是:有没有人能够用 NativeScript 制作故事书?或者是否存在我无法找到的替代方案?或者至少有一些概念/工具可以单独开发组件?
默认情况下,ListPicker会占用大量屏幕空间。有没有办法让它<select>在移动设备上显示时像 HTML 的隐喻一样?
我之前使用过这个 React Native 插件,它正是我想要的隐喻,但是对于 NativeScript。
通过 NativeScript 可以轻松做到这一点吗?我想利用特定于平台的选择隐喻,因此显示/隐藏ListPicker或放入ListPicker模式不是我想要的。
另外,我将有一个相当长的列表,因此操作对话框对我不起作用。
更新:我知道nativescript-drop-down,但是它不使用 webviews 和React Native 插件所做的平台特定的“从选择列表中选择”小部件。
我所说的“从选择列表中选择特定于平台的小部件”是指(来自https://www.w3schools.com/tags/tryit.asp?filename=tryhtml_select):
iOS(音符选择器在键盘所在的位置呈现,使用 rolodex 选择器):

Android(注意模式,带有滚动选项列表):

nativescript angular2-nativescript nativescript-telerik-ui nativescript-angular nativescript-plugin
我正在尝试配置karma.config.js以NativeScript Angular跟随官方文档运行项目:
https://docs.nativescript.org/angular/tooling/testing
问题是测试总是失败并且总是在运行node_modules/,platforms/但我在excludeFiles属性中提到了它们.
我创建了一个github repo来重现它
我正在使用分离的分支来重现它
jasmine和mochahttps://github.com/francisrod01/native-script-angular2-karma-demo
karma-typescript+jasmine依赖关系:
nativescript-angular: ~5.3.0nativescript-theme-core: ~1.0.4nativescript-unit-test-runner: ^0.3.4reflect-metadata: ~0.1.8tns-core-modules: ~4.0.0devDependencies:
@types/node: ^10.1.4babel-traverse: 6.26.0babel-types: 6.26.0babylon: 6.18.0jasmine-core: ^3.1.0karma: ^2.0.2karma-jasmine: ^1.1.2karma-nativescript-launcher: ^0.4.0karma-typescript: ^3.0.12lazy: 1.0.11nativescript: ^4.0.2nativescript-dev-typescript: ~0.7.0typescript: …karma-runner karma-jasmine nativescript-angular karma-typescript
在使用用户可以输入的 NativeScript 应用程序视图时,本机应用程序键盘输入会覆盖TextField组件。虽然这不会阻止用户输入文本,但它会扰乱 UX 流程并且从 UI 的角度来看看起来很糟糕。
如何让键盘不覆盖输入,而是像其他本机应用程序一样出现在它下面?
更新 2
现在它不再覆盖,我注意到当我离开应用程序切换到另一个应用程序或挂起NativeScript 应用程序时,当我回到它时问题再次出现。我该怎么做才能坚持原来的行为?
javascript typescript nativescript nativescript-angular angular
我正在使用 NativeScript (CLI v5.2.0) Angular (v7.2.3) 开发移动应用程序,并且我的 @ViewChild ElementRef 未定义。
我在“@angular/core”的导入中检查了 ViewChild 和 ElementRef 的存在,重命名了我的 @ViewChild 变量,将范围从 public 更改为 private,在 ngAfterViewInit 中移动了 console.log() (参见:https://github .com/NativeScript/nativescript-angular/issues/188#issuecomment-212815619)并使用“tns debug android --clean --bundle”重建我的项目。
组件名称.component.ts :
@ViewChild("test") private _scrollView: ElementRef;
constructor(page: Page) {
page.actionBarHidden = true;
}
ngAfterViewInit() {
console.log("ScrollView element:", this._scrollView.nativeElement);
}
...
Run Code Online (Sandbox Code Playgroud)
组件名称.component.html :
<GridLayout columns="*" rows="*, auto">
<ScrollView (swipe)="onSwipe($event)" col="0" row="0" #test>
<StackLayout>
...
Run Code Online (Sandbox Code Playgroud)
如果我将 #test 放在开头,就在 ScrollView 元素之后,我有未定义的“this._scollView”变量。
如果我把 #test 放在最后,就像上面的例子一样,一切正常,我在 console.log(this._scrollView.nativeElement) 中显示我的元素!
一个错误?
scrollview nativescript viewchild nativescript-angular elementref
我正在尝试使用 new 将 Angular 应用程序迁移到带有 Nativescript 的共享代码库@nativescript/schematics,但是,在构建应用程序的移动版本时,我在导入我的 Angular 库时遇到了问题。我使用 angular-cli 创建了库 ( ng generate library)。
对于 web 版本,我所要做的就是单独构建库ng build library-name,然后允许我将它导入到主应用程序中。
如何构建可以在运行时导入主应用程序的库的移动版本tns run ios --bundle?我已经使用适当的 *.tns 文件迁移了库的组件和模块。
任何帮助表示赞赏
我尝试找出创建模块的方式,该模块能够以模态打开并带有在内部导航的选项。在TabView出口中或从其他模式中打开。就像这张照片上展示的那样:
我找到了许多简单的示例,但是如果我将其与模块结合使用-我会像这样的错误不断摇摆
我已经准备好了游乐场 https://play.nativescript.org/?template=play-ng&id=7Pfmcl&v=4
我的灵感:
https://www.nativescript.org/blog/implementing-a-login-for-nativescript-apps-with-tab-based-navigation-它已经解决了登录,欢迎和tabview
https://medium.com/@williamjuan027/nativescript-angular-lazy-loading-modals-e56451392c8d-延迟加载模式
有人可以帮我吗?您是否有在原生脚本中使用angular进行一些高级路由的经验?
非常感谢Michal
我正在使用 nativescript-angular 框架开发 android 和 iOS 应用程序。我正在为 fcm 推送通知使用nativescript-plugin-firebase 插件。在 iOS 平台中,通知在前台和后台都出现。但是在android中,只有当应用程序在后台时才会收到通知。
我们如何解决这个问题?
我的 Firebase 初始化代码:
firebase.init({
showNotifications:true,
showNotificationsWhenInForeground:true,
onPushTokenReceivedCallback:(token)=>{
console.log("onPushTokenReceivedCallback:",{token});
},
onMessageReceivedCallback:(message:firebase.Message)=>{
console.log("onMessageReceivedCallback:",{message});
})
.then(()=>{
console.log("Initialized");
})
.catch(error=>{
console.log("Initialize",{ error });
});
Run Code Online (Sandbox Code Playgroud) 我无法向我的 Nativescript 项目添加新组件,当我执行ng generate component faqs它时返回错误:
Option "entryComponent" is deprecated: Since version 9.0.0 with Ivy, entryComponents is no longer necessary.
Cannot read property 'kind' of undefined
Run Code Online (Sandbox Code Playgroud)
或者如果我运行它就像ng generate component它问我组件名称一样
? What name would you like to use for the component? faqs
Run Code Online (Sandbox Code Playgroud)
并返回
Option "entryComponent" is deprecated: Since version 9.0.0 with Ivy, entryComponents is no longer necessary.
Cannot read property 'match' of undefined
Run Code Online (Sandbox Code Playgroud)
我在用:
Nativescript 7.0.10
Angular CLI: 10.1.4
Node: 12.18.4
OS: win32 x64
Angular: 10.1.4
... …Run Code Online (Sandbox Code Playgroud) nativescript ×9
angular ×3
typescript ×3
elementref ×1
javascript ×1
karma-runner ×1
router ×1
scrollview ×1
viewchild ×1
webpack ×1