Skip to content

Commit

Permalink
SectionList renderItem should be optional
Browse files Browse the repository at this point in the history
Summary:
`renderItem` on `SectionList` is within the `OptionalProps` group of props but it is not actually marked as optional. Which means that doing things such as in the example where each section has its own `renderItem` and no `renderItem` prop is passed into `SectionList` will fail flow.

Create a `SectionList` where each section has it's own `renderItem` and do not pass in a `renderItem` into `SectionList`. Run flow, it should error.

[GENERAL] [MINOR] [SectionList] -Makes `renderItem` prop on `SectionList` optional for flow.
Closes #17262

Differential Revision: D6645672

Pulled By: hramos

fbshipit-source-id: 1096e8c4998c14003cf42f29ea559505082047c1
  • Loading branch information
Matt Sessions authored and facebook-github-bot committed Dec 29, 2017
1 parent fa574c6 commit a8391bd
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion Libraries/Lists/SectionList.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ type OptionalProps<SectionT: SectionBase<any>> = {
/**
* Default renderer for every item in every section. Can be over-ridden on a per-section basis.
*/
renderItem: (info: {
renderItem?: (info: {
item: Item,
index: number,
section: SectionT,
Expand Down

0 comments on commit a8391bd

Please sign in to comment.