react-native - React Native,TouchableOpacity 警报一无所获
问题描述
当我单击按钮打开切换时,它工作正常,但是当我想单击以显示警报时,我什么也没得到。任何想法
<View style={[styles.container, this.props.style]}>
<TouchableWithoutFeedback>
<Animated.View style={[styles.button, styles.menu, Epargne]}>
<Text style={{ color: '#fff' }} > Epargne </Text>
</Animated.View>
</TouchableWithoutFeedback>
<TouchableWithoutFeedback>
<Animated.View style={[styles.button, styles.menu, Essentials]}>
<Text style={{ color: '#fff', paddingBottom: 15, paddingLeft: 5 }} > Essentials </Text>
</Animated.View>
</TouchableWithoutFeedback>
<TouchableWithoutFeedback onPress={() => Alert.alert('saveIconn')}>
<Animated.View style={[styles.button, styles.menu, Plaisirs]}>
<Text style={{ color: '#fff', padding: 11 }} > Petits Plaisirs </Text>
</Animated.View>
</TouchableWithoutFeedback>
<TouchableWithoutFeedback onPress={this.toggleMenu}>
<Animated.View style={[rotation]}>
<Image
style={{ width: 90, height: 110, padding: 50, paddingLeft: 80 }}
source={require('../assets/budget.jpg')}
/>
<Text style={{ color: '#000', padding: 11 }} > Gerer mon Budget </Text>
</Animated.View>
</TouchableWithoutFeedback>
</View>
解决方案
这可能会有所帮助
showAlert = () => {
Alert.alert('saveIconn')
}
<TouchableWithoutFeedback onPress={this.showAlert}>
<Animated.View style={[styles.button, styles.menu, Plaisirs]}>
<Text style={{ color: '#fff', padding: 11 }} > Petits Plaisirs </Text>
</Animated.View>
</TouchableWithoutFeedback>
推荐阅读
- javascript - 如何使用 java 脚本将 HTML 表单详细信息写入 Excel 工作表
- amazon-web-services - 当我登录到不同的图像存储库时,从哪里提取 docker 图像?
- ruby-on-rails - Ruby on Rails 项目图像显示问题 - 在网页上
- cakephp-3.0 - CakePHP 3.x - 资产添加版本而不是时间戳
- python - 为什么我的尝试除了不能正常工作?蟒蛇 3
- php - 隐藏 Composer 安装命令的输出
- java - Java:打印数组元素并插入换行符
- awk - 需要使用 awk 从 HL7 文件中检索值
- javascript - Javascript:从子字符串中查找数组中最相关的字符串
- python - 根据条件在熊猫数据框中的多行中设置值