maps icon indicating copy to clipboard operation
maps copied to clipboard

UserLocation with renderMode='native' can't be pressed

Open MagnasiePro opened this issue 3 years ago • 0 comments

Describe the bug
When using renderMode='native', the onPress props does not work. (Tested on physical iOS device)

To Reproduce

import React from 'react';
import MapboxGL from '@react-native-mapbox-gl/maps';
import {StyleSheet, View} from 'react-native';
import Config from 'react-native-config';


MapboxGL.setAccessToken(Config.MAPBOX_SECRET);

const Map = () => {

return (
    <View style={styles.page}>
      <View style={styles.container}>
        <MapboxGL.MapView
          style={styles.map}
          styleURL={Config.MAPBOX_MAP_URL}>
          <MapboxGL.UserLocation
            renderMode="native"
            showsUserHeadingIndicator
            onPress={() => {
              console.log('Pressed');
            }}
          />
        </MapboxGL.MapView>
      </View>
    </View>
  );
};

const styles = StyleSheet.create({
  page: {
    flex: 1,
    justifyContent: 'center',
    alignItems: 'center',
    backgroundColor: '#F5FCFF',
  },
  container: {
    height: '100%',
    width: '100%',
    backgroundColor: 'tomato',
  },
  map: {
    flex: 1,
  },
});

export default Map;

Expected behavior
I'm expecting that we can use the native userLocationMarker like the 'normal' from MapBox

Actual behavior
Actually, nothing happens when userLocationMarker is pressed if renderMode='native'

Versions (please complete the following information):

  • Platform: iOS
  • Platform OS: iOS 15.3.1
  • Device: iPhone XS
  • Emulator/ Simulator: no
  • Dev OS: OSX 12.2.1
  • react-native-mapbox-gl Version 8.5.0
  • Mapbox GL version ??
  • React Native Version 0.66.4

MagnasiePro avatar Mar 11 '22 16:03 MagnasiePro