mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Part 2: Make CatalystInstanceImpl.getNativeModule Nullable
Summary: This is the codemod portion of the parent diff. I modified all call-sites to `ReactContext.getNativeModule` to do a null check on the returned NativeModule. Changelog: [Android][Fixed] - Check if NativeModules returned from CatalystInstanceImpl.getNativeModule are null before using them. Reviewed By: JoshuaGross Differential Revision: D21272028 fbshipit-source-id: 6bd16c6bf30605f2dfdf4c481352063712965342
This commit is contained in:
committed by
Facebook GitHub Bot
parent
1cef72af04
commit
9263eb5d38
@@ -200,9 +200,12 @@ public class ReactRootView extends FrameLayout implements RootView, ReactRoot {
|
||||
return;
|
||||
}
|
||||
ReactContext reactContext = mReactInstanceManager.getCurrentReactContext();
|
||||
EventDispatcher eventDispatcher =
|
||||
reactContext.getNativeModule(UIManagerModule.class).getEventDispatcher();
|
||||
mJSTouchDispatcher.onChildStartedNativeGesture(androidEvent, eventDispatcher);
|
||||
UIManagerModule uiManager = reactContext.getNativeModule(UIManagerModule.class);
|
||||
|
||||
if (uiManager != null) {
|
||||
EventDispatcher eventDispatcher = uiManager.getEventDispatcher();
|
||||
mJSTouchDispatcher.onChildStartedNativeGesture(androidEvent, eventDispatcher);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -285,9 +288,12 @@ public class ReactRootView extends FrameLayout implements RootView, ReactRoot {
|
||||
return;
|
||||
}
|
||||
ReactContext reactContext = mReactInstanceManager.getCurrentReactContext();
|
||||
EventDispatcher eventDispatcher =
|
||||
reactContext.getNativeModule(UIManagerModule.class).getEventDispatcher();
|
||||
mJSTouchDispatcher.handleTouchEvent(event, eventDispatcher);
|
||||
UIManagerModule uiManager = reactContext.getNativeModule(UIManagerModule.class);
|
||||
|
||||
if (uiManager != null) {
|
||||
EventDispatcher eventDispatcher = uiManager.getEventDispatcher();
|
||||
mJSTouchDispatcher.handleTouchEvent(event, eventDispatcher);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -749,10 +755,12 @@ public class ReactRootView extends FrameLayout implements RootView, ReactRoot {
|
||||
}
|
||||
|
||||
private void emitUpdateDimensionsEvent() {
|
||||
mReactInstanceManager
|
||||
.getCurrentReactContext()
|
||||
.getNativeModule(DeviceInfoModule.class)
|
||||
.emitUpdateDimensionsEvent();
|
||||
DeviceInfoModule deviceInfo =
|
||||
mReactInstanceManager.getCurrentReactContext().getNativeModule(DeviceInfoModule.class);
|
||||
|
||||
if (deviceInfo != null) {
|
||||
deviceInfo.emitUpdateDimensionsEvent();
|
||||
}
|
||||
}
|
||||
|
||||
private WritableMap createKeyboardEventPayload(
|
||||
|
||||
Reference in New Issue
Block a user