我在ScrollView中有一个SeachBar.在iOS中一切都很好.在Android上,ScrollView会自动滚动到SearchBar,为其添加焦点并显示软键盘.我可以通过android:windowSoftInputMode="stateHidden"在AndroidManifest.xml文件中添加一个活动来隐藏软键盘,但我无法弄清楚如何防止焦点(因此自动滚动).任何帮助将非常感激.
单击时,我想要一个按钮来生成三个子选项,然后再次点击时应该缩进然后在父按钮后面消失.我希望从代码中可以清楚地看到这一点(注意这是一个nativescript应用程序,因此有点奇怪的css选择).
exports.fabTap = function (args) {
var google = page.getViewById("google");
var facebook = page.getViewById("facebook");
var amazon = page.getViewById("amazon");
if (clicked == false) {
google.style.visibility = "visible";
facebook.style.visibility = "visible";
amazon.style.visibility = "visible";
google.animate({
translate: { x: -55, y: -66 },
duration: 500,
curve: enums.AnimationCurve.cubicBezier(0.1, 0.1, 0.1, 1)
});
facebook.animate({
translate: { x: 0, y: -75 },
duration: 500,
curve: enums.AnimationCurve.cubicBezier(0.1, 0.1, 0.1, 1)
});
amazon.animate({
translate: { x: 55, y: -66 },
duration: 500,
curve: enums.AnimationCurve.cubicBezier(0.1, 0.1, 0.1, 1)
}); …Run Code Online (Sandbox Code Playgroud) 所以我遇到了以下问题.
有时,在更改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?
遵循NativeScript Groceries Typescript Angular教程,我在第3章遇到了以下错误.
EXCEPTION: Error in ./AppComponent class AppComponent_Host - inline template:0:0
ORIGINAL EXCEPTION: No provider for Http!
ORIGINAL STACKTRACE:
Error: DI Exception
at NoProviderError.BaseException [as constructor] (/data/data/org.nativescript.groceries/files/app/tns_modules/@angular/core/src/facade/exceptions.js:27:23)
at NoProviderError.AbstractProviderError [as constructor] (/data/data/org.nativescript.groceries/files/app/tns_modules/@angular/core/src/di/reflective_exceptions.js:43:16)
at new NoProviderError (/data/data/org.nativescript.groceries/files/app/tns_modules/@angular/core/src/di/reflective_exceptions.js:80:16)
at ReflectiveInjector_._throwOrNull (/data/data/org.nativescript.groceries/files/app/tns_modules/@angular/core/src/di/reflective_injector.js:786:19)
at ReflectiveInjector_._getByKeyDefault (/data/data/org.nativescript.groceries/files/app/tns_modules/@angular/core/src/di/reflective_injector.js:814:25)
at ReflectiveInjector_._getByKey (/data/data/org.nativescript.groce
Run Code Online (Sandbox Code Playgroud)
我在教程中来回走动,看看我是否错过了什么,但似乎我努力地遵循每一个步骤.
我该如何解决这个问题.
如何在构建的iOS版本中设置应用名称?
查看app / App_Resources / iOS / Info.plist-我看到了
<key>CFBundleDisplayName</key>
<string>${PRODUCT_NAME}</string>
<key>CFBundleExecutable</key>
<string>${EXECUTABLE_NAME}</string>
这两个如何设置以及何时设置(在准备过程中?)?
我正在使用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)
谢谢
我正在按照此处说明的指南进行操作:https : //nativescript-vue.org/en/docs/getting-started/vue-devtools/
I have the dev tools and the app up and running but the dev tools says "Waiting for connection..." while the app is already running on my android emulator.
How can I fix this?
我正在使用NativeScript-Vue。
我有一些受保护的页面(仅限会员)。我将用户的登录数据保存在localstorage中。我有两个问题:
当用户打开应用程序时,我们应该在应用程序中的哪个位置编写代码以检索用户的登录数据。我想从本地存储中读取数据并将其填充到Vuex存储中。我知道如何从localstorage读取数据,但是我不知道应该在何时何地进行操作,以便用户可以首先登录。
有几个页面受到保护(仅限成员)。对于这些用户,如果他们已登录(基于vuex存储),我想向他们显示页面内容,但是如果他们未登录,我希望他们导航到登录页面。同样,我对于应该在何处编写此代码/条件感到困惑。
任何帮助表示赞赏。
nativescript ×10
javascript ×2
actioncable ×1
android ×1
angular ×1
animation ×1
caching ×1
css ×1
error-code ×1
ionic2 ×1
vue-devtools ×1
vue.js ×1
vuejs2 ×1
websocket ×1
xml ×1