mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
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:   Reviewed By: cpojer Differential Revision: D25245322 Pulled By: rickhanlonii fbshipit-source-id: 3e44b9cf86128f1d3df535799519631cf2296a7e
This commit is contained in:
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',
|
||||
|
||||
Reference in New Issue
Block a user