diff --git a/patches/react-native/details.md b/patches/react-native/details.md index f7b4c34790d15..a869464f06849 100644 --- a/patches/react-native/details.md +++ b/patches/react-native/details.md @@ -217,3 +217,10 @@ - Upstream PR/issue: This should ideally be the default behavior upstream, but no PR has been filed yet. - E/App issue: [#83000](https://github.com/Expensify/App/issues/83000) - PR introducing patch: [#83256](https://github.com/Expensify/App/pull/83256) + +### [react-native+0.81.4+029+log-soft-exception-if-viewState-not-found.patch](react-native+0.81.4+029+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) +- PR introducing patch: [#84303](https://github.com/Expensify/App/pull/84303) diff --git a/patches/react-native/react-native+0.81.4+029+log-soft-exception-if-viewState-not-found.patch b/patches/react-native/react-native+0.81.4+029+log-soft-exception-if-viewState-not-found.patch new file mode 100644 index 0000000000000..6a39a1946748c --- /dev/null +++ b/patches/react-native/react-native+0.81.4+029+log-soft-exception-if-viewState-not-found.patch @@ -0,0 +1,20 @@ +diff --git a/node_modules/react-native/ReactAndroid/src/main/java/com/facebook/react/fabric/mounting/SurfaceMountingManager.java b/node_modules/react-native/ReactAndroid/src/main/java/com/facebook/react/fabric/mounting/SurfaceMountingManager.java +index cdcd812..03e09d4 100644 +--- a/node_modules/react-native/ReactAndroid/src/main/java/com/facebook/react/fabric/mounting/SurfaceMountingManager.java ++++ b/node_modules/react-native/ReactAndroid/src/main/java/com/facebook/react/fabric/mounting/SurfaceMountingManager.java +@@ -685,7 +685,14 @@ public class SurfaceMountingManager { + return; + } + +- ViewState viewState = getViewState(reactTag); ++ ViewState viewState = getNullableViewState(reactTag); ++ if (viewState == null) { ++ ReactSoftExceptionLogger.logSoftException( ++ ReactSoftExceptionLogger.Categories.SURFACE_MOUNTING_MANAGER_MISSING_VIEWSTATE, ++ new ReactNoCrashSoftException( ++ "Unable to find viewState for tag: " + reactTag + " for updateProps")); ++ return; ++ } + viewState.mCurrentProps = new ReactStylesDiffMap(props); + View view = viewState.mView; +