反应原生,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,Essentials]}>
                    <Text style={{ color: '#fff',paddingBottom: 15,paddingLeft: 5 }} >  Essentials  </Text>
                </Animated.View>
            </TouchableWithoutFeedback>

            <TouchableWithoutFeedback onPress={() => Alert.alert('saveIconn')}>
                <Animated.View style={[styles.button,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>

相关问答

Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其...
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。...
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbc...