React-native-mapbox-gl: [v6] Invalid prop `centerCoordinate` of type `string` supplied to `RCTMGLMapView` even when passing a hardcoded Array

Created on 11 Nov 2017  路  7Comments  路  Source: nitaliano/react-native-mapbox-gl

This happens even if I hardcode the prop to be an array, for example:

<MapboxGL.MapView
  centerCoordinate={[-122.452652, 37.762963]} />

Is it possible that the new code is somehow mutating the type? I noticed that in https://github.com/mapbox/react-native-mapbox-gl/blob/c428b2297170b30a6d4e4d855320d28b48d17262/javascript/components/MapView.js#L590-L613 the array is converted to a JSON string toJSONString((makePoint(this.props.centerCoordinate)))

No one else has reported this problem with the new version of the library, so it makes me wonder if I'm doing something wrong here...

Most helpful comment

Is there any alternative to this besides upgrading react-native?

All 7 comments

Same error when I pass in a coordinate Array to the PointAnnotation component:

      <MapboxGL.PointAnnotation
        key={annotation.id}
        id={annotation.id}
        title={annotation.title}
        coordinate={[0, 0]} />

What version of react, prop-types, and react-native are you using?

Hi @nitaliano - looking at my yarn.lock file they are

react 16.0.0-alpha.12
prop-types 15.6.0
react-native 0.48.4

Just an FYI, I upgraded to RN 0.50.3 using react-native-git-upgrade and the error disappeared.

My issue is resolved, but I'll leave this open if you want to track the issue w/r/t backwards compatibility, @nitaliano

We can make a note in the README about this and close this out once that is merged in.

I had this warning too with RN 0.48.4. But after updating to 0.49.0 it warning disappears. I think this can be closed

Is there any alternative to this besides upgrading react-native?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

EwanValentine picture EwanValentine  路  3Comments

max-prokopenko picture max-prokopenko  路  4Comments

VentsislavDinev picture VentsislavDinev  路  3Comments

digitaldavenyc picture digitaldavenyc  路  4Comments

igor9silva picture igor9silva  路  3Comments