Skip to content

Conversation

@okwasniewski
Copy link
Member

@okwasniewski okwasniewski commented Nov 22, 2025

Summary

Store scrollEnabled state in an ivar and apply it when the scroll view becomes available, rather than attempting to set it before initialization. This ensures the prop works reliably regardless of when props are updated relative to UIPageViewController setup.

Fixes #1029

Test Plan

Check if scroll enabled works correctly.


Note

Store scrollEnabled in an ivar and apply it once the inner UIScrollView exists, updating consistently on prop/imperative changes and lifecycle resets.

  • iOS PagerView (RNCPagerViewComponentView):
    • Store scrollEnabled in _scrollEnabled with default YES; reset on recycle.
    • Add applyScrollEnabled and call it after UIPageViewController setup, on prop changes, and in imperative setter.
    • Update updateProps to compare old/new scrollEnabled, set _scrollEnabled, then apply.
    • Replace direct scrollView.scrollEnabled writes with deferred application via _scrollEnabled.

Written by Cursor Bugbot for commit db0029e. This will update automatically on new commits. Configure here.

@okwasniewski okwasniewski force-pushed the fix/scroll-enabled-reliability branch from 7cf8e41 to 0a4bb73 Compare November 22, 2025 19:25
Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the final PR Bugbot will review for you during this billing cycle

Your free Bugbot reviews will reset on December 2

Details

Your team is on the Bugbot Free tier. On this plan, Bugbot will review limited PRs each billing cycle for each member of your team.

To receive Bugbot reviews on all of your PRs, visit the Cursor dashboard to activate Pro and start your 14-day free trial.

Bug: Imperative method bypasses scrollEnabled state synchronization

The setScrollEnabledImperatively method directly modifies scrollView.scrollEnabled without updating the _scrollEnabled ivar. This creates state inconsistency where subsequent calls to applyScrollEnabled (during re-initialization or prop updates) will overwrite the imperatively set value with the stale ivar value, causing the scroll state to revert unexpectedly.

ios/RNCPagerViewComponentView.mm#L400-L403

- (void)setScrollEnabledImperatively:(BOOL)scrollEnabled {
[scrollView setScrollEnabled:scrollEnabled];
}

Fix in Cursor Fix in Web


@okwasniewski okwasniewski force-pushed the fix/scroll-enabled-reliability branch from 0a4bb73 to 5e3bb6b Compare November 22, 2025 19:32
Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: Imperative scroll method doesn't update state variable

The setScrollEnabledImperatively method directly modifies scrollView.scrollEnabled without updating the _scrollEnabled ivar. This creates inconsistency where calling this method before scrollView initialization has no effect, and the imperative setting won't be applied when applyScrollEnabled is later called during initialization. The method should update _scrollEnabled and call applyScrollEnabled to maintain consistency with the new state management pattern.

ios/RNCPagerViewComponentView.mm#L401-L404

- (void)setScrollEnabledImperatively:(BOOL)scrollEnabled {
[scrollView setScrollEnabled:scrollEnabled];
}

Fix in Cursor Fix in Web


Store scrollEnabled state in an ivar and apply it when the scroll view becomes available, rather than attempting to set it before initialization. This ensures the prop works reliably regardless of when props are updated relative to UIPageViewController setup.

Also reset scrollEnabled to its default value (YES) in prepareForRecycle to prevent recycled components from retaining the previous instance's scroll state.

Update setScrollEnabledImperatively to use the new state management pattern by updating the ivar and calling applyScrollEnabled, ensuring consistency whether called before or after scrollView initialization.
@okwasniewski okwasniewski force-pushed the fix/scroll-enabled-reliability branch from 5e3bb6b to db0029e Compare November 22, 2025 19:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

scrollEnabled={false} doesn't prevent swipe on iOS

3 participants