mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Rename "hasActiveCatalystInstance" to "hasActiveReactInstance" for clarification
Summary: Sometimes ```hasActiveCatalystInstance()``` is used to check if it's safe to access the CatalystInstance, which will still crash in Venice. Previously we mitigate this by changing ```reactContext.hasActiveCatalystInstance()``` to ```reactContext.hasActiveCatalystInstance() || reactContext.isBridgeless()```. To solve this for all and good the plan is: 1, Rename ```hasActiveCatalystInstance()``` to ```hasActiveReactInstance()``` so it won't sounds like CatalystInstance-only. 2, Implement hasActiveReactInstance() for Venice. D27343867 3, Remove previous mitigation. D27343952 This diff is the first step, by xbgs there are **58** non-generated callsites of ```hasActiveCatalystInstance()``` in code base which are all renamed in this diff. Changelog: [Android][Changed] - Rename "hasActiveCatalystInstance" to "hasActiveReactInstance" Reviewed By: mdvacca Differential Revision: D27335055 fbshipit-source-id: 5b8ff5e09b79a492e910bb8f197e70fa1360bcef
This commit is contained in:
committed by
Facebook GitHub Bot
parent
b86e52a9ec
commit
dfa8eb0558
+1
-1
@@ -90,7 +90,7 @@ public class NativeAnimatedNodeTraversalTest {
|
||||
mFrameTimeNanos = INITIAL_FRAME_TIME_NANOS;
|
||||
|
||||
mReactApplicationContextMock = mock(ReactApplicationContext.class);
|
||||
PowerMockito.when(mReactApplicationContextMock.hasActiveCatalystInstance())
|
||||
PowerMockito.when(mReactApplicationContextMock.hasActiveReactInstance())
|
||||
.thenAnswer(
|
||||
new Answer<Boolean>() {
|
||||
@Override
|
||||
|
||||
@@ -60,7 +60,7 @@ public class DialogModuleTest {
|
||||
mActivity = mActivityController.create().start().resume().get();
|
||||
|
||||
final ReactApplicationContext context = PowerMockito.mock(ReactApplicationContext.class);
|
||||
PowerMockito.when(context.hasActiveCatalystInstance()).thenReturn(true);
|
||||
PowerMockito.when(context.hasActiveReactInstance()).thenReturn(true);
|
||||
PowerMockito.when(context, "getCurrentActivity").thenReturn(mActivity);
|
||||
|
||||
mDialogModule = new DialogModule(context);
|
||||
|
||||
+1
-1
@@ -96,7 +96,7 @@ public class NetworkingModuleTest {
|
||||
CatalystInstance reactInstance = mock(CatalystInstance.class);
|
||||
ReactApplicationContext reactContext = mock(ReactApplicationContext.class);
|
||||
when(reactContext.getCatalystInstance()).thenReturn(reactInstance);
|
||||
when(reactContext.hasActiveCatalystInstance()).thenReturn(true);
|
||||
when(reactContext.hasActiveReactInstance()).thenReturn(true);
|
||||
when(reactContext.getJSModule(any(Class.class))).thenReturn(mEmitter);
|
||||
mNetworkingModule = new NetworkingModule(reactContext, "", mHttpClient);
|
||||
}
|
||||
|
||||
@@ -75,7 +75,7 @@ public class TimingModuleTest {
|
||||
CatalystInstance reactInstance = mock(CatalystInstance.class);
|
||||
ReactApplicationContext reactContext = mock(ReactApplicationContext.class);
|
||||
when(reactContext.getCatalystInstance()).thenReturn(reactInstance);
|
||||
when(reactContext.hasActiveCatalystInstance()).thenReturn(true);
|
||||
when(reactContext.hasActiveReactInstance()).thenReturn(true);
|
||||
|
||||
mCurrentTimeNs = 0;
|
||||
mPostFrameCallbackHandler = new PostFrameCallbackHandler();
|
||||
|
||||
Reference in New Issue
Block a user