skip to Main Content

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>

enter image description here

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


  1. 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.

    Login or Signup to reply.
  2. 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

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search