nativescript - Nativescript 6 - 点击事件未在子元素上触发
问题描述
附加到 StackLayout 的点击事件代码适用于 Android,但不适用于 iOS。
XML:
<GridLayout id="outmost" row="2">
<GridLayout rows="*" columns="*, *">
<StackLayout class="btn btn-filled" col="0" margin="0 7 0 15" tap="login">
<Label text="LOG IN" horizontalAlignment="center" verticalAlignment="middle" class="btn-text" />
</StackLayout>
</GridLayout>
</GridLayout>
点击事件不会在 iOS 上触发。如果我将 tap="login" 移动到最顶层的 GridLayout(id=outmost),事件就会触发。在我看来,该事件被 GridLayout#outmost 捕获,而不是向下传播给孩子。
这在我将应用程序迁移到 NS 6 后开始发生。
这是我的 package.json:
{
"name": "app",
"nativescript": {
"id": "com.company.app",
"tns-ios": {
"version": "6.0.1"
},
"tns-android": {
"version": "6.0.1"
}
},
"description": "App",
"license": "SEE LICENSE IN <your-license-filename>",
"repository": "<fill-your-repository-here>",
"dependencies": {
"moment": "^2.24.0",
"nativescript-appversion": "^1.4.2",
"nativescript-geolocation": "5.1.0",
"nativescript-iqkeyboardmanager": "1.3.0",
"nativescript-loading-indicator": "2.4.0",
"nativescript-local-notifications": "3.1.0",
"nativescript-plugin-firebase": "9.0.4",
"nativescript-theme-core": "~1.0.4",
"tns-core-modules": "~6.0.0"
},
"devDependencies": {
"nativescript-dev-webpack": "~1.0.0",
"typescript": "3.4.5"
},
"readme": "NativeScript Application",
"author": ""
}
关于如何解决这个问题的任何想法?
谢谢。
解决方案
推荐阅读
- reactjs - Ant Design 输入组件不更新值
- c++ - 我误解了吗?关于 DFS 的答案似乎被扭曲了
- wpf - 棱镜:不同用户控件之间的导航
- multithreading - 从其他线程执行 GTK 函数
- prometheus - 如何使用指标中的普罗米修斯查询刮标签值并设置警报
- c++ - boost::string_ref 比 std::string 复制慢
- wordpress - 如何将 TinyMCE 与 WPForms 集成
- javascript - moment.fromNow() 时区问题
- laravel - 外键约束形成错误 2
- wso2 - WSO2 EI - 检索脚本内设置的属性