2

I tried to use code from this website: https://serveanswer.com/questions/react-native-maps-animatetoregion-does-not-work-with-region-or-initialregion Unfortunately I have an error message. Here is the code and error message that I get. Thanks for your help.

const mapRef = React.useRef<MapView >(null);
<MapView
  ref={mapRef}
  initialRegion={initialRegion}
  onRegionChangeComplete={handleRegionChange}
/>
mapRef.current?.animateToRegion({
  latitude: selectedCoordinates.lat,
  longitude: selectedCoordinates.lng,
  longitudeDelta: 0.004,
  latitudeDelta: 0,
});

enter image description here

Michal96
  • 65
  • 6
  • I had the same issue but just on Android. iOS has worked well. I ended up to patch the MapView.js inside the node_modules. – lortschi Jul 05 '23 at 08:41

0 Answers0