react-native-modal
react-native-modal copied to clipboard
Touchable/onPress components not woking inside a Modal
Issue with Modal
I have implemented Touchable inside modal but onPress is not working in iOS, it is working on android. Any help will be appreciated.
<Modal isVisible={true}>
<TouchableOpacity onPress={hide} style={styles.backContainer}>
<Icon
family="entypo"
name="chevron-small-left"
size={22}
color={colors.textColor}
/>
<Text
size={10}
lineHeight={16}
weight="semi-bold"
color={colors.textColor}
style={styles.back}>
Back
</Text>
</TouchableOpacity>
</Modal>
I had the same problem but only with the iPhone 12 pro simulator. I don't know why but I solved it by resetting the simulator and reinstalling the app.
I am having this problem on android only. Works fine with iOS.
@php4518 Where are you importing TouchableOpacity? From react-native or react-native-gesture-handler? It may make a difference. Hope you figured it out by now.
<Text
style={{
color: '#444',
fontSize: 15,
lineHeight: 26,
paddingTop: 14,
}}>
请您在使用我们服务前仔细阅读<Text
activeOpacity={0.6}
style={{color: '#5694FF', lineHeight: 26}}
onPress={() => {
this.props.navigation.navigate(
'GeneralWebViewBrowserForLogin',
{
url: Config.USER_PROTOCOL_ADDRESS,
},
);
}}>
《用户协议和隐私政策》
</Text>
</Text>
。用户协议作为我们提供服务的依据,确定您在何种条件、以何种方式使用我们的服务。隐私政策帮助您了解我们为什么,以及如何收集、存储、使用、保护您的个人信息。
</Text>
sometimes ”onpress“ is invalid。sometimes onPress is useful, transparency is no change。
Importing TouchableOpacity
from 'react-native' instead of importing from 'react-native-gesture-handler' solved the issue for me.
Hope it will help You!
@php4518 Where are you importing TouchableOpacity? From react-native or react-native-gesture-handler? It may make a difference. Hope you figured it out by now.
saves ton of my day