我在本机反应中遇到图像组件问题。我想在某个正方形中显示图像的特定部分。铁:
假设我的图像分辨率为:1280x720
private someImage = require('../Assets/someImage.jpg');
我想以方形组件显示此图像(具有恒定大小)
<View style={{width: 64, height: 64}}>
<Image source={this.someImage}
style={{position: 'absolute', top: 0, left: 0 }} />
</View>
第一个问题来了:图像超出了正方形。如何仅显示图像的一部分(但具有原始分辨率)。
第二个问题是:有没有办法显示我的图像的特定片段?那是男人,如果我设置顶部:-64,左侧:-64 我希望看到原始图像沿对角线移动约 64 像素。