showsMyLocationButton doesn't work on Apple Maps

74 views Asked by At

To display the map, I'm using react-native-maps. I want to display the button to see my location, however, it only works in Google Maps; when I switched to Apple Maps, it didn't work. Also, the Compass button didn't work too.

I'm using

  • iOS 16.5.1 (20F75)
  • Expo Go v2.29.2
  • react-native: 0.72.3
  • react-native-maps: 1.7.1
  • expo: 49.0.3

Here is my code

import React from "react";
import { View, StyleSheet } from "react-native";
import MapView, { PROVIDER_GOOGLE } from "react-native-maps";

const CityDetailsScreen: React.FC = () => {

  return (
    <>
      <View style={styles.container}>
        {/* Apple Maps for iOS and Google Maps for Android */}
        <MapView
          style={styles.map}
          showsUserLocation={true}
          showsCompass={true}
          showsMyLocationButton={true}
        />
      </View>
    </>
  );
};

const styles = StyleSheet.create({
  container: {
    flex: 1,
  },
  map: {
    width: "100%",
    height: "100%",
  },
});

export default CityDetailsScreen;

Here is the Apple Maps

Apple Maps

Here is the Google Maps

Google Maps

0

There are 0 answers