拖放图像时如何在React Native中调整图像大小?

时间:2020-01-08 06:40:17

标签: javascript react-native drag-and-drop transform draggable

我想将图像拖到我的React Native App中的拖放区域。现在,我可以将图像拖放到放置区域中。但是,当拖放时(拖放后保持较小),如何拖动图像并使图像变小(将尺寸调整为较小)?

我有以下示例代码:-

renderDraggable() {
    const panStyle = {
      transform: this.state.pan.getTranslateTransform()
    }
    if (this.state.showDraggable) {
      return (
        <View style={{ position: "absolute" }}>
          {/* <Animated.View
            {...this.panResponder.panHandlers}
            style={[panStyle, styles.circle, {opacity:this.state.opacity}]}
          /> */}
          <Animated.Image
            source={require('../assets/1.png')}
            resizeMode='contain'
            {...this.panResponder.panHandlers}
            style={[panStyle, styles.circle, { opacity: this.state.opacity }]}
          />
        </View>
      );
    }
  }

如何修改“ panStyle>变换”并实现目标?请帮忙,感激不尽!

0 个答案:

没有答案
相关问题