gpt4 book ai didi

react-native - SectionList Header 在 IOS 中强加于 ItemList

转载 作者:行者123 更新时间:2023-12-02 00:14:55 24 4
gpt4 key购买 nike

enter image description here [![

<View>
<SectionList
style={seasonsStyles.sectionListStyle}
renderItem={({ item, index, section }) => section.index === this.state.expandedRowId ? <TouchableOpacity
onPress={() => this.getEpisodeScenes(section.season_id, item.episode_id)}
style={seasonsStyles.itemStyle}><Text style={seasonsStyles.episodeNameStyle}>{item.episode_name}</Text>
<View style={commonStyles.horizontalEndStyle}><Text style={seasonsStyles.seasonCountStyle}>{item.scene_count} Scenes</Text></View>
</TouchableOpacity> : null}
renderSectionHeader={({ section: { data, season_number, index } }) => (
<TouchableOpacity
onPress={() => this.setState({ expandedRowId: this.state.expandedRowId === index ? null : index })}
style={seasonsStyles.sectionHeaderStyle}>
<View style={seasonsStyles.roundContainerStyle}>
<Text style={seasonsStyles.seasonTitleStyle}>S{season_number}</Text>
</View>
<View style={seasonsStyles.episodeInfoContainerStyle}>
<Text style={seasonsStyles.seasonNumberStyle}>Season {season_number}</Text>
<Text style={seasonsStyles.episeodeNumberStyle}>{data.length} Episodes</Text>
<View style={seasonsStyles.directionIconStyle}>
<Icon name={this.state.expandedRowId === index ? 'chevron-up' : 'chevron-down'} size={20} color={Colors.black} />
</View>
</View>
</TouchableOpacity>
)}
sections={this.props.homeReducer.seasons}
keyExtractor={(item, index) => item + index}
ItemSeparatorComponent={() => {
return <View style={seasonsStyles.separatorStyle} />
}}
/>
</View>

] 2 ] 2在 SectionList 中,我的标题被 Section ItemList 重叠,它仅在 IOS 中发生。有人可以帮我吗?此行为在滚动时发生,否则一切正常

最佳答案

您可以尝试使用 stickySectionHeadersEnabled 属性吗?

stickySectionHeadersEnabled={false}

Description of stickySectionHeadersEnabled in VS Code since there is no explanation on react site

我在 Windows 机器上开发并且只能访问 Android 模拟器,所以我无法直接确认这是否有效,很遗憾。只是想给你我认为好的线索。这是我第一次在这里回答,所以如果有任何不清楚或错误的地方,我深表歉意。

关于react-native - SectionList Header 在 IOS 中强加于 ItemList,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57309395/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com