-
when any change is made in MapView, child components inside MapView are lost (crash). For example, when dynamically changing styleURL, then UserLocation, RasterDEMSource / Terrain, and ShapeSource are lost. I'm managing this via Expo and running: There are no associated error messages, including when I run/build in Xcode to my physical device. "react-native": "0.68.2" Edit: State is being managed with Redux const Map = () => {
const activeBasemap = useSelector((state) => state.basemap.value)
return (
<>
<View style={styles.page}>
<View style={styles.container}>
<MapView
style={styles.map}
scaleBarEnabled={false}
attributionPosition={{
bottom: 50,
left: 5,
}}
compassPosition={{ top: 10, left: 10 }}
logoEnabled={false}
styleURL={activeBasemap}
onLongPress={(e) => dispatch(addWP(e))}
>
<RasterDemSource
id="mapbox-dem"
url="mapbox://mapbox.mapbox-terrain-dem-v1"
tileSize={514}
maxZoomLevel={14}
>
<Terrain exaggeration={1.5} />
</RasterDemSource>
<UserLocation
visible
showsUserHeadingIndicator={true}
onUpdate={(location) => drawRoute(location)}
/>
<Camera
centerCoordinate={[
currentLocation.longitude,
currentLocation.latitude,
]}
zoomLevel={14}
followUserLocation={followStatus}
/>
</MapView>
</View>
</View>
</>
)
} |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
well to some level of embarrassment, I found out the issue was with my rnmapbox package. I reinstalled npm install rnmapbox/maps#main --save and it fixed some dependency issue I must have had. Everything is working as expected now. |
Beta Was this translation helpful? Give feedback.
well to some level of embarrassment, I found out the issue was with my rnmapbox package. I reinstalled npm install rnmapbox/maps#main --save and it fixed some dependency issue I must have had. Everything is working as expected now.