mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Add ReactSoftException in ReactHostImpl only when onActivityResult, onNewIntent and onWindowFocusChange do not have the context (#44155)
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/44155 Add ReactSoftException in ReactHostImpl only when `onActivityResult`, `onNewIntent`and `onWindowFocusChange` do not have the context Changelog: [Android][Fixed] ReactSoftExceptions in ReactHostImpl only when Context is null Reviewed By: cortinico Differential Revision: D56325407 fbshipit-source-id: a9f8fd5772fc05d39e72236fb8edfe5f8a9d6a43
This commit is contained in:
committed by
Facebook GitHub Bot
parent
efb073f46b
commit
ac3261ff60
+14
-11
@@ -672,11 +672,12 @@ public class ReactHostImpl implements ReactHost {
|
||||
ReactContext currentContext = getCurrentReactContext();
|
||||
if (currentContext != null) {
|
||||
currentContext.onActivityResult(activity, requestCode, resultCode, data);
|
||||
} else {
|
||||
ReactSoftExceptionLogger.logSoftException(
|
||||
TAG,
|
||||
new ReactNoCrashSoftException(
|
||||
"Tried to access onActivityResult while context is not ready"));
|
||||
}
|
||||
ReactSoftExceptionLogger.logSoftException(
|
||||
TAG,
|
||||
new ReactNoCrashSoftException(
|
||||
"Tried to access onActivityResult while context is not ready"));
|
||||
}
|
||||
|
||||
/* To be called when focus has changed for the hosting window. */
|
||||
@@ -689,11 +690,12 @@ public class ReactHostImpl implements ReactHost {
|
||||
ReactContext currentContext = getCurrentReactContext();
|
||||
if (currentContext != null) {
|
||||
currentContext.onWindowFocusChange(hasFocus);
|
||||
} else {
|
||||
ReactSoftExceptionLogger.logSoftException(
|
||||
TAG,
|
||||
new ReactNoCrashSoftException(
|
||||
"Tried to access onWindowFocusChange while context is not ready"));
|
||||
}
|
||||
ReactSoftExceptionLogger.logSoftException(
|
||||
TAG,
|
||||
new ReactNoCrashSoftException(
|
||||
"Tried to access onWindowFocusChange while context is not ready"));
|
||||
}
|
||||
|
||||
/* This method will give JS the opportunity to receive intents via Linking.
|
||||
@@ -720,10 +722,11 @@ public class ReactHostImpl implements ReactHost {
|
||||
}
|
||||
}
|
||||
currentContext.onNewIntent(getCurrentActivity(), intent);
|
||||
} else {
|
||||
ReactSoftExceptionLogger.logSoftException(
|
||||
TAG,
|
||||
new ReactNoCrashSoftException("Tried to access onNewIntent while context is not ready"));
|
||||
}
|
||||
ReactSoftExceptionLogger.logSoftException(
|
||||
TAG,
|
||||
new ReactNoCrashSoftException("Tried to access onNewIntent while context is not ready"));
|
||||
}
|
||||
|
||||
@ThreadConfined(UI)
|
||||
|
||||
Reference in New Issue
Block a user