微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

RNGH:捏手势处理程序无法放大图像

如何解决RNGH:捏手势处理程序无法放大图像

我要捏一些以放大React Native 0.63.2应用程序。在样式表中添加scaletransform似乎很简单。但是图像对放大不起作用。似乎scale没有跟随放大的变化。这是代码

          import { PanGestureHandler,PinchGestureHandler,State,gestureHandlerRootHOC } from "react-native-gesture-handler";
          import Fastimage from "react-native-fast-image";
          import Animated,{ useValue } from "react-native-reanimated";
           const state = useValue(-1);
           const scale = useValue(1);
           handlePinch = event([
                {
                  nativeEvent: {scale}
                },]);

           return (
                <><PinchGestureHandler onGestureStateChange={handlePinch} onGestureEvent={handlePinch} >
                    <Animated.View style={styles.wrapper} >
                    <TouchableOpacity onLongPress={() => deleteImage(index)} >
                        <Animated.View style={[styles.wrapper,{transform:[{scale}]}]}>
                    <Fastimage 
                        source={{uri:img_source}} 
                        resizeMode={Fastimage.resizeMode.contain} 
                        style={[{
                            width:width,height:ht,verticalAlign:0,paddingTop:0
                        }]}
                    />
                    </Animated.View>
                </TouchableOpacity> 
                    
                    </Animated.View>
                    </PinchGestureHandler>
                </>
                );

如果scale = useValue(2),则图像以2倍显示。捏手势处理缺少什么?

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。