Skip to content

fix: support NestedScrollView in KeyboardAwareScrollView - #1639

Merged
kirillzyusko merged 1 commit into
mainfrom
fix/support-nested-scroll-view-in-aware-scroll-view
Sep 11, 2026
Merged

kirillzyusko merged 1 commit into
mainfrom
fix/support-nested-scroll-view-in-aware-scroll-view

Conversation

@kirillzyusko

@kirillzyusko kirillzyusko commented Sep 10, 2026 •

Copy link
Copy Markdown
Owner

📜 Description

Added support for NestedScrollView for KeyboardAwareScrollView.

💡 Motivation and Context

When users enable useNestedScrollViewAndroid feature flag, then ReactNestedScrollView is used:

      if (ReactNativeFeatureFlags.useNestedScrollViewAndroid()) ReactNestedScrollViewManager()
      else ReactScrollViewManager(),

As a result our condition returns false (casting of parentView to ReactScrollView is failing):

if (parentView is ReactScrollView && parentView.scrollEnabled) {

So we never recognize the ReactNestedScrollView as a ScrollView and because of that condition is evaluated as true:

        // input belongs to ScrollView
        if (layout.value?.parentScrollViewTarget !== scrollViewTarget.value) {
          return 0;
        }

So scrolling never works.

In this PR I created small extension called View.isEnabledReactScrollView() that checks both cases: ReactScrollView and ReactNestedScrollView.

This implementation had technical difficulties, because ReactNestedScrollView is not available in earlier RN versions (was introduced only in RN 0.85+) so I had to use reflection, because we can not use direct class references as it may be not available in all framework versions.

Closes #1537

📢 Changelog

Android

  • added View.isEnabledReactScrollView() extension that checks both ReactScrollView/ReactNestedScrollView cases;
  • use isEnabledReactScrollView() condition instead of previous check;

🤔 How Has This Been Tested?

Tested via CI (e2e tests).

📸 Screenshots (if appropriate):

image

📝 Checklist

  • CI successfully passed
  • I added new mocks and corresponding unit-tests if library API was changed

@kirillzyusko kirillzyusko self-assigned this Sep 10, 2026
@kirillzyusko kirillzyusko added 🐛 bug Something isn't working 🤖 android Android specific focused input 📝 Anything about focused input functionality labels Sep 10, 2026
@github-actions

Copy link
Copy Markdown
Contributor

📊 Package size report

Current size Target Size Difference
338857 bytes 338428 bytes 429 bytes 📈

@kirillzyusko
kirillzyusko marked this pull request as ready for review September 11, 2026 08:15
@github-actions

Copy link
Copy Markdown
Contributor
  1. Potential Reflection Failure in ScrollView Detection
    Why: The isEnabledReactScrollView function uses reflection to access private fields and methods, which can fail if the class structure changes, leading to incorrect ScrollView detection.
    Fix: Replace reflection with public APIs or ensure compatibility across React versions.

  2. Incorrect ScrollEnabled State Detection
    Why: If both scrollEnabledGetter and scrollEnabledField fail, isScrollEnabled returns false, potentially missing actual scrollable states.
    Fix: Add fallback mechanisms or use observable properties to accurately detect scroll enabled state.

@kirillzyusko
kirillzyusko merged commit 25a2f1a into main Sep 11, 2026
19 checks passed
@kirillzyusko
kirillzyusko deleted the fix/support-nested-scroll-view-in-aware-scroll-view branch September 11, 2026 08:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🤖 android Android specific 🐛 bug Something isn't working focused input 📝 Anything about focused input functionality

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant