/React_Native_Mapbox

⚛️ React Native 0.58.4 & 🌏 Mapbox 6.1.3

Primary LanguageJavaScript

  1. Install Mapbox package for React Native

        $ npm i @mapbox/react-native-mapbox-gl
  2. Go to yourProject/android/build.gradle

    allprojects {
        repositories {
            jcenter()
            maven { url "$rootDir/../node_modules/react-native/android" }
            maven { url "https://jitpack.io" }
            maven { url "https://maven.google.com" }
        }
    }
  3. Go to yourProject/android/app/build.gradle

    dependencies {
        compile (project(':mapbox-react-native-mapbox-gl')) {
            compile ('com.squareup.okhttp3:okhttp:3.6.0') {
                force = true
            }
        }
    }
  4. Go to yourProject/android/settings.gradle

    include ':mapbox-react-native-mapbox-gl'
    project(':mapbox-react-native-mapbox-gl').projectDir = new File(rootProject.projectDir, '../node_modules/@mapbox/react-native-mapbox-gl/android/rctmgl')
  5. Go to yourProject/android/app/src/main/java/com/yourProject/MainApplication.java

    insert after import com.facebook.soloader.SoLoader:

    import com.mapbox.rctmgl.RCTMGLPackage;

    insert inside getPackages() after new MainReactPackage(),

    new RCTMGLPackage()
  6. Sign up to mapbox.com & get your access token!

    token