nitaliano / react-native-mapbox-gl

A Mapbox GL react native module for creating custom maps
Other
2.16k stars 699 forks source link

TouchableOpacity's above MapView not touchable on Android. #1622

Closed dliff closed 5 years ago

dliff commented 5 years ago

After upgrading:

"dependencies": {
    "@mapbox/react-native-mapbox-gl": "git@github.com:mapbox/react-native-mapbox-gl.git#429f540224c0be789e055bee4b7ed2943f0a5573",
    "react": "^16.8.6",
    "react-native": "^0.59.4",
},

TouchableOpacity over MapView is invisible on Android until you set elevation greater than elevation from MapView. Once you do that, the TouchableOpacity is visible but untouchable on Android. Seems to work fine on iOS.

dliff commented 5 years ago

Placing the buttons after the MapView in JSX solved this. Not sure why the issue only occurs with latest updates and only on Android, but hope this helps someone.

Before:

<TouchableOpacity
    style={styles.menuButton}
    onPress={this.pressedMenu}
/>
<Mapbox.MapView />

After:

<Mapbox.MapView />
<TouchableOpacity
    style={styles.menuButton}
    onPress={this.pressedMenu}
/>