React native TouchableOpacity onPress not working on Android

user3653164 picture user3653164 · Nov 29, 2018 · Viewed 36.6k times · Source

TouchabelOpacity works fine on iOS but the onPress method does not work on Android for me.

My react-native version: 0.57.4

My code:

const initDrawer = navigation => (
  <TouchableOpacity
    style={{ left: 16 }}
    onPress={() => onPressDrawerButton(navigation)}
  >
    <Ionicons name="ios-menu" color="white" size={30} />
  </TouchableOpacity>
);

Answer

Ali picture Ali · May 11, 2019

I had similar problem. Pay attention from where import your "TouchableOpacity". When I changed "TouchableOpacity" from "react-native-gesture-handler" to "react-native", it worked for me (for Android platform)