mirror of
https://github.com/facebook/react-native.git
synced 2024-11-22 06:29:46 +00:00
510d2906b2
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/44256 ## Changelog: [iOS] [Fixed] - Preserve content offset in ScrollView when the component is suspended # The problem On iOS, components are recycled. For ScrollView, its content offset has to be reset back to original position. When we call `[UIScrollView setContentOffset:]`, it triggers all of its delegate methods and triggers `scrollViewDidScroll` where we set native state. So when user scrolls to position 100 and scroll view suspends. it is removed from view hierarchy and recycled. Once the suspense boundary is resolved, scroll view will be inserted back into view hierarchy. But when it was recycled, we set back its original content offset (the default is 0, 0) but this was accidentally propagated through to shadow tree. # Solution To avoid this, we simply need to invalidate `_state` before calling `[UIScrollView setContentOffset:]`. Reviewed By: cipolleschi Differential Revision: D56573370 fbshipit-source-id: c03d7d2d403af2e1649b4cf189072baeb4c286c8 |
||
---|---|---|
.. | ||
assets | ||
babel-plugin-codegen | ||
community-cli-plugin | ||
core-cli-utils | ||
debugger-frontend | ||
dev-middleware | ||
eslint-config-react-native | ||
eslint-plugin-react-native | ||
eslint-plugin-specs | ||
helloworld | ||
hermes-inspector-msggen | ||
metro-config | ||
normalize-color | ||
polyfills | ||
react-native | ||
react-native-babel-preset | ||
react-native-babel-transformer | ||
react-native-bots | ||
react-native-codegen | ||
react-native-codegen-typescript-test | ||
react-native-gradle-plugin | ||
react-native-info | ||
react-native-popup-menu-android | ||
react-native-test-library | ||
react-native-test-renderer | ||
rn-tester | ||
rn-tester-e2e | ||
typescript-config | ||
virtualized-lists |