I created a React Native project with Expo. I have imported the library @malibre/malibre-react-native
and added this code in my component:
<View style={styles.page}>
<MapLibreGL.MapView
ref={mapviewRef}
style={styles.map}
logoEnabled={false}
styleURL="https://map.ir/vector/styles/main/mapir-Dove-style.json"
attributionControl={false} // Remove attribution for cleaner UI
/>
</View>
But every time I run it, I get:
R Native part of Mapbox React Native libraries were not registered properly, double check our native installation guides.
ERROR TypeError: Cannot read property ‘StyleURL’ of null, js engine: hermes
2
Answers
Are you trying to run the code in Expo Go? This will not work. You will need to "eject" your code into a bare react native flow. To do this, follow the steps to create a development build on Expo.
If you had done this already, you will need to rebuild your code after you install the maplibre library.
Same issue, you can still use the main lib mapLibre to create a webview with the "use dom" directive. it the same process and after for production replace with the react-native-maplibre lib