簡體   English   中英

React Native,TouchableOpacity 警報一無所獲

[英]React Native, TouchableOpacity alert get nothing

當我單擊按鈕打開切換時,它工作正常,但是當我想單擊以顯示警報時,我什么也得不到。 任何的想法

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

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM