Skip to content

Comments

fix(android): nested scroll breaks after conditional ScrollView remount#564

Merged
lodev09 merged 7 commits intomainfrom
fix/android-scrollview-remount
Feb 23, 2026
Merged

fix(android): nested scroll breaks after conditional ScrollView remount#564
lodev09 merged 7 commits intomainfrom
fix/android-scrollview-remount

Conversation

@lodev09
Copy link
Owner

@lodev09 lodev09 commented Feb 23, 2026

Summary

Fixes the first-interaction bug where remounting a nested ScrollView (e.g. conditional rendering) causes the sheet to drag instead of scroll. Resolves #563.

  • Proactively re-discover ScrollView via addView/removeViewAt on Android and mountChildComponentView/unmountChildComponentView on iOS
  • Re-apply keyboard inset when ScrollView remounts while keyboard is open
  • Align setupScrollable flow and inset helpers across both platforms
  • Add currentHeight to iOS TrueSheetKeyboardObserver for keyboard state tracking

Type of Change

  • Bug fix

Test Plan

  • Open ScrollViewSheet example, toggle list on/off, verify nested scrolling works on first interaction
  • Test with keyboard open during ScrollView remount
  • Verify FlatListSheet still works correctly

Checklist

  • I tested on iOS
  • I tested on Android
  • I tested on Web
  • I updated the documentation (if needed)
  • I added a changelog entry (if needed)

Detect content hierarchy changes via OnHierarchyChangeListener and
re-run setupScrollable + requestLayout when the pinned ScrollView
is no longer a descendant. Removes redundant cachedScrollView field.
Refactor iOS delegate chain to match Android pattern:
- ContentView checks if ScrollView changed before notifying delegate
- Extract applyScrollViewBottomInset helper to reduce duplication
- Track keyboard height in TrueSheetKeyboardObserver for re-application
@vercel
Copy link

vercel bot commented Feb 23, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
react-native-true-sheet Ready Ready Preview, Comment Feb 23, 2026 9:15pm

Request Review

@lodev09 lodev09 merged commit 2debf2c into main Feb 23, 2026
6 checks passed
@lodev09 lodev09 deleted the fix/android-scrollview-remount branch February 23, 2026 21:15
@lodev09
Copy link
Owner Author

lodev09 commented Feb 23, 2026

🚀 This pull request is included in v3.9.7. See Release 3.9.7 for release notes.

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.

First interaction with remounted nested ScrollView is dragging sheet instead of scrolling

1 participant