From 950687568312d9e24f2e9fa0fd1479809bedda1b Mon Sep 17 00:00:00 2001 From: Mattermost Build Date: Thu, 21 May 2020 21:28:15 +0200 Subject: [PATCH] Catch ClassCastException activity (#4323) Co-authored-by: Miguel Alatzar --- patches/react-native-navigation+6.4.0.patch | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/patches/react-native-navigation+6.4.0.patch b/patches/react-native-navigation+6.4.0.patch index 45d54ff1c..261c100bd 100644 --- a/patches/react-native-navigation+6.4.0.patch +++ b/patches/react-native-navigation+6.4.0.patch @@ -1,5 +1,5 @@ diff --git a/node_modules/react-native-navigation/lib/android/app/src/main/java/com/reactnativenavigation/react/NavigationModule.java b/node_modules/react-native-navigation/lib/android/app/src/main/java/com/reactnativenavigation/react/NavigationModule.java -index 260ed81..52b53d8 100644 +index 260ed81..f719679 100644 --- a/node_modules/react-native-navigation/lib/android/app/src/main/java/com/reactnativenavigation/react/NavigationModule.java +++ b/node_modules/react-native-navigation/lib/android/app/src/main/java/com/reactnativenavigation/react/NavigationModule.java @@ -56,14 +56,18 @@ public class NavigationModule extends ReactContextBaseJavaModule { @@ -29,6 +29,21 @@ index 260ed81..52b53d8 100644 } }); } +@@ -196,8 +200,12 @@ public class NavigationModule extends ReactContextBaseJavaModule { + + protected void handle(Runnable task) { + UiThread.post(() -> { +- if (getCurrentActivity() != null && !activity().isFinishing()) { +- task.run(); ++ try { ++ if (getCurrentActivity() != null && !activity().isFinishing()) { ++ task.run(); ++ } ++ } catch (ClassCastException e) { ++ // The most current activity is not a NavigationActivity + } + }); + } diff --git a/node_modules/react-native-navigation/lib/ios/RNNCommandsHandler.m b/node_modules/react-native-navigation/lib/ios/RNNCommandsHandler.m index ae8be52..8a8dec5 100644 --- a/node_modules/react-native-navigation/lib/ios/RNNCommandsHandler.m