2016-11-15 54 views
0

我正试图用缩放缩放在React Native中实现剪裁工具。裁剪工作正常,但我无法缩放图像,而覆盖层位于其上。只在React Native中缩放滚动视图中的某些元素

代码:

 <ScrollView 
    maximumZoomScale={2} 
    minimumZoomScale={1} 
    scrollEnabled={false} 
    bouncesZoom={false}> 

     <Animated.View 
     style={this.getStyles()} 
     {...this._panResponder.panHandlers}> 
      <View> 
       <Image style={[{height: getCropContainerHeight(), 
       width: this.getCropContainerWidth()}]} 
       source={{uri: this.props.image}} /> 
      </View> 
     </Animated.View> 

     <Overlay movement={{...this._panResponder.panHandlers}} /> 

    </ScrollView> 

如果叠加了滚动,那么这两个叠加和图像中得到放大里面如果叠加是滚动型之外,那么当然图像不放大。

Here is what my app looks like

我如何能放大仅在图像上,而不影响覆盖有什么想法?

回答

0

如果你想了滚动处理触摸事件,你可以把覆盖了滚动的外面,它使用position: relativeposition: absolute了滚动的顶部位置,并给覆盖根查看pointerEvents道具"none"

这种方式覆盖不会捕捉触摸。

+0

哇,那样做了。我一直坚持了这几天,非常感谢! –