nitaliano / react-native-mapbox-gl

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

Fixed mapping MGL enum values on RN 0.59 #1593

Closed mattijsf closed 5 years ago

mattijsf commented 5 years ago

Fixes:

https://github.com/nitaliano/react-native-mapbox-gl/issues/1498 https://github.com/nitaliano/react-native-mapbox-gl/issues/1589 https://github.com/nitaliano/react-native-mapbox-gl/issues/1110

I've noticed that since RN 0.59 react-native provides NSNumber values differently depending on the architecture of the platform, these are the container types NSNumber uses when providing lineCap (and other integer based values):

RN 0.57: iPhone 5S: kCFNumberSInt64Type iPhone SE: kCFNumberSInt64Type

RN 0.59: iPhone 5S: kCFNumberSInt64Type iPhone SE: kCFNumberFloat64Type

Normally this doesn't impose any problems but for some reason it produces the following error when mapping these numbers as a raw value into MGLStyleValue that is assigned to an NS_ENUM such as lineCap / lineJoin / iconAnchor etc:

Assertion failed: (it != std::end(MGLLineCap_names)), function toString, file /Users/distiller/project> /platform/darwin/src/MGLLineStyleLayer.mm

This PR makes sure that all enum style properties values are treated as NSUInteger before wrapping them into MGLStyleValue.

kristfal commented 5 years ago

Im good with merging this one.