Add noop support for setJSResponder / clearJSReponder API methods
Reviewed By: fkgozali Differential Revision: D8458980 fbshipit-source-id: 2411fb8106288f65cabdef12917d0f5086d1723a
This commit is contained in:
parent
936de607b1
commit
e15a761084
|
@ -27,4 +27,9 @@ public interface UIManager extends JSIModule, PerformanceCounter {
|
|||
* @param commandArgs {@link ReadableArray} parameters associated with the command
|
||||
*/
|
||||
void dispatchCommand(int reactTag, int commandId, @Nullable ReadableArray commandArgs);
|
||||
|
||||
void setJSResponder(int reactTag, boolean blockNativeResponder);
|
||||
|
||||
void clearJSResponder();
|
||||
|
||||
}
|
||||
|
|
|
@ -10,6 +10,7 @@ package com.facebook.react.fabric;
|
|||
import static android.view.View.MeasureSpec.AT_MOST;
|
||||
import static android.view.View.MeasureSpec.EXACTLY;
|
||||
import static android.view.View.MeasureSpec.UNSPECIFIED;
|
||||
import static com.facebook.react.uimanager.common.UIManagerType.DEFAULT;
|
||||
import static com.facebook.react.uimanager.common.UIManagerType.FABRIC;
|
||||
|
||||
import android.os.SystemClock;
|
||||
|
@ -21,6 +22,7 @@ import com.facebook.infer.annotation.Assertions;
|
|||
import com.facebook.proguard.annotations.DoNotStrip;
|
||||
import com.facebook.react.bridge.JavaScriptContextHolder;
|
||||
import com.facebook.react.bridge.ReactApplicationContext;
|
||||
import com.facebook.react.bridge.ReactMethod;
|
||||
import com.facebook.react.bridge.ReadableArray;
|
||||
import com.facebook.react.bridge.ReadableMap;
|
||||
import com.facebook.react.bridge.ReadableNativeMap;
|
||||
|
@ -39,11 +41,13 @@ import com.facebook.react.uimanager.ReactShadowNode;
|
|||
import com.facebook.react.uimanager.ReactShadowNodeImpl;
|
||||
import com.facebook.react.uimanager.ReactStylesDiffMap;
|
||||
import com.facebook.react.uimanager.ThemedReactContext;
|
||||
import com.facebook.react.uimanager.UIManagerHelper;
|
||||
import com.facebook.react.uimanager.UIViewOperationQueue;
|
||||
import com.facebook.react.uimanager.ViewManager;
|
||||
import com.facebook.react.uimanager.ViewManagerRegistry;
|
||||
import com.facebook.react.uimanager.common.MeasureSpecProvider;
|
||||
import com.facebook.react.uimanager.common.SizeMonitoringFrameLayout;
|
||||
import com.facebook.react.uimanager.common.ViewUtil;
|
||||
import com.facebook.react.uimanager.events.EventDispatcher;
|
||||
import com.facebook.systrace.Systrace;
|
||||
import com.facebook.systrace.SystraceMessage;
|
||||
|
@ -645,6 +649,16 @@ public class FabricUIManager implements UIManager, JSHandler {
|
|||
mBinding.dispatchEventToTarget(mJSContext.get(), mEventHandlerPointer, eventTarget, name, (WritableNativeMap) params);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setJSResponder(int reactTag, boolean blockNativeResponder) {
|
||||
// TODO: Do nothing for now
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clearJSResponder() {
|
||||
// TODO: Do nothing for now
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initialize() {
|
||||
FabricEventEmitter eventEmitter =
|
||||
|
|
|
@ -10,6 +10,7 @@ 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;
|
||||
|
@ -39,6 +40,7 @@ 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;
|
||||
|
@ -585,11 +587,20 @@ public class UIManagerModule extends ReactContextBaseJavaModule implements
|
|||
mUIImplementation.removeAnimation(reactTag, animationID);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ReactMethod
|
||||
public void setJSResponder(int reactTag, boolean blockNativeResponder) {
|
||||
//TODO: this is a temporary approach to support ViewManagerCommands in Fabric until
|
||||
// the dispatchViewManagerCommand() method is supported by Fabric JS API.
|
||||
int uiManagerType = ViewUtil.getUIManagerType(reactTag);
|
||||
if (uiManagerType != DEFAULT) {
|
||||
UIManagerHelper.getUIManager(getReactApplicationContext(), uiManagerType).setJSResponder(reactTag, blockNativeResponder);
|
||||
}
|
||||
|
||||
mUIImplementation.setJSResponder(reactTag, blockNativeResponder);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ReactMethod
|
||||
public void clearJSResponder() {
|
||||
mUIImplementation.clearJSResponder();
|
||||
|
|
Loading…
Reference in New Issue