react-native/Libraries/Lists/__tests__
Michael Ficaro a2675ced4e Adding new styling props to FlatList/VirtualizedList for ListHeaderComponent and ListFooterComponent
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
2018-07-12 13:49:08 -07:00
..
__snapshots__ Adding new styling props to FlatList/VirtualizedList for ListHeaderComponent and ListFooterComponent 2018-07-12 13:49:08 -07:00
FillRateHelper-test.js Update license headers for MIT license 2018-02-16 18:31:53 -08:00
FlatList-test.js Update license headers for MIT license 2018-02-16 18:31:53 -08:00
SectionList-test.js Update license headers for MIT license 2018-02-16 18:31:53 -08:00
ViewabilityHelper-test.js Update license headers for MIT license 2018-02-16 18:31:53 -08:00
VirtualizeUtils-test.js Update license headers for MIT license 2018-02-16 18:31:53 -08:00
VirtualizedList-test.js Update license headers for MIT license 2018-02-16 18:31:53 -08:00