Skip to content

fix(android): support NestedScrollView in ClippingScrollViewDecoratorView#1527

Merged
kirillzyusko merged 1 commit into
kirillzyusko:mainfrom
Nodonisko:fix/clipping-scroll-view-nested-scroll-view
Jul 2, 2026
Merged

fix(android): support NestedScrollView in ClippingScrollViewDecoratorView#1527
kirillzyusko merged 1 commit into
kirillzyusko:mainfrom
Nodonisko:fix/clipping-scroll-view-nested-scroll-view

Conversation

@Nodonisko

Copy link
Copy Markdown
Contributor

Problem

With React Native's useNestedScrollViewAndroid feature flag (RN 0.85+, react/react-native#55239), ScrollView renders as ReactNestedScrollView, which extends androidx.core.widget.NestedScrollView (a FrameLayout) — not android.widget.ScrollView.

ClippingScrollViewDecoratorView.findScrollView only matches view is ScrollView, so it returns null, decorateScrollView() silently no-ops, and contentInsetBottom/contentInsetTop are dropped entirely. In a KeyboardChatScrollView this means: list content hides behind the composer, and blankSpace/extraContentPadding have no effect on Android.

Fix

Match NestedScrollView as well, and pass the found view around as ViewGroup. Every member used by the decorator and the padding-scroll workaround (clipToPadding, getChildAt, setPadding, scrollBy, scrollY, canScrollVertically, getLocationOnScreen) lives on ViewGroup/View, and NestedScrollView extends its scroll range via bottom padding + clipToPadding = false exactly like ScrollView.

ReactNestedScrollView itself is package-private, hence matching on the public androidx base class.

Testing

Verified in a chat app (RN 0.85.3, new arch, useNestedScrollViewAndroid enabled) via patch-package: composer inset, keyboard padding, and blankSpace all apply again; behavior with the flag disabled (plain ScrollView) is unchanged.

🤖 Generated with Claude Code

…View

With React Native's `useNestedScrollViewAndroid` feature flag (RN 0.85+,
react/react-native#55239), ScrollView renders as ReactNestedScrollView,
which extends androidx.core.widget.NestedScrollView (a FrameLayout), not
android.widget.ScrollView. `findScrollView` never matched it, so
`decorateScrollView` silently no-oped and `contentInsetBottom`/
`contentInsetTop` were dropped entirely: KeyboardChatScrollView content
hid behind composers and `blankSpace`/`extraContentPadding` did nothing.

Match NestedScrollView as well and pass the target around as ViewGroup;
every member the decorator and the padding-scroll workaround use
(clipToPadding, getChildAt, setPadding, scrollBy, scrollY,
canScrollVertically, getLocationOnScreen) lives on ViewGroup/View, and
NestedScrollView extends the scroll range via bottom padding +
clipToPadding=false the same way ScrollView does.

ReactNestedScrollView itself is package-private, hence matching on the
public androidx base class.
@kirillzyusko
kirillzyusko self-requested a review July 2, 2026 16:15
@kirillzyusko kirillzyusko self-assigned this Jul 2, 2026
@kirillzyusko kirillzyusko added 🤖 android Android specific KeyboardAwareScrollView 📜 Anything related to KeyboardAwareScrollView component KeyboardChatScrollView 💬 Anything about chat functionality labels Jul 2, 2026
@github-actions

github-actions Bot commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

📊 Package size report

Current size Target Size Difference
322519 bytes 322392 bytes 127 bytes 📈

@Nodonisko
Nodonisko marked this pull request as ready for review July 2, 2026 16:22
@kirillzyusko kirillzyusko added the 🐛 bug Something isn't working label Jul 2, 2026
@kirillzyusko
kirillzyusko merged commit 73d3b8a into kirillzyusko:main Jul 2, 2026
17 of 18 checks passed
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 KeyboardAwareScrollView 📜 Anything related to KeyboardAwareScrollView component KeyboardChatScrollView 💬 Anything about chat functionality

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants