marcocesarato / react-native-big-list

This is a high performance list view for React Native with support for complex layouts using a similar FlatList usage to make easy the replacement. This list implementation for big list rendering on React Native works with a recycler focused on performance and memory usage and so it permits processing thousands items on the list.
https://marcocesarato.github.io/react-native-big-list-docs/
Apache License 2.0
532 stars 43 forks source link

renderSectionHeader doubles up on styles #362

Open PiTiLeZarD opened 11 months ago

PiTiLeZarD commented 11 months ago

Hey all. First, thanks for this lib, filtering 6k rows with RN section list was impossibly slow and now it's usable ;)

I'm using the sections version of BigList and for some reason, my styles are being doubled:

            renderSectionHeader={(section) => (
                <View
                    style={{
                        paddingHorizontal: 5,
                        paddingVertical: 3,
                        display: "flex",
                        alignItems: "center",
                        borderStyle: "solid",
                        borderColor: "black",
                        borderTopWidth: 1,
                        borderBottomWidth: 1,
                        backgroundColor: "white",
                    }}
                >
                    <Typography>{sections[section][0].date.toFormat("dd/MM/yyyy")}</Typography>
                </View>
            )}

This renders like that: image

I dug around a little and I can't figure out why. The same styles were applied in ReactNative SectionList headers and was working fine.

Also side question: any way to have the main header sticky instead of each sections?

Cheers

PiTiLeZarD commented 11 months ago

Not entirely sure but it might be due to this: https://github.com/marcocesarato/react-native-big-list/blob/master/lib/BigListSection.jsx#L55 picking the style from the child, and still using the child as is. It works if I wrap my header in a View without styles, not ideal but it'll do for now ;)