mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Add support for View Manager commands in Fabric
Reviewed By: achen1 Differential Revision: D7879104 fbshipit-source-id: fd89acb3941bb03364d18ddedf68a081aef934a0
This commit is contained in:
committed by
Facebook Github Bot
parent
398f1d8ddd
commit
3ac914478d
@@ -10,6 +10,9 @@ 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.ViewType.FABRIC;
|
||||
import static com.facebook.react.uimanager.common.ViewType.PAPER;
|
||||
|
||||
import android.content.ComponentCallbacks2;
|
||||
import android.content.res.Configuration;
|
||||
import android.content.Context;
|
||||
@@ -37,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.ViewUtil;
|
||||
import com.facebook.react.uimanager.debug.NotThreadSafeViewHierarchyUpdateDebugListener;
|
||||
import com.facebook.react.uimanager.events.EventDispatcher;
|
||||
import com.facebook.systrace.Systrace;
|
||||
@@ -582,9 +586,17 @@ public class UIManagerModule extends ReactContextBaseJavaModule implements
|
||||
mUIImplementation.clearJSResponder();
|
||||
}
|
||||
|
||||
@Override
|
||||
@ReactMethod
|
||||
public void dispatchViewManagerCommand(int reactTag, int commandId, ReadableArray commandArgs) {
|
||||
mUIImplementation.dispatchViewManagerCommand(reactTag, commandId, commandArgs);
|
||||
public void dispatchViewManagerCommand(int reactTag, int commandId, @Nullable ReadableArray commandArgs) {
|
||||
//TODO: this is a temporary approach to support ViewManagerCommands in Fabric until
|
||||
// the dispatchViewManagerCommand() method is supported by Fabric JS API.
|
||||
if (ViewUtil.getViewType(reactTag) == FABRIC) {
|
||||
UIManagerHelper.getUIManager(getReactApplicationContext(), true)
|
||||
.dispatchViewManagerCommand(reactTag, commandId, commandArgs);
|
||||
} else {
|
||||
mUIImplementation.dispatchViewManagerCommand(reactTag, commandId, commandArgs);
|
||||
}
|
||||
}
|
||||
|
||||
@ReactMethod
|
||||
|
||||
Reference in New Issue
Block a user