Skip to content

Conversation

@kmichalikk
Copy link
Contributor

Description

This PR adds the ContentScrollViewDetector native component. This component allows us to locate and interface with content ScrollView.

The component holds an instance to the ScrollView and registers it for the closest view that implements ContentScrollViewConsumer. It is also responsible for unregistering the view when the ScrollView is destroyed.

We do not support the case when ContentScrollViewDetector does not wrap any ScrollView or the ScrollView is detached after some time. In the second case, the application will likely crash. Similarly, we do not support nested ContentScrollViewDetectors.

Changes

Added ContentScrollViewDetector component. Added ContentScrollViewConsumer protocol that the Detector looks for.

Test code and steps to reproduce

Wrap a ScrollView with <ContentScrollViewDetector>. Add the following to RNSScreen and/or RNSBottomTabsScreenComponentView:

#pragma mark - ContentScrollViewConsumer

- (void)registerContentScrollView:(UIScrollView *)scrollView
{
  RCTLogInfo(@"Registering content ScrollView");
}

- (void)unregisterContentScrollView:(UIScrollView *)scrollView
{
  RCTLogInfo(@"Unregistering content ScrollView");
}

along with conformance declaration in the header. Observe the logs.

@kmichalikk kmichalikk requested a review from kkafar December 8, 2025 14:32
@kmichalikk kmichalikk self-assigned this Dec 8, 2025
@kmichalikk kmichalikk added Type: Feature Issue or PR with feature request or implementation Area: ScrollView Issue related to integration between library and ScrollView component labels Dec 8, 2025
@kmichalikk kmichalikk force-pushed the @kmichalikk/scroll-view-hosting-component branch from 3fd2e1a to 374b9ab Compare December 8, 2025 14:40
@kmichalikk kmichalikk requested a review from t0maboro December 10, 2025 08:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area: ScrollView Issue related to integration between library and ScrollView component Type: Feature Issue or PR with feature request or implementation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants