mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Fix out of sync state in ScrollView after animation
Summary: It seems that if we update the scroll state when the state wrapper is null we can get into an out of sync state. I've replicated the issue in HelpCenter and confirmed with a video this seems to be the case (i.e. when gazing on some cards, their corresponding frame is incorrect) https://www.internalfb.com/intern/px/p/6xWgl NOTE: I have accidentally stumbled upon this fix but I could really use a review from someone who has more context around the `ReactScrollViewHelper` because this change might have bigger implications I'm not aware of! Changelog: [Android][Fixed] - Fix occasional syncronization issue in ScrollView when rendering dynamic content with content offset Commits affecting the React Native open source repository must have a changelog entry in the commit summary. Every React Native release has almost 1000 commits, and manually categorizing these commits is very time consuming. In your diff summary, please add a `Changelog:` entry using the format: The "Category" field may be one of: - **Android**, for changes that affect Android. - **iOS**, for changes that affect iOS. - **General**, for changes that do not fit any of the other categories. - **Internal**, for changes that would not be relevant to developers consuming the release notes. The "Type" field may be one of: - **Breaking**, for breaking changes. - **Added**, for new features. - **Changed**, for changes in existing functionality. - **Deprecated**, for soon-to-be removed features. - **Removed**, for now removed features. - **Fixed**, for any bug fixes. - **Security**, in case of vulnerabilities. If your change does not modify React Native's public interface, you can use: Changelog: [Internal] For more details, please read the wiki: https://fburl.com/react-native/changelog Reviewed By: javache Differential Revision: D70484547 fbshipit-source-id: c314b958eeed4dd96755539f5bbfb8f03e17a525
This commit is contained in:
committed by
Facebook GitHub Bot
parent
f5682d64eb
commit
8f209acb3f
+5
@@ -315,6 +315,11 @@ public object ReactScrollViewHelper {
|
||||
if (ViewUtil.getUIManagerType(scrollView.id) == UIManagerType.DEFAULT) {
|
||||
return
|
||||
}
|
||||
// NOTE: if the state wrapper is null, we shouldn't even update
|
||||
// the scroll state because there is a chance of going out of sync!
|
||||
if (scrollView.stateWrapper == null) {
|
||||
return
|
||||
}
|
||||
val scrollState = scrollView.reactScrollViewScrollState
|
||||
// Dedupe events to reduce JNI traffic
|
||||
if (scrollState.lastStateUpdateScroll.equals(scrollX, scrollY)) {
|
||||
|
||||
Reference in New Issue
Block a user