问题描述
我要捏一些以放大React Native 0.63.2应用程序。在样式表中添加scale
和transform
似乎很简单。但是图像对放大不起作用。似乎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 (将#修改为@)