Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ability to pass ItemSeparatorComponent as React Element #32748

Closed

Conversation

retyui
Copy link
Contributor

@retyui retyui commented Dec 13, 2021

Summary

Currently ListHeaderComponent & ListFooterComponent allow to use React Componetn & Elemelen

<FlatList
  ListHeaderComponent={<View />} // valid
  ListHeaderComponent={View}     // valid
/>

But when you try to pass ItemSeparatorComponent as React Element it will throw an error

<FlatList
  ItemSeparatorComponent={View}     // ok
  ItemSeparatorComponent={<View />} /* not valid: 
    Error: Element type is invalid: expected a string (for built-in components) or a class/function 
    (for composite components) but got: object.
    Check the render method of `CellRenderer`.
  */
/>

So, this PR adds this ability

Changelog

[General] [Changed] - Add ability to pass ItemSeparatorComponent as React Element

Test Plan

...

@analysis-bot
Copy link

analysis-bot commented Dec 13, 2021

Platform Engine Arch Size (bytes) Diff
ios - universal n/a --

Base commit: 8cf57a5
Branch: main

@analysis-bot
Copy link

analysis-bot commented Dec 13, 2021

Platform Engine Arch Size (bytes) Diff
android hermes arm64-v8a 7,824,102 -42
android hermes armeabi-v7a 7,211,568 -28
android hermes x86 8,134,678 -25
android hermes x86_64 8,114,645 -34
android jsc arm64-v8a 9,689,201 -2
android jsc armeabi-v7a 8,445,542 -2
android jsc x86 9,640,531 -3
android jsc x86_64 10,237,524 +6

Base commit: 7b0ba6d
Branch: main

@facebook-github-bot facebook-github-bot added CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team. labels Dec 13, 2021
@github-actions
Copy link

This PR is stale because it has been open 180 days with no activity. Remove stale label or comment or this will be closed in 7 days.

@github-actions github-actions bot added the Stale There has been a lack of activity on this issue and it may be closed soon. label Jun 12, 2022
@retyui
Copy link
Contributor Author

retyui commented Jun 12, 2022

Can someone review it ?

cc @zolbooo @cortinico

@github-actions github-actions bot removed the Stale There has been a lack of activity on this issue and it may be closed soon. label Jun 13, 2022
@cortinico
Copy link
Contributor

Can you please rebase @retyui. Once the CI is green we can merge this

ItemSeparatorComponent={<MySeparator/>} // new ability
ItemSeparatorComponent={MySeparator} // for old version only this variant
@retyui retyui force-pushed the item-separator-component-as-react-element branch from b2e7afb to 2b734f5 Compare June 16, 2022 18:42
@retyui
Copy link
Contributor Author

retyui commented Jun 16, 2022

@cortinico No problem, rebased

@facebook-github-bot
Copy link
Contributor

@cortinico has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

@react-native-bot
Copy link
Collaborator

This pull request was successfully merged by @retyui in 5854b11.

When will my fix make it into a release? | Upcoming Releases

@react-native-bot react-native-bot added the Merged This PR has been merged. label Jun 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. Merged This PR has been merged. Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants