From 328590d2d942b281982ab47b6ddab81297ff793f Mon Sep 17 00:00:00 2001 From: Kshitij Kotasthane Date: Wed, 2 Dec 2020 08:57:48 -0800 Subject: [PATCH] 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 [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 --- .../js/examples/SectionList/SectionListExample.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/packages/rn-tester/js/examples/SectionList/SectionListExample.js b/packages/rn-tester/js/examples/SectionList/SectionListExample.js index b00cc81c71e..239372b5749 100644 --- a/packages/rn-tester/js/examples/SectionList/SectionListExample.js +++ b/packages/rn-tester/js/examples/SectionList/SectionListExample.js @@ -67,6 +67,12 @@ const CustomSeparatorComponent = ({highlighted, text}) => ( ); +const EmptySectionList = () => ( + + This is rendered when the list is empty + +); + 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',