2016-11-15 55 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

哇,那樣做了。我一直堅持了這幾天,非常感謝! –