android - 离线时touchableopacity不起作用
问题描述
离线时touchableopacity不起作用,有时它需要很慢,比如需要几分钟才能运行onPress
<TouchableOpacity
onPress={() => this.example()}
style={{padding: 10, justifyContent: 'center', flexDirection: 'row', backgroundColor: '#F26525', width: Dimensions.get('screen').width * 0.8, borderRadius: 3, marginTop: 15}}>
<Icon name='refresh' size={20} color='#ffffff' />
<Text style={{fontSize: 16, color: '#ffffff', fontFamily: 'Quicksand-Medium'}}> Try Again</Text>
</TouchableOpacity>
我使用:react-native-cli:2.0.1 react-native:0.55.1
我试图改变成touchablewithoutfeedback,但它仍然一样
感谢您的帮助 ,
解决方案
我认为你应该在 touchableOpacity 中只使用一个组件,所以这样做:
<TouchableOpacity
onPress={() => this.example()}
style={{padding: 10, justifyContent: 'center', flexDirection: 'row', backgroundColor: '#F26525', width: Dimensions.get('screen').width * 0.8, borderRadius: 3, marginTop: 15}}>
<View>
<Icon name='refresh' size={20} color='#ffffff' />
<Text style={{fontSize: 16, color: '#ffffff', fontFamily: 'Quicksand-Medium'}}> Try Again</Text>
</View>
</TouchableOpacity>
推荐阅读
- java - 运行测试用例 ClientHttpResponse 时抛出 401 错误
- python - Python matlib text on bar chart
- apache - .htaccess 下 ipv6 子网的 RewriteCond
- c# - 如何替换文本文件中以特定单词开头并以 C# 中的特殊字符结尾的字符串?
- angular - Angular HttpClient TypeError: Object(...) is not a function
- python - xlrd.biffh.XLRDError:Excel xlsx 文件;不支持
- python - 有没有一种更简单的方法可以将列表随机拆分为子列表而不在 python 中重复元素?
- python - 删除分号作为行分隔符使用 pandas.read_csv 读取 csv 文件
- haskell - 如果是模棱两可的类型,如何确定类型?
- html - 材质-UI。如何用我的自定义一类覆盖库二类选择器