React-Native ImageEditor.cropImage 显示无图片
React-Native ImageEditor.cropImage shows no picture
几个小时以来,我一直在尝试将图片分成几个部分。
我认为它适用于 ImageEditor.cropImage
。显然我错误地使用了该功能,或者它没有按照我的预期进行。
有人可以告诉我我做错了什么,或者推荐一个我可以使用的包。谢谢。
我的尝试:
const cropData = {
offset: {x: 25, y: 25},
size: {width: 250, height: 250},
displaySize: {width: 250, height: 250},
resizeMode: 'contain',
};
稍后..
ImageEditor.cropImage(require('../resources/images/pictures/categoryOne/c1b1.jpg'),
cropData);
我不是用 ImageEditor.cropImage 而是用 CSS
解决了我的问题
<View style={styles.topLeftView}>
<Image
style={styles.topLeftImage}
source={require('../resources/images/pictures/categoryOne/c1b1.jpg')}
resizeMode="contain"
/>
</View>
风格
topLeftView: {
width: 100,
height: 100,
overflow: 'hidden',
},
topLeftImage: {
right: 0,
bottom: 0,
},
几个小时以来,我一直在尝试将图片分成几个部分。
我认为它适用于 ImageEditor.cropImage
。显然我错误地使用了该功能,或者它没有按照我的预期进行。
有人可以告诉我我做错了什么,或者推荐一个我可以使用的包。谢谢。
我的尝试:
const cropData = {
offset: {x: 25, y: 25},
size: {width: 250, height: 250},
displaySize: {width: 250, height: 250},
resizeMode: 'contain',
};
稍后..
ImageEditor.cropImage(require('../resources/images/pictures/categoryOne/c1b1.jpg'),
cropData);
我不是用 ImageEditor.cropImage 而是用 CSS
解决了我的问题<View style={styles.topLeftView}>
<Image
style={styles.topLeftImage}
source={require('../resources/images/pictures/categoryOne/c1b1.jpg')}
resizeMode="contain"
/>
</View>
风格
topLeftView: {
width: 100,
height: 100,
overflow: 'hidden',
},
topLeftImage: {
right: 0,
bottom: 0,
},