Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/wix/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
React native ReactNative:元素显示在顶部,但不会在按下时触发_React Native_Expo - Fatal编程技术网

React native ReactNative:元素显示在顶部,但不会在按下时触发

React native ReactNative:元素显示在顶部,但不会在按下时触发,react-native,expo,React Native,Expo,我创建了一个下拉列表。它的元素出现在身体的顶部,然而,当我按下它们时,它实际上会触发按下它们下面的元素 你们可以看到这个问题: 下拉列表的代码为: <View style={[styles.container]}> <TouchableOpacity style={styles.main_container} onPress={this.animate}> <Text style={s

我创建了一个下拉列表。它的元素出现在身体的顶部,然而,当我按下它们时,它实际上会触发按下它们下面的元素

你们可以看到这个问题:

下拉列表的代码为:

            <View style={[styles.container]}>
            <TouchableOpacity style={styles.main_container} onPress={this.animate}>
                <Text style={styles.text}>{this.state.selectedCategoryText}</Text>
                <Image style={styles.image}
                    source={require('../../assets/icons/dropdown.png')}
                />
            </TouchableOpacity>
            <View >
                <Animated.View style={[styles.animated_container,{opacity: this.opacity, zIndex:1, elevation:1}]}>
                    <ScrollView style={{height:60}}>
                        { this.data.map( (item, i)=>
                             <TouchableOpacity 
                                style={{}}
                                disabled={false} 
                                key={i} 
                                onPress={()=>this.selectItem(i)}>
                                    <Text style={styles.item_text}>{item} </Text>
                              </TouchableOpacity>
                             )}
                    </ScrollView>
                </Animated.View>

            </View>
        </View>

我已经设法知道问题的根源,但是我仍然不知道到底是什么问题。React.Navigation的抽屉导航器正在执行某些操作。如果我从抽屉导航器中删除包含下拉列表的屏幕,则它可以正常工作。

我已设法知道问题的根源,但我仍然不知道到底是什么问题。React.Navigation的抽屉导航器正在执行某些操作。如果我从抽屉导航器中删除包含下拉列表的屏幕,则它可以正常工作。

尝试使用手势处理程序非反应本机的可触摸不透明度

尝试使用手势处理程序非反应本机的可触摸不透明度

尝试添加
显示:块
z-index:999999
(以验证)。或者,添加一些填充以查看是否有帮助。React native不支持块。zIndex也不会产生任何影响:(Android上存在一个react原生错误,触摸事件对绝对位于容器元素之外的元素不起作用。我已设法知道问题的根源。react中的DroperNavigator。导航正在做一些事情。如果我从DroperNavigator中删除包含下拉菜单的屏幕,则其工作正常。try添加
display:block
z-index:9999999
(以验证)。或者,添加一些填充以查看是否有帮助。React-native不支持block。zIndex也不起任何作用:(Android上存在一个react原生错误,触摸事件对绝对位于容器元素之外的元素不起作用。我已设法知道问题的根源。react中的DroperNavigator。导航正在起作用。如果我从DroperNavigator中删除包含下拉菜单的屏幕,则它可以正常工作。
animated_container:{
    backgroundColor: colors.secondaryWhiteColor,
    position: 'absolute',
    top: '100%',
    width: '100%', height: 70
}