我有一个1242 X 450图像,我想在1x 2x和3x设备上显示。当前的代码对于3个设备来说效果不错,但是我发现图像的边缘会在2x设备上裁剪,并可能在1x设备上裁剪。React Native保持宽高比图像ios
在代码我设置宽度414和高度150(因为1242 X 450/3×)
是否有什么办法可以解决这个问题?
的图像是一个列表视图
<View style={styles.row}>
<Image
style={styles.featureImage}
source={{
uri: this.props.image_src
}}/>
</View>
const styles = StyleSheet.create({
row: {
alignItems: 'center',
backgroundColor: 'lightgrey',
flexDirection: 'row',
margin: 6,
},
featureImage: {
height: 150,
width: 414
}
});
看看[react-native-scalable-image](https://www.npmjs.com/package/react-native-scalable-image)。 –