mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-04-16 08:19:47 +08:00
Reviewed By: achen1 Differential Revision: D7879104 fbshipit-source-id: fd89acb3941bb03364d18ddedf68a081aef934a0
33 lines
1.0 KiB
Java
33 lines
1.0 KiB
Java
package com.facebook.react.uimanager;
|
|
|
|
import static com.facebook.react.uimanager.common.ViewType.FABRIC;
|
|
import static com.facebook.react.uimanager.common.ViewUtil.getViewType;
|
|
|
|
import com.facebook.react.bridge.CatalystInstance;
|
|
import com.facebook.react.bridge.ReactContext;
|
|
import com.facebook.react.bridge.UIManager;
|
|
|
|
/**
|
|
* Helper class for {@link UIManager}.
|
|
*/
|
|
public class UIManagerHelper {
|
|
|
|
/**
|
|
* @return a {@link UIManager} that can handle the react tag received by parameter.
|
|
*/
|
|
public static UIManager getUIManager(ReactContext context, int reactTag) {
|
|
return getUIManager(context, getViewType(reactTag) == FABRIC);
|
|
}
|
|
|
|
/**
|
|
* @return a {@link UIManager} that can handle the react tag received by parameter.
|
|
*/
|
|
public static UIManager getUIManager(ReactContext context, boolean isFabric) {
|
|
CatalystInstance catalystInstance = context.getCatalystInstance();
|
|
return isFabric ?
|
|
catalystInstance.getJSIModule(UIManager.class) :
|
|
catalystInstance.getNativeModule(UIManagerModule.class);
|
|
}
|
|
|
|
}
|