react-native-modal icon indicating copy to clipboard operation
react-native-modal copied to clipboard

Touchable/onPress components not woking inside a Modal

Open php4518 opened this issue 3 years ago • 6 comments

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>
        

php4518 avatar Jul 28 '21 13:07 php4518

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.

Screenshot 2021-07-29 at 12 40 37

mario2896 avatar Jul 29 '21 10:07 mario2896

I am having this problem on android only. Works fine with iOS.

projjwalg avatar Aug 11 '21 13:08 projjwalg

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

NathanBeesley avatar Oct 01 '21 17:10 NathanBeesley

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

inkCrazy avatar Nov 12 '21 00:11 inkCrazy

Importing TouchableOpacity from 'react-native' instead of importing from 'react-native-gesture-handler' solved the issue for me. Hope it will help You!

MaierPavel avatar Jun 15 '22 17:06 MaierPavel

@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

hank619 avatar May 19 '23 06:05 hank619