图像导致根 ScrollView 调整大小

时间:2021-04-05 03:07:58

标签: react-native react-native-scrollview react-native-image

出于某种原因,当我添加并尝试设置图像样式时,它最终会更改根 ScrollView 的宽度。

<InputScrollView contentContainerStyle={styles.container}>
    <View style={styles.profileImageView}>

    </View>
    <View style={styles.infoContainer}>

https://imgur.com/JQDqGmD

<InputScrollView contentContainerStyle={styles.container}>
    <View style={styles.profileImageView}>
        <Image style={styles.profileImage} source={require('../../assets/profile.png')} />
    </View>
<View style={styles.infoContainer}>

https://imgur.com/DYORDho

container: {
        flex: 1,
        width: '100%',
        padding: 20,
        alignItems: 'center'
    },

    profileImageView: {
        flex: 1,
        backgroundColor: 'red',
    },

    profileImage: {
        resizeMode: 'contain'
    },

    infoContainer: {
        flex: 2,
        width: '100%',
        flexDirection: 'row',
    }

我不知所措,我尝试过的一切都没有奏效。我是不是用错了方法?

0 个答案:

没有答案