Fix setJSResponder for Fabric

Summary:
Before this fix, ReactNative screens that uses the Fabric renderer crashes when an event is dispatched. The root cause of the bug is that React JS executes the setJSResponder method in UIManagerModule, but this method is not implemented yet in Fabric.

This fix will have to be picked into current RC to fix events into the City Guides screen running the Fabric experiment

Reviewed By: fkgozali

Differential Revision: D8515300

fbshipit-source-id: 40fe2f77987470abed8164f848680a911efa4bd2
This commit is contained in:
David Vacca 2018-06-19 10:33:16 -07:00 committed by Facebook Github Bot
parent 5f9a2117bf
commit c6a52b6db6
1 changed files with 2 additions and 6 deletions

View File

@ -10,7 +10,6 @@ package com.facebook.react.uimanager;
import static com.facebook.react.bridge.ReactMarkerConstants.CREATE_UI_MANAGER_MODULE_CONSTANTS_END;
import static com.facebook.react.bridge.ReactMarkerConstants.CREATE_UI_MANAGER_MODULE_CONSTANTS_START;
import static com.facebook.react.uimanager.common.UIManagerType.DEFAULT;
import static com.facebook.react.uimanager.common.UIManagerType.FABRIC;
import android.content.ComponentCallbacks2;
import android.content.Context;
@ -25,9 +24,7 @@ import com.facebook.react.bridge.Callback;
import com.facebook.react.bridge.GuardedRunnable;
import com.facebook.react.bridge.LifecycleEventListener;
import com.facebook.react.bridge.OnBatchCompleteListener;
import com.facebook.react.bridge.PerformanceCounter;
import com.facebook.react.bridge.ReactApplicationContext;
import com.facebook.react.bridge.ReactContext;
import com.facebook.react.bridge.ReactContextBaseJavaModule;
import com.facebook.react.bridge.ReactMarker;
import com.facebook.react.bridge.ReactMethod;
@ -40,7 +37,6 @@ import com.facebook.react.common.ReactConstants;
import com.facebook.react.module.annotations.ReactModule;
import com.facebook.react.uimanager.common.MeasureSpecProvider;
import com.facebook.react.uimanager.common.SizeMonitoringFrameLayout;
import com.facebook.react.uimanager.common.UIManagerType;
import com.facebook.react.uimanager.common.ViewUtil;
import com.facebook.react.uimanager.debug.NotThreadSafeViewHierarchyUpdateDebugListener;
import com.facebook.react.uimanager.events.EventDispatcher;
@ -595,9 +591,9 @@ public class UIManagerModule extends ReactContextBaseJavaModule implements
int uiManagerType = ViewUtil.getUIManagerType(reactTag);
if (uiManagerType != DEFAULT) {
UIManagerHelper.getUIManager(getReactApplicationContext(), uiManagerType).setJSResponder(reactTag, blockNativeResponder);
} else {
mUIImplementation.setJSResponder(reactTag, blockNativeResponder);
}
mUIImplementation.setJSResponder(reactTag, blockNativeResponder);
}
@Override