react-native scrollView对我来说不正确

时间:2019-04-18 21:49:42

标签: css react-native

我已经尝试了很多次,但是当在滚动体中使用不同的组件时,它只是不适应内容,因此一些内容未包含在scrollView中。如图所示,它已被切割..任何修复建议..

我使用的示例代码

const height = Dimensions.get('window').height;
const width = Dimensions.get('window').width;

该类中的一些代码

                <ScrollView>
                    <View style={styles.middleview}>
                        <TextInput
                            style={styles.textinputs}
                            placeholder="Location"
                            placeholderTextColor='grey'

/>

                        <TouchableOpacity>
                            <Text style={{fontSize:20}}>
                                Post Ad
                            </Text>
                        </TouchableOpacity>
                   </view>
                  </scrollView>

使用的样式

    textinputs: {
        backgroundColor: 'white',
        paddingTop: '2%',
        paddingBottom: '2%',
        paddingLeft: '4%',
        paddingRight: '4%',
        width: '90%',
        borderRadius: 50,
        margin: '3%',
        color: 'grey',
        height: '8%', 
        borderColor: 'white',
        borderWidth: .8,
        elevation: 10,

    middleview:{

        backgroundColor: 'lightblue',
        flex: 1,
        height: Dimensions.get('window').height,
        width: Dimensions.get('window').width,
        alignItems: 'center',
        justifyContent: 'center'
    }

here is the image below its cut the component scroll view is ended in the middle of components..

1 个答案:

答案 0 :(得分:0)

使用“ contentContainerStyle”将样式添加到滚动视图 工作例如:https://snack.expo.io/@msbot01/rebellious-cookie