所以我遇到了以下问题.
有时,在更改XML模板并因某种原因(使用genymotion运行livesync)时出现错误,甚至完全删除文件内容也不会在编译时重置文件.
我的package.json:
"nativescript": {
"id": "org.nativescript.myapp",
"tns-android": {
"version": "1.7.1"
}
},
"dependencies": {
"nativescript-telerik-ui": "^1.0.1",
"tns-core-modules": "1.7.1"
},
"devDependencies": {
"nativescript-dev-typescript": "^0.3.0",
"typescript": "^1.8.10"
}
Run Code Online (Sandbox Code Playgroud)
例:
file.xml
<Page
xmlns="http://schemas.nativescript.org/tns.xsd"
class="my-page">
<WrapLayout horizontalAlignment="center">
<Button text="NEW ACCOUNT" tap="onTapAction" visibility="{{ noAccounts ? 'visible' : 'collapsed' }}" />
</WrapLayout>
</Page>
Run Code Online (Sandbox Code Playgroud)
出于某种原因,在添加Button标签后,我出现了错误.然后我试着:
rm -Rf ./platforms/android/build/* && rm -Rf ./platforms/android/.gradle/ && tns prepare android && tns build androidtns installtns platform remove android > tns platform add android什么都行不通,我总是得到同样的错误: …
有没有人有使用NativeScript创建自动完成输入的经验?我尝试搜索现有示例,但似乎找不到任何信息?
任何人?
谢谢
我想知道是否有人知道什么有更快的性能速度ionic2或nativescript?ionic2仍然在Cordova的webview上运行吗?或者它类似于nativescript?
如何在构建的iOS版本中设置应用名称?
查看app / App_Resources / iOS / Info.plist-我看到了
<key>CFBundleDisplayName</key>
<string>${PRODUCT_NAME}</string>
<key>CFBundleExecutable</key>
<string>${EXECUTABLE_NAME}</string>
这两个如何设置以及何时设置(在准备过程中?)?
在NativeScript应用程序中,我正在尝试应用一些将在应用程序中共享的全局样式.
这是我的结构:
- styles
- partials
- _buttons.scss
- _exports.scss
Run Code Online (Sandbox Code Playgroud)
_buttons.scss:
.flt-btn {
border-radius: 35px;
}
Run Code Online (Sandbox Code Playgroud)
_exports.scss:
@import '_buttons.scss';
Run Code Online (Sandbox Code Playgroud)
app.css:
@import './styles/partials/_exports.scss';
Run Code Online (Sandbox Code Playgroud)
你可以看到.flt-btn应该应用的样式,但它们不是.
我在一个延迟加载的功能模块中使用该类,login如下所示:
<Button class="flt-btn" text="A button"></Button>
Run Code Online (Sandbox Code Playgroud)
如果我直接将btn样式放在app.css没有任何导入的情况下它可以工作,但由于这是一个css文件,我不能在其中使用scss.所以我不确定进口是否会像这样做.
如何确保部分导入的样式在应用程序范围内应用?
编辑:
我发现这个,它成功导入我自己的风格融app.android.css和app.ios.css文件.但是..在我安装了SASS并完成此操作后,当我在模拟器中运行它时,应用程序完全空白,无论是在android还是ios中.
我没有错,没有.有没有人成功地让sass像这样工作?请让我知道如何获得奖励.
编辑2:
看起来应用程序正在运行,因为我可以在app.component.ts构造函数中成功记录某些东西,所以我猜测某些东西导致页面上的所有元素都随着新的样式设置而消失.
css sass nativescript angular2-nativescript nativescript-cli
我正在使用Nativescript/Angular 2构建一个应用程序,我也使用javascript 库来使用websockets将它连接到Actioncable Rails应用程序.尝试建立连接时,我在Nativescript日志控制台上获得了websocket错误代码1006,并且连接已关闭.
我注意到初始HTTP(握手)请求在标头上发送了两个Sec-WebSocket-Protocol值(actioncable-v1-json,actioncable-unsupported),但响应中的标头只有一个Sec-WebSocket-Protocol值缺少'actioncable-v1-json'和'actioncable-unsupported'.
我相信这个错误是因为响应中缺少协议而发生的.有谁知道如何将此标题(actioncable-unsupported)添加到握手响应中?或者导致此错误的其他任何想法?
rails日志中没有错误,它只是连接然后断开连接:
Started GET "/v1/cable/" [WebSocket] for 192.168.1.8 at 2017-04-02 17:04:06 -0700
Successfully upgraded to WebSocket (REQUEST_METHOD: GET, HTTP_CONNECTION: upgrade, HTTP_UPGRADE: websocket)
Finished "/v1/cable/" [WebSocket] for 192.168.1.8 at 2017-04-02 17:04:06 -0700
Run Code Online (Sandbox Code Playgroud)
Nativescript控制台上显示的错误消息是:
CONSOLE LOG file:///app/tns_modules/nativescript-actioncable/lib/action_cable.js:46:33: [ActionCable] Opening WebSocket, current state is null, subprotocols: actioncable-v1-json,actioncable-unsupported 1491179483038
CONSOLE LOG file:///app/tns_modules/nativescript-actioncable/lib/action_cable.js:46:33: [ActionCable] ConnectionMonitor started. pollInterval = 3000 ms 1491179483042
CONSOLE LOG file:///app/tns_modules/nativescript-actioncable/lib/action_cable.js:46:33: [ActionCable] Socket was closed because: code: 1006 1491179483109
Run Code Online (Sandbox Code Playgroud)
谢谢
大约一年以来,我一直在业余爱好Angular 2 Web应用程序上工作,现在已经可以开始测试了。我想知道如何使用现有的angular 2代码并将其转换为本机脚本应用程序。我一直在研究本机脚本,看来您必须从一开始就使用本机脚本。我还使用了Angular cli和几个npm软件包来帮助开发我的应用程序。
已编辑
I have an issue with routing in NativeScript 3.4 that drives me nuts. The idea of this test project is that the root app component is using a <page-router-outlet> and then using nested angular routing using <router-outlet> it loads a login parent and child, through which I am navigating to a main page which has two child routes.
If I route from the login.child.ts to the main parent/child with this.router.navigate(['/main']); then everything works fine and I continue alternating between the …
我在android模拟器中遇到问题,我的svg / icon图层显示为黑色。有时这会影响高速公路/道路标记以及我的地图标记。该插件当前正在使用默认标记,但是我也提供了自己的png文件,它们都遇到了这个问题。
有时放大会修复它(如下面图片中的一个标记所示)
我尚未在任何其他设备上对此进行测试,并且仅使用了来自android studio的android模拟器。
一些额外的细节
我正在使用Angular(和TS)运行nativescript,我已经注释掉了添加标记等的任何无关代码,但仍然在高速公路数字标记上存在问题(下面的示例)。这是我的模板:
<StackLayout class="page">
<ContentView height="100%" width="100%">
<Mapbox
accessToken="token"
mapStyle="streets"
[latitude]=defaultLocation.latitude
[longitude]=defaultLocation.longitude
hideCompass="true"
zoomLevel="8"
showUserLocation="false"
disableZoom="false"
disableRotation="false"
disableScroll="false"
disableTilt="false"
(mapReady)="onMapReady($event)">
</Mapbox>
</ContentView>
</StackLayout>
Run Code Online (Sandbox Code Playgroud)
看来我可以使用以下代码调用removeMarkers和addMarkers来触发此操作:
updateUserMarker(loc) {
console.log("updating user location marker with loc: ", loc)
this.map.removeMarkers([this.userMarker.id]);
this.userMarker.lat = loc.latitude;
this.userMarker.lng = loc.longitude;
this.map.addMarkers([this.userMarker]);
}
Run Code Online (Sandbox Code Playgroud) 在我更新到最新版本的nativescript-toast之后,它停止了在iOS中的工作(在Android中工作正常)。我的意思是,当应用程序按预期运行时,没有显示吐司。
在以前的版本中,一切都按预期进行。但是,当我更新到新版本后,它停止工作,并且还将pod SBToaster添加到了我的podfile中。
这是package.json
"nativescript-toast": "^2.0.0",
Run Code Online (Sandbox Code Playgroud)
过去我有版本1.4.6
在我的Podfile中,我有:
pod 'SBToaster', '~> 2.1.2'
pod 'Toast'
Run Code Online (Sandbox Code Playgroud)
在我的组件中,我有:
Toast.makeText(message).show();
Run Code Online (Sandbox Code Playgroud) nativescript ×10
android ×2
angular ×2
actioncable ×1
caching ×1
css ×1
error-code ×1
ionic2 ×1
mapbox ×1
sass ×1
websocket ×1
xml ×1