DylanVann / react-native-fast-image

🚩 FastImage, performant React Native image component.
MIT License
8.17k stars 1.5k forks source link

Error with RN Animated.createAnimatedComponent() #709

Open emclab opened 4 years ago

emclab commented 4 years ago

Describe the bug created animated component with RN Animated to zoom in an image by following an online article:

                const AniFastImage = Animated.createAnimatedComponent(FastImage);
                scale = new Animated.Value(1);

The view code is:

            <PinchGestureHandler
                onGestureEvent={onZoomEvent}
                onHandlerStateChange={onZoomStateChange}>
                <Animated.AniFastImage 
                    source={{uri:img_source}} 
                    resizeMode={FastImage.resizeMode.cover} 
                    style={{
                        width:width, 
                        height:ht, 
                        transform:[{scale: this.scale }],
                    }}
                />
            </PinchGestureHandler>

Before adding animated zoon in with react-native-gesture-handler, the FastImage works fine with loading images. The error is coming out of Animated.createAnimatedCompnent() and I am wondering if there is some issue for FastImage working with RN Animated.createAnimatedComponent().

To Reproduce Steps to reproduce the behavior if possible, or a link to a reproduction repo:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Expected behavior The image shall be loaded and can be zoom in and out.

Screenshots If applicable, add screenshots to help explain your problem. Capture

Dependency versions

Note: if these are not the latest versions of each I recommend updating as extra effort will not be taken to be backwards compatible, and updating might resolving your issue.

xdoer commented 4 years ago

Try replace <Animated.AniFastImage> with <AniFastImage>

dhirajanand014 commented 3 years ago

Try replace with

with what?

xdoer commented 3 years ago

Try replace with

with what?

import { animated } from 'react-spring/native'
const AniFastImage = animated(FastImage)

<AniFastImage>
   { ... }
</AniFastImage>