首页 > 解决方案 > 带有手风琴列表的 ScrollView 溢出导航器边界

问题描述

ScrollView由于屏幕上显示的数据量,我需要使用。
但是,当它首次显示时,手风琴列表全部折叠。在通过用户单击展开它们中的任何一个后,ScrollView(在 flex 布局内)将展开底部导航栏的边界。

例如,我想限制它,bottom:60但它无法正常工作。

这是我拥有的当前标签:

    <View style={{flex:10,padding:10, flexDirection:"column", justifyContent:"space-around"}}>
...
        <ScrollView style={{flex:9, bottom:60}} contentContainerStyle={{flexGrow:1, bottom:60}} >

我已经尝试只使用该 contentContainerStyle属性,而没有使用该属性,style但它也不起作用。

有谁知道如何正确设置这种风格?

标签: javascriptandroidreact-nativereact-navigation

解决方案


终于弄明白了......没有注意到<SafeAreaView>官方ScrollView链接上提到的:https ://facebook.github.io/react-native/docs/scrollview

它以这种方式运作良好:


scrollDimensions = [{ 
    width:  Math.round(Dimensions.get('window').width - 20),
    maxHeight: Math.round(Dimensions.get('window').height - 200 ) 
}];

...

let sDimensions = this.scrollDimensions;

...

    <View style={{flex:20, margin:4, flexDirection:"column", justifyContent:"flex-start"}}>
        <Title style={{flex:1}}>New Subject</Title>
        <SafeAreaView style={[{flex:19, }, sDimensions]}>
        <ScrollView     

                    contentContainerStyle={{}} >

...

推荐阅读