【问题标题】:SectionList contentinset not apply when list load列表加载时,SectionList contentinset 不适用
【发布时间】:2018-08-04 15:03:58
【问题描述】:

我使用 SectionListstickyheader

我想在一些顶部空间之后制作stickyheader
所以应用 paddingTop 和 contentInset。

这是工作,但是当加载第一次数据时,它会显示顶部空间,如屏幕上方
小滚动空间消失后 contentInset 开始工作。

第一次数据时如何删除空间。

<SectionList 
    style={{paddingTop:40}}
    contentInset={{ top: -40 }}
    ListHeaderComponent={this.listHeaderItem}
    ref={ (ref) => {this.myRef=ref}}
    renderSectionHeader={this.renderSectionHeaderItem}
    renderItem={this.renderItem}
    showsHorizontalScrollIndicator={false}
    ListFooterComponent={this.footer} 
    bounces={true}
    keyExtractor = {(item, index) => index}
    stickySectionHeadersEnabled={true}
    sections={this.state.sectionData} />

【问题讨论】:

    标签: reactjs react-native padding sticky


    【解决方案1】:

    如果您不想在乞讨时有空间,请尝试...并让我知道这是否有效

    style={{position: 'absolute', top: 0}}
    

    【讨论】:

    • 不,它不起作用。我使用 padding top 因为我想要 40 个空格后的stickyheader。
    • 并且stickyheader 应该永远存在吗?我的意思是列表应该在 top:0 并且 paddingTop 40 总是用于stickyheader?
    • 是的,stickyheader 应该永远存在。是的列表应该在 top:0 和 paddingTop 40 用于stickyheader 。
    猜你喜欢
    • 1970-01-01
    • 2021-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-02-04
    • 2014-05-21
    • 1970-01-01
    相关资源
    最近更新 更多