nitaliano / react-native-mapbox-gl

A Mapbox GL react native module for creating custom maps
Other
2.16k stars 697 forks source link

calling `Mapbox.setAccessToken()` function makes my application to crash #1477

Closed blueturtle13g closed 5 years ago

blueturtle13g commented 5 years ago

hello I'm following mapbox tutorial for react native https://www.mapbox.com/help/tutorials/first-steps-react-native-sdk/ . this is the code that they've given as the first example: ` import React, { Component } from 'react'; import { StyleSheet, View } from 'react-native'; import Mapbox from '@mapbox/react-native-mapbox-gl'; Mapbox.setAccessToken('pk.eyJ1IjoicGlhMTMiLCJhIjoiY2pyMHFkbjd2MG42eDQycXF1ODg5em5yOCJ9.of1u8U450sFMBUsZ8TkkCQ'); export default class App extends Component<{}> { render() { return (

);

} } const styles = StyleSheet.create({ container: { flex: 1, }, }); `

but my application kept crashing(I get this error "applicationName has stopped"), so I removed some codes step by step and noticed that commenting out Mapbox.setAccessToken function prevents my app from crashing. I also change the AccessToken to my own accesToken but didn't work. OS: windows 10 "dependencies": { "@mapbox/react-native-mapbox-gl": "^6.1.3", "react": "16.6.3", "react-native": "0.57.8",

Naop commented 5 years ago

Hello, I was having the same issue with the following dependencies:

"dependencies": {
    "@mapbox/react-native-mapbox-gl": "^6.1.3",
    "react": "16.7.0",
    "react-native": "0.57.8",
  }

I found that the solution proposed in #1139 (comment) worked.

onitzschke commented 5 years ago

It's dependencies related and updated in the example.