android - 为什么 Touchable Opacity 不能在 android 上运行?
问题描述
可触摸的不透明度在 IOS 上运行良好,但不适用于 android。
TouchableOpacity
正在从react-native
我的代码:
<View style = { styles.view}>
<TouchableOpacity style = {styles.button} onPress={() => this.props.play}>
<Text style = { styles.buttonText}>Play</Text>
</TouchableOpacity>
</View>
我的样式表:
button:{
backgroundColor : '#2F2440',
padding : 10,
borderRadius : 10,
marginTop : RFValue(305),
marginLeft : RFValue(20),
marginRight : RFValue(30),
width : RFValue(200),
height : RFValue(40),
alignSelf : 'baseline',
},
解决方案
你需要更换onPress={() => this.props.play}
与onPress={() => this.props.play()}
或这个onPress={this.props.play}
推荐阅读
- ruby-on-rails - 使用 Cocoon 在 link_to_add_association 点击时自动添加嵌套的子部分
- postgresql - 在 Docker 中设置与现有项目的 PostgreSQL 连接
- php - 为什么在我的本地主机 PHP SQL 插入上工作的 ubuntu 服务器上不起作用?
- three.js - 三个 JS - 如何在运行时将材质从 Lambert 更改为 Phong?
- javascript - quasar/vue:选择文本时在 q-input 文本区域中触发上下文菜单
- oracle - 触发器中的绑定变量错误(在一个环境中工作在另一个环境中不是)
- xamarin - Xamarin Master Detail prism 导航栏后退按钮
- r - 计算 R 中的平均值并将结果添加为新行而不是新列
- java - 使用 pdfbox 在 Java 中解析 pdf 文件时出错
- android - 从 BottomSheetDialogFragment 打开片段 - Android Studio Java