ascoders / react-native-image-zoom

react native image pan and zoom
MIT License
639 stars 282 forks source link

Error: in this environment the sources for assign MUST be an object. This error is a performance optimization and not spec compliant. #59

Closed mshibl closed 6 years ago

mshibl commented 6 years ago

I'm getting the following error when using ImageZoom, any idea what might be causing this?

iphone 6 - 11 4 2018-06-13 11-24-05

The code we're using is pretty straight forward:

<ImageZoom
    style={styles.imageContainer}
    cropWidth={Dimensions.get("window").width}
    cropHeight={Dimensions.get("window").height}
    imageWidth={Dimensions.get("window").width}
    imageHeight={240}
>
    <Image
        style={styles.image}
        source={imgSrc}
    />
</ImageZoom>
ascoders commented 6 years ago

This bug has fixed, try 2.1.3? Releated to https://github.com/ascoders/react-native-image-viewer/issues/179.

mshibl commented 6 years ago

We're running the latest version 2.1.3 and still getting the same issue

mshibl commented 6 years ago

I found a fix for this issue, it turns out what's causing this issue is passing styles. imageContainer to the style prop in ImageZoom

so the following works:

<ImageZoom
    style={{flex: 1}}
    cropWidth={Dimensions.get("window").width}
    cropHeight={Dimensions.get("window").height}
    imageWidth={Dimensions.get("window").width}
    imageHeight={240}
>
    <Image
        style={styles.image}
        source={imgSrc}
    />
</ImageZoom>

while this is good as a temporary fix, I think it's better if you allow for passing a react-native StyleSheet to the style prop.

Thank you for your fast reply, and for all the work you're doing on this project, we really appreciate it!

ascoders commented 6 years ago

60 has merged, thanks @miketoth and @mshibl !