Fix autoscrollToTopThreshold on iOS old arch
Summary:
Currently autoscrollToTopThreshold does not work correctly, it will scroll to top even when the scroll position is past the autoscrollToTopThreshold value.
The value of x/y is taken before we adjust the scroll position so we do not need to subtract the delta.
Note that this was already fixed when I ported this code to fabric, so this fix is only needed in the old arch code.
Changelog:
[IOS] [FIXED] - Fix autoscrollToTopThreshold on iOS old arch
Test Plan:
In RNTester example, threshold is set to 10, so it should not scroll to top if we are further than 10px from the top of the list.
Before:
https://github.com/facebook/react-native/assets/2677334/13723787-1bc4-4263-9bcb-91ddf7454de3
After:
https://github.com/facebook/react-native/assets/2677334/a8cfdaac-59fc-40de-970a-ff992366e25f
| Platform | Engine | Arch | Size (bytes) | Diff |
|---|---|---|---|---|
| android | hermes | arm64-v8a | 9,001,856 | +4 |
| android | hermes | armeabi-v7a | 8,255,912 | +4 |
| android | hermes | x86 | 9,510,995 | +3 |
| android | hermes | x86_64 | 9,356,876 | +4 |
| android | jsc | arm64-v8a | 9,614,918 | +6 |
| android | jsc | armeabi-v7a | 8,741,555 | +1 |
| android | jsc | x86 | 9,701,870 | +5 |
| android | jsc | x86_64 | 9,948,431 | +3 |
Base commit: 1706066533f457ec79213f2813908b5624c220f6 Branch: main
@cipolleschi could you have a look at this?
@cipolleschi has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.
This pull request was successfully merged by @janicduplessis in 9666814750198574170a26e21a47b028f8060ffe.
When will my fix make it into a release? | Upcoming Releases
@cipolleschi merged this pull request in facebook/react-native@9666814750198574170a26e21a47b028f8060ffe.