React Native, TouchableOpacity alert get nothing

516 views Asked by At

when i click on the button to open the toggle it works fine but when i want to click to display the alert i get nothing. any idea

 <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>
1

There are 1 answers

1
Nooruddin Lakhani On

This might help

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>