Commit 52e9ecc
Fix crash by implementing scrollViewDidScroll in RCTEnhancedScrollView (#54583)
Summary:
Fix crash by implementing the missing `scrollViewDidScroll:` method in `RCTEnhancedScrollView`.
## Root Cause
`RCTEnhancedScrollView` conforms to `UIScrollViewDelegate` and adds itself as a delegate to its delegate splitter, but only implements two delegate methods:
- `scrollViewWillEndDragging:withVelocity:targetContentOffset:`
- `scrollViewDidZoom:`
It was missing `scrollViewDidScroll:`, which is the most commonly called delegate method. When the splitter has multiple delegates, it sets itself as the UIScrollView's delegate and forwards messages to all registered delegates. When `UIScrollView` calls `scrollViewDidScroll:` on the splitter, the splitter attempts to forward it to `RCTEnhancedScrollView`, which doesn't implement it → crash: "unrecognized selector sent to instance".
## Solution
Implement an empty `scrollViewDidScroll:` method in `RCTEnhancedScrollView`.
## Changelog
[iOS][Fixed] - Fix crash in RCTEnhancedScrollView when scrollViewDidScroll is called
Reviewed By: cipolleschi, keoskate
Differential Revision: D868137251 parent 4279958 commit 52e9ecc
File tree
1 file changed
+6
-0
lines changed- packages/react-native/React/Fabric/Mounting/ComponentViews/ScrollView
1 file changed
+6
-0
lines changedLines changed: 6 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
156 | 156 | | |
157 | 157 | | |
158 | 158 | | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
159 | 165 | | |
160 | 166 | | |
161 | 167 | | |
| |||
0 commit comments