mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Simplify API of getReactApplicationContextIfActiveOrWarn
Summary: Simplify the API of `getReactApplicationContextIfActiveOrWarn`. We don't need to pass so much information into this method to collect good SoftExceptions. Changelog: [Internal] Reviewed By: mdvacca Differential Revision: D18134400 fbshipit-source-id: 0a250ab0252a44121f3339a31506a0a6c4c7cd35
This commit is contained in:
committed by
Facebook Github Bot
parent
a1a56fe4e5
commit
9446277fc1
+3
-3
@@ -45,15 +45,15 @@ public abstract class ReactContextBaseJavaModule extends BaseJavaModule {
|
||||
* thread-safe.
|
||||
*/
|
||||
@ThreadConfined(ANY)
|
||||
protected @Nullable final ReactApplicationContext getReactApplicationContextIfActiveOrWarn(
|
||||
String tag, String reason) {
|
||||
protected @Nullable final ReactApplicationContext getReactApplicationContextIfActiveOrWarn() {
|
||||
if (mReactApplicationContext.hasActiveCatalystInstance()) {
|
||||
return mReactApplicationContext;
|
||||
}
|
||||
|
||||
// We want to collect data about how often this happens, but SoftExceptions will cause a crash
|
||||
// in debug mode, which isn't usually desirable.
|
||||
String msg = "Catalyst Instance has already disappeared: " + reason;
|
||||
String msg = "Catalyst Instance has already disappeared: requested by " + this.getName();
|
||||
String tag = "ReactContextBaseJavaModule";
|
||||
if (ReactBuildConfig.DEBUG) {
|
||||
FLog.w(tag, msg);
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user