Skip to content

Conversation

@gabec
Copy link

@gabec gabec commented Nov 18, 2025

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

Differential Revision: D86813725

@meta-codesync
Copy link

meta-codesync bot commented Nov 18, 2025

@gabec has exported this pull request. If you are a Meta employee, you can view the originating Diff in D86813725.

@meta-cla meta-cla bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Nov 18, 2025
gabec pushed a commit to gabec/react-native that referenced this pull request Nov 18, 2025
facebook#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`.

Reviewed By: cipolleschi

Differential Revision: D86813725
facebook#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: D86813725
@meta-codesync meta-codesync bot closed this in 5f14001 Nov 19, 2025
@facebook-github-bot facebook-github-bot added the Merged This PR has been merged. label Nov 19, 2025
@meta-codesync
Copy link

meta-codesync bot commented Nov 19, 2025

This pull request has been merged in 5f14001.

@react-native-bot
Copy link
Collaborator

This pull request was successfully merged by Gabriel Cadden in 5f14001

When will my fix make it into a release? | How to file a pick request?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. fb-exported Merged This PR has been merged. meta-exported p: Facebook Partner: Facebook Partner

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants