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

Fix bug rows doesn't close on scroll in a SwipeableFlatList #18001

Closed
wants to merge 1 commit into from

Conversation

Freddy03h
Copy link
Contributor

Motivation

Fix bug SwipeableRows doesn't close on Scroll in a SwipeableFlatList

Test Plan

Use a SwipeableFlatList with multiple rows, open one of them, then scroll.
Open row should close on scroll.

Release Notes

[GENERAL] [BUGFIX] [SwipeableFlatList] - Fix rows doesn't close on scroll

@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. cla signed labels Feb 16, 2018
@Freddy03h Freddy03h changed the title give state to extraData in SwipeableFlatList Fix bug rows doesn't close on scroll in a SwipeableFlatList Feb 16, 2018
@vonovak
Copy link
Contributor

vonovak commented Feb 16, 2018

In other words, this will re-render the entire list on scroll if some row is open. While this works, I daresay it is just a workaround and the true bugfix lays in making sure the SwipableRow gets the correct isOpen prop in isOpen={key === this.state.openRowKey}.

@Freddy03h
Copy link
Contributor Author

But renderItem is called only if FlatList data or extraData are changed.
That's the bug. If you want to use this.state in the render props function renderItem you have to give it to extraData.
It's the way FlatList work, I don't know if there is an other solution.

@sdwilsh sdwilsh removed the cla signed label Mar 1, 2018
@Freddy03h
Copy link
Contributor Author

Any update on this ?

@facebook-github-bot
Copy link
Contributor

@Freddy03h I tried to find reviewers for this pull request and wanted to ping them to take another look. However, based on the blame information for the files in this pull request I couldn't find any reviewers. This sometimes happens when the files in the pull request are new or don't exist on master anymore. Is this pull request still relevant? If yes could you please rebase? In case you know who has context on this code feel free to mention them in a comment (one person is fine). Thanks for reading and hope you will continue contributing to the project.

@Freddy03h
Copy link
Contributor Author

Maybe @tomasreimers can be a reviewer ? Thanks.

Copy link
Contributor

@facebook-github-bot facebook-github-bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tomasreimers has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

@react-native-bot
Copy link
Collaborator

This pull request was closed by @Freddy03h in 16b3783.

Once this commit is added to a release, you will see the corresponding version tag below the description at 16b3783. If the commit has a single master tag, it is not yet part of a release.

@facebook facebook locked as resolved and limited conversation to collaborators Aug 10, 2018
@react-native-bot react-native-bot added the Merged This PR has been merged. label Aug 10, 2018
kelset pushed a commit that referenced this pull request Aug 13, 2018
Summary:
<!--
Thank you for sending the PR! We appreciate you spending the time to work on these changes.

Help us understand your motivation by explaining why you decided to make this change.

You can learn more about contributing to React Native here: http://facebook.github.io/react-native/docs/contributing.html

Happy contributing!

-->

Fix bug `SwipeableRow`s doesn't close on Scroll in a `SwipeableFlatList`

Use a SwipeableFlatList with multiple rows, open one of them, then scroll.
Open row should close on scroll.

[GENERAL] [BUGFIX] [SwipeableFlatList] - Fix rows doesn't close on scroll

<!--
Help reviewers and the release process by writing your own release notes

**INTERNAL and MINOR tagged notes will not be included in the next version's final release notes.**

  CATEGORY
[----------]        TYPE
[ CLI      ]   [-------------]      LOCATION
[ DOCS     ]   [ BREAKING    ]   [-------------]
[ GENERAL  ]   [ BUGFIX      ]   [-{Component}-]
[ INTERNAL ]   [ ENHANCEMENT ]   [ {File}      ]
[ IOS      ]   [ FEATURE     ]   [ {Directory} ]   |-----------|
[ ANDROID  ]   [ MINOR       ]   [ {Framework} ] - | {Message} |
[----------]   [-------------]   [-------------]   |-----------|

[CATEGORY] [TYPE] [LOCATION] - MESSAGE

 EXAMPLES:

 [IOS] [BREAKING] [FlatList] - Change a thing that breaks other things
 [ANDROID] [BUGFIX] [TextInput] - Did a thing to TextInput
 [CLI] [FEATURE] [local-cli/info/info.js] - CLI easier to do things with
 [DOCS] [BUGFIX] [GettingStarted.md] - Accidentally a thing/word
 [GENERAL] [ENHANCEMENT] [Yoga] - Added new yoga thing/position
 [INTERNAL] [FEATURE] [./scripts] - Added thing to script that nobody will see
-->
Pull Request resolved: #18001

Reviewed By: TheSavior

Differential Revision: D9192387

Pulled By: tomasreimers

fbshipit-source-id: f43e9614f9def5f3112327163c2b15fb45d84fb2
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants