Reactjs 在包含图像输入的视图上缩放和平移
我需要缩放和平移包含图像输入的视图。 在Android和iOS上,输入必须保持其相对于图像的位置,并调整大小 我曾尝试使用来完成此操作,但TextInput没有像图像那样放大,它相对于屏幕的大小保持不变:Reactjs 在包含图像输入的视图上缩放和平移,reactjs,react-native,Reactjs,React Native,我需要缩放和平移包含图像输入的视图。 在Android和iOS上,输入必须保持其相对于图像的位置,并调整大小 我曾尝试使用来完成此操作,但TextInput没有像图像那样放大,它相对于屏幕的大小保持不变: <View style={{ flex: 1 }}> <ViewEditor imageHeight={width} imageWidth={width} imageContainerHeight={width} ima
<View style={{ flex: 1 }}>
<ViewEditor
imageHeight={width}
imageWidth={width}
imageContainerHeight={width}
imageMask={this.mask}
maskHeight={width}
maskPadding={50}
>
{() => (
<Image
source={{ uri: this.state.image }}
style={{ flex: 1}} >
<View>
<TextInput />
</View>
</Image>
)}
</ViewEditor>
</View>
{() => (
)}
我也尝试过,但它不允许添加TextInput或任何其他元素,也不允许使用图像进行控制:
<PhotoView
source={{ uri: this.state.image }}
minimumZoomScale={1}
maximumZoomScale={2}
androidScaleType="fitCenter"
style={{ flex: 1 }}>
<TextInput /> // error
</PhotoView>
//错误
感谢您的帮助
编辑:我刚刚尝试使用此问题中包含的组件:,但我遇到了与第一次尝试相同的问题。我在图像标记中放置了一个TextInput,如下所示:
<View
style={this.props.style}
{...this._panResponder.panHandlers}
onLayout={this._onLayout}>
<Image style={{
position: 'absolute',
top: this.state.offsetTop + this.state.top,
left: this.state.offsetLeft + this.state.left,
width: this.props.imageWidth * this.state.zoom,
height: this.props.imageHeight * this.state.zoom
}}
source={this.props.source} >
<View style={{ backgroundColor: 'rgba(0,0,0,0)' }}>
<TextInput style={{ backgroundColor: 'rgba(0,0,0,0)' }} />
</View>
</Image>
</View>
文本输入不会被放大,它相对于屏幕的大小保持不变,而不是相对于图像比例