From 1b3c0920debdfdbebf71b8593877e6af3c62e5fb Mon Sep 17 00:00:00 2001 From: Rohit Verma Date: Thu, 5 Mar 2026 22:49:21 +0530 Subject: [PATCH 1/4] fix(react-native): log soft exception for missing viewState --- ...oft-exception-if-viewState-not-found.patch | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 patches/react-native/react-native+0.81.4+029+log-soft-exception-if-viewState-not-found.patch 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; + From 252029b3b684e349be798e4deca6082d2c27fd8c Mon Sep 17 00:00:00 2001 From: Rohit Verma Date: Fri, 6 Mar 2026 06:31:23 +0530 Subject: [PATCH 2/4] refactor: add details for react-native patch --- patches/react-native/details.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/patches/react-native/details.md b/patches/react-native/details.md index f7b4c34790d15..cd991dd426786 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](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: There is currently no official PR in the upstream library, but the issue is being discussed in several upstream GH issues. +- E/App issue: [#82611](https://github.com/Expensify/App/issues/82611) +- PR introducing patch: [#84303](https://github.com/Expensify/App/pull/84303) From 390bb847a18551d098fa69b9ff10afd260d04983 Mon Sep 17 00:00:00 2001 From: Rohit Verma Date: Fri, 6 Mar 2026 06:35:07 +0530 Subject: [PATCH 3/4] fix: update the patch file extension in the reference --- patches/react-native/details.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/patches/react-native/details.md b/patches/react-native/details.md index cd991dd426786..7c5ef71c34763 100644 --- a/patches/react-native/details.md +++ b/patches/react-native/details.md @@ -218,7 +218,7 @@ - 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](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](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: There is currently no official PR in the upstream library, but the issue is being discussed in several upstream GH issues. From 08c275d51da9a5c639bbd579f7405e95d65b638b Mon Sep 17 00:00:00 2001 From: Rohit Verma Date: Sun, 8 Mar 2026 06:33:56 +0530 Subject: [PATCH 4/4] refactor: add reference to upstream issues in details.md for added patch --- patches/react-native/details.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/patches/react-native/details.md b/patches/react-native/details.md index 7c5ef71c34763..a869464f06849 100644 --- a/patches/react-native/details.md +++ b/patches/react-native/details.md @@ -221,6 +221,6 @@ ### [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: There is currently no official PR in the upstream library, but the issue is being discussed in several upstream GH issues. +- 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)