brh55 / react-native-masonry

:raised_hands: A pure JS react-native component to render a masonry~ish layout for images with support for dynamic columns, progressive image loading, device rotation, on-press handlers, and headers/captions.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Add Header/Footer component for the list.

margox opened this issue · comments

Is there any way to add a header or footer for the list? not for the image item. just like the ListHeaderComponent/ListFooterComponent prop of FlatList component.

@margox Not currently, but it would not be too hard to implement. How would you imagine the prop to look like for passing this into the masonry?

I think it'd be nice if we can have a prop of the masonry (e.g., renderHeader, renderFooter) which is passed directly to the Masonry component which would take each item as parameter and then could return a view which is positioned on top/at below, the same way you have the footer and header but just that the prop needs to be direct to the Masonry component. If you can guide us on how to do that, it'll be awesome.

Are you referring to the top and bottom of the masonry layout itself? @peterchibunna

@brh55 What do you think about the implementation of FlatList with ListFooterComponent and ListHeaderComponent? https://facebook.github.io/react-native/docs/flatlist#listfootercomponent

@QuentinBrosse Rather an odd use-case as each column is a FlatList, but I can understand if a user wants to generate a column header of some sort (Column 1 (52), Column 2 (53), etc).

...However, the API would need to be pretty simple to correlate with the number of desired columns, or we if we are assuming users want to render a particular view dynamic column, we can pass some metadata passed into the render function (like column number, counts, etc).

What kind of use-case are we trying to accomplish?

Is it somehow possible to achieve what FlatList does with ListHeaderComponent and ListFooterComponent in 2022? If not, in my case this is a huge dealbreaker for using this otherwise great component.

Sorry, I haven't been really coding for quite some time. But given how much time has past, I'm sure there are some other great alternatives open-source modules out there. Happy to take any adaptions using these new components, I doubt it will be a serious lift.

I have plans on getting back into a development, once I find a company / position that brings me closer to coding again.