使用resizeMode封面切断图像

Luc*_*irl 7 image react-native

我有一个图像,当我想使用resizeMode ="cover"使其更大时,图像的一部分被切断.如何解决?

render() {
return (
 <View style={styles.container}>

        <Image
          style={styles.imgStyleGoogle}
          source={{uri: 'my.png'}}
        />
<View>
    )
}

const styles = StyleSheet.create({
  container: {
        flex: 1,
        alignItems:  'center',
        marginLeft: ratio * 5,
        marginRight: ratio * 5,
    },


imgStyleGoogle: {
        flex: 1,
        height: ratio*25,
        width: ratio*100,
        resizeMode:'cover',
    }
})
Run Code Online (Sandbox Code Playgroud)

这是图片的示例: 在此输入图像描述

Luc*_*irl 19

我找到了解决方案,问题flex: 1在于Image,我将其删除imgStyleGoogle并更改resizeMode:'contain',并且没有更多的图像被切断.