react-native-android - 当我将它嵌套在 Modal 中时,TouchableHighlight 不起作用
问题描述
我在其他屏幕(不是模态)中使用了touchablehighlight,它们工作正常。但我不明白为什么当我把它放在模态时它不能正常工作。如果我把按钮,它的作品。这是我的代码的一部分:请帮助我!
import React,{useState} from 'react'
import {
View,
Text,
Modal,
Button
} from 'react-native';
import { TouchableHighlight } from 'react-native-gesture-handler';
const Icons = () => {
const [modalVisible, setModalVisible] = useState(true);
console.log(modalVisible)
return (
<View >
<TouchableHighlight
onPress={()=>setModalVisible(!modalVisible) }
>
<Text>Son</Text>
</TouchableHighlight>
<Modal
visible={modalVisible}
>
<View >
<View style={{marginBottom: 100, }}>
<Text style={{fontSize:30}} >Hoşgeldiniz</Text>
</View>
<View style={''}>
<TouchableHighlight
onPress={ () => setModalVisible(!modalVisible) }
>
<Text>Sağol</Text>
</TouchableHighlight>
</View>
</View>
</Modal>
</View>
)
}
解决方案
我也有同样的问题。从“react-native”导入 TouchableHighlight。但我不知道为什么当我从手势导入时它不起作用。
推荐阅读
- javascript - 禁用将浮动字符粘贴到输入数字字段的可能性
- javascript - 为什么重新加载有一半的时间返回一个空状态?
- google-translate - 谷歌翻译在某些主机上自我屏蔽?
- java - 如何从可以属于两个或多个组的列表中对对象进行分组?
- python - 将前导零添加到 NumPy 数组中的字符串
- java - ResponseEntity 主体在两个 Web 服务调用之间丢失
- python - 如何在 OpenCV Python 中加入附近的边界框
- javascript - 木偶流播放
- azure - Azure 计算机视觉 API 的问题
- json - PL/SQL 或 SQL 的 JSON 模式验证,类似于 XML 模式验证的 XSLT