Added examples for SectionList (#30390)

Summary:
`Added examples for the following missing props in SectionList`
* Prop: initialNumToRender
* Prop: ListEmptyComponent
* Prop: onEndReached

**Motivation** - Missing examples for these props in the RNTester app
## Changelog

<!-- Help reviewers and the release process by writing your own changelog entry. For an example, see:
https://github.com/facebook/react-native/wiki/Changelog
-->

[General] [Added] - `Added examples for the missing props in SectionList`

Pull Request resolved: https://github.com/facebook/react-native/pull/30390

Test Plan:
![empty](https://user-images.githubusercontent.com/26821140/99139935-49667000-2663-11eb-8b89-5a6b17abc3e9.png)
![end](https://user-images.githubusercontent.com/26821140/99139944-4e2b2400-2663-11eb-8e95-08e863614dec.png)

Reviewed By: cpojer

Differential Revision: D25245322

Pulled By: rickhanlonii

fbshipit-source-id: 3e44b9cf86128f1d3df535799519631cf2296a7e
This commit is contained in:
Kshitij Kotasthane
2020-12-02 09:00:06 -08:00
committed by Facebook GitHub Bot
parent 067d2eee03
commit 328590d2d9
@@ -67,6 +67,12 @@ const CustomSeparatorComponent = ({highlighted, text}) => (
</View>
);
const EmptySectionList = () => (
<View style={{alignItems: 'center'}}>
<Text style={{fontSize: 20}}>This is rendered when the list is empty</Text>
</View>
);
class SectionListExample extends React.PureComponent<{...}, $FlowFixMeState> {
state:
| any
@@ -174,6 +180,15 @@ class SectionListExample extends React.PureComponent<{...}, $FlowFixMeState> {
renderSectionHeader={renderSectionHeader}
renderSectionFooter={renderSectionFooter}
stickySectionHeadersEnabled
initialNumToRender={10}
ListEmptyComponent={EmptySectionList}
onEndReached={() =>
Alert.alert(
'onEndReached called',
'You have reached the end of this list',
)
}
onEndReachedThreshold={0}
sections={[
{
key: 'empty section',