React native 如何使ListHeaderComponent成为SectionList中的粘性标题? 描述
我正在ListHeaderComponent内部使用水平选项卡栏,我希望将ListHeaderComponent作为SectionList中的粘性标题。我们可以通过stickyHeaderIndices={[0]}在flatlist中生成stickyheader,但它在SectionList中不起作用 反应本机版本: 复制步骤 提供重现问题的详细步骤列表 制作分区列表并添加ListHeaderComponent道具 在节列表中添加stickyHeaderIndices={[0]} 它不会使ListHeaderComponent成为粘性标题 预期结果 它应该使ListHeaderComponent成为粘性标题。或者用另一种方法使它粘头React native 如何使ListHeaderComponent成为SectionList中的粘性标题? 描述,react-native,expo,react-native-flatlist,react-native-sectionlist,React Native,Expo,React Native Flatlist,React Native Sectionlist,我正在ListHeaderComponent内部使用水平选项卡栏,我希望将ListHeaderComponent作为SectionList中的粘性标题。我们可以通过stickyHeaderIndices={[0]}在flatlist中生成stickyheader,但它在SectionList中不起作用 反应本机版本: 复制步骤 提供重现问题的详细步骤列表 制作分区列表并添加ListHeaderComponent道具 在节列表中添加stickyHeaderIndices={[0]} 它不会使Lis
用这样的东西
<View style={{ flex: 1 }}>
{renderStickyListHeaderComponent()}
<SectionList
{...sectionListprops}
ref={sectionListRef}
sections={sectionData}
stickySectionHeadersEnabled={false}
/>
</View>
可以使用renderSectionHeader&stickySectionHeadersEnabled=true
render() {
return (
<SectionList
data={sections}
renderSectionHeader = {({section:{title}}) => (<YourHeader>)}
stickySectionHeadersEnabled/>
)
}
嘿,穆罕默德,我正在处理和你一样的问题。看起来SectionList缺少FlatList组件中可用的stickyHeaderIndices道具。你有没有找到办法让它发挥作用?嘿@Numan,你解决了这个问题吗?请正确设置你的问题的格式。
render() {
return (
<SectionList
data={sections}
renderSectionHeader = {({section:{title}}) => (<YourHeader>)}
stickySectionHeadersEnabled/>
)
}