a2675ced4e
Summary: We ran into a problem trying to style the optional prop `ListHeaderComponent` in the `FlatList` library component. Essentially we wanted to make `ListHeaderComponent` a flex item that filled all of the empty space in the list if there was any. Unfortunately the `ListHeaderComponent` is later wrapped in a `View` that blocked our styling. The `View` component was necessary as it added styling to handle inverting the `FlatList`. Similarly `ListFooterComponent` was handled the same way. We came up the simple solution of adding two new optional props, `ListHeaderComponentStyle` and `ListFooterComponentStyle`, that are of type `ViewStyleProp` that allow users to pass in styling for `ListHeaderComponent` and `ListFooterComponent`. With this change we were able to do something like the following to get the header component to fill all empty space in the `FlatList`. ``` <FlatList ... contentContainerStyle={{flexGrow: 1}} ListHeaderComponent={<View style={{flex: 1}} />} ListHeaderComponentStyle={{flexGrow: 1}} ... /> ``` This solution will give users a lot more freedom when working with headers and footers. Reviewed By: sahrens Differential Revision: D8777038 fbshipit-source-id: f34116ce68548ea70223e639d0f84a099327f6b3 |
||
---|---|---|
.. | ||
__snapshots__ | ||
FillRateHelper-test.js | ||
FlatList-test.js | ||
SectionList-test.js | ||
ViewabilityHelper-test.js | ||
VirtualizeUtils-test.js | ||
VirtualizedList-test.js |