diff --git a/patches/react-native/details.md b/patches/react-native/details.md index 5be697575490..f59d0a5ec3d0 100644 --- a/patches/react-native/details.md +++ b/patches/react-native/details.md @@ -192,9 +192,9 @@ ### [react-native+0.85.3+025+log-soft-exception-if-viewState-not-found.patch](react-native+0.85.3+025+log-soft-exception-if-viewState-not-found.patch) -- Reason: This patch prevents app crashes by soft-logging the exception when JS try to send events to native views even if they are removed from view hierarchy. The approach follows existing patterns in the same file where similar events are already handled this way and is based on suggestions from other developers in upstream discussions. -- Upstream PR/issue: [#49077](https://github.com/facebook/react-native/issues/49077) [#7493](https://github.com/software-mansion/react-native-reanimated/issues/7493) -- E/App issue: [#82611](https://github.com/Expensify/App/issues/82611) +- Reason: This patch prevents app crashes by soft-logging missing view-state exceptions when JS sends events or Fabric mount instructions for native views that have already been removed from the hierarchy. It includes the upstream `updateOverflowInset` guard so stale batch mount items return safely instead of throwing `RetryableMountingLayerException`. +- Upstream PR/issue: [#49077](https://github.com/facebook/react-native/issues/49077) [#56762](https://github.com/facebook/react-native/pull/56762) [#7493](https://github.com/software-mansion/react-native-reanimated/issues/7493) +- E/App issues: [#82611](https://github.com/Expensify/App/issues/82611) [#93833](https://github.com/Expensify/App/issues/93833) - PR introducing patch: [#84303](https://github.com/Expensify/App/pull/84303) ### [react-native+0.85.3+026+fix-view-stealing-first-responder.patch](react-native+0.85.3+026+fix-view-stealing-first-responder.patch) diff --git a/patches/react-native/react-native+0.85.3+025+log-soft-exception-if-viewState-not-found.patch b/patches/react-native/react-native+0.85.3+025+log-soft-exception-if-viewState-not-found.patch index 833cec0fe451..91cd33a04724 100644 --- a/patches/react-native/react-native+0.85.3+025+log-soft-exception-if-viewState-not-found.patch +++ b/patches/react-native/react-native+0.85.3+025+log-soft-exception-if-viewState-not-found.patch @@ -1,5 +1,5 @@ diff --git a/node_modules/react-native/ReactAndroid/src/main/java/com/facebook/react/fabric/mounting/SurfaceMountingManager.kt b/node_modules/react-native/ReactAndroid/src/main/java/com/facebook/react/fabric/mounting/SurfaceMountingManager.kt -index eb0b519..50bffae 100644 +index eb0b519..1ddcbe2 100644 --- a/node_modules/react-native/ReactAndroid/src/main/java/com/facebook/react/fabric/mounting/SurfaceMountingManager.kt +++ b/node_modules/react-native/ReactAndroid/src/main/java/com/facebook/react/fabric/mounting/SurfaceMountingManager.kt @@ -281,15 +281,33 @@ internal constructor( @@ -75,3 +75,18 @@ index eb0b519..50bffae 100644 // Do not layout Root Views if (viewState.isRoot) { return +@@ -840,4 +876,13 @@ internal constructor( +- val viewState = getViewState(reactTag) ++ val viewState = getNullableViewState(reactTag) ++ if (viewState == null) { ++ ReactSoftExceptionLogger.logSoftException( ++ ReactSoftExceptionLogger.Categories.SURFACE_MOUNTING_MANAGER_MISSING_VIEWSTATE, ++ ReactNoCrashSoftException( ++ "Unable to find viewState for tag $reactTag for updateOverflowInset" ++ ), ++ ) ++ return ++ } + // Do not layout Root Views + if (viewState.isRoot) { + return