Patch ReactViewGroup to survive null child during subview clipping

Fixes the fatal Android crash "IllegalStateException: Required value was
null" in ReactViewGroup.updateSubviewClipStatus (Sentry APP-T20Q, 14 users
in 14 days on 1.128.0/1.129.0). Reentrant child removal during a clipping
pass can leave a null slot in allChildren below allChildrenCount; the
checkNotNull on that slot then kills the app during animated scrolls.
A null slot means the view is already detached, so skip it and count it
as clipped instead of throwing.

Unfixed upstream as of July 2026; the sibling fix attempt
facebook/react-native#57365 was abandoned. Verified against a
deterministic state-injection repro: unpatched RN crashes with the exact
Sentry stack (ReactViewGroup.kt:469/435/411), patched RN survives with
the app fully functional.

Note: takes effect on Android only when react-android is built from
source; see the caveat in the patch md.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Tomek Zawadzki
2026-07-27 11:15:48 +02:00
parent 51bcacb20b
commit 05bb19dd3f
3 changed files with 423 additions and 368 deletions
+367 -367
View File
File diff suppressed because it is too large Load Diff