【问题标题】:react-native scrollView is not properly woking for mereact-native scrollView 不适合我
【发布时间】:2019-04-18 21:49:42
【问题描述】:

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

我使用的示例代码

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..

【问题讨论】:

  • &lt;ScrollView style={styles.middleview}&gt; 尝试在顶部应用样式。

标签: css react-native


【解决方案1】:

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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2018-09-04
    • 2019-07-16
    • 2018-04-09
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-12-07
    相关资源
    最近更新 更多