Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Transition styles cause error in Android #43

Closed
psavage opened this issue May 13, 2019 · 0 comments · Fixed by #44
Closed

Transition styles cause error in Android #43

psavage opened this issue May 13, 2019 · 0 comments · Fixed by #44

Comments

@psavage
Copy link

psavage commented May 13, 2019

Describe the bug
In the latest master version 18fc03c, setting a Transition style for a style property causes an error in Android (iOS works properly):

com.facebook.react.bridge.ReadableNativeArray cannot be cast to com.facebook.react.bridge.ReadableNativeMap
getMap
    ReadableNativeArray.java:153
getMap
    ReadableNativeArray.java:22
<init>
    RCTMGLStyleValue.java:46
getStyleValueForKey
    RCTMGLStyle.java:59
setRasterLayerStyle
    RCTMGLStyleFactory.java:526
addStyles
    RCTMGLRasterLayer.java:25
...

To Reproduce
Set the transition style for any transitionable style property e.g. set rasterOpacityTransition for rasterOpacity:

<Mapbox.RasterLayer
  id="myLayer"
  sourceID="mySourceId"
  style={{
    rasterOpacity: 0.7,
    rasterOpacityTransition: {
      duration: 0,
      delay: 0,
    },
  }}
/>

Expected behavior
Transition style should be set in Android without causing an error.

Versions

  • Platform: Android
  • Device: Emulator
  • OS: Android 9
  • SDK Version: 28
  • React Native Version: 0.58.6

Additional context
https://github.com/react-native-mapbox/maps/blob/f0b469d75c2af3c2ffe44cdba47ff9abafd1d022/android/rctmgl/src/main/java/com/mapbox/rctmgl/components/styles/RCTMGLStyleValue.java#L45-L51 does not properly handle style values that are objects (transition style values are objects so array contains another array, not a map).

https://github.com/react-native-mapbox/maps/blob/f0b469d75c2af3c2ffe44cdba47ff9abafd1d022/android/rctmgl/src/main/java/com/mapbox/rctmgl/components/styles/RCTMGLStyleValue.java#L139-L140 does not get the transition options properly from the style value.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant