'react native map is not updating custom style directly
I have created a custom map style using react native maps but sometimes it shows a default map for 1-2 seconds then a new style will update. Is there any way we can check the map is loaded or not?
<MapView
ref={mapRef}
provider={PROVIDER_GOOGLE}
customMapStyle={customMapStyle}
showsCompass={false}
showsScale={false}
showsBuildings={false}
showsTraffic={false}
showsIndoors={false}
showsUserLocation={false}
zoomEnabled={true}
pitchEnabled={true}
zoomTapEnabled={true}
{...props}
style={[styles.map, mapStyle as any]}
>
{props.children}
</MapView>
Solution 1:[1]
I think you could try to use onMapReady
event.
It will "Callback that is called once the map is fully loaded."
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | 高鵬翔 |