SteffeyDev / react-native-popover-view

A well-tested, adaptable, lightweight <Popover> component for react-native
MIT License
613 stars 92 forks source link

onPress events inside the popover not working in Android #67

Closed ateev closed 4 years ago

ateev commented 4 years ago

I have a simple use case where inside popover, I want the button inside popover to perform some actions. This is working in iOS but not in Android.

Here's the code:

<Popover
  isVisible={this.state.isMenuOpen}
  fromView={this.menuButton}
  placement="top"
  animationConfig={{
    duration: 150,
    easing: Easing.inOut(Easing.quad),
  }}
  backgroundStyle={{
    backgroundColor: 'transparent',
  }}
  popoverStyle={{
    paddingHorizontal: 32,
    paddingVertical: 16,
    borderRadius: 5,
  }}
  verticalOffset={-8}
  onRequestClose={() => this.setState({ isMenuOpen: false })}
>
  <TouchableOpacity
    onPress={() => console.log('Hi')}
  >
  <View style={styles.popupMenuItem}>
    <Image
      style={styles.icon}
      source={require('../../static/icon.png')}
    />
    <Text>Icon</Text>
  </View>
  </TouchableOpacity>
</Popover>

The onPress events on TouchableOpacity are not working in Android. Let me know if you'll need more information to debug

ateev commented 4 years ago

Fixed it. My bad. I was using TouchableOpacity import from react-native-gesture-handler.

z2700589 commented 1 year ago

no,I was using TouchableOpacity import from react-native still unable to work