Java Code Examples for com.facebook.react.bridge.ReactApplicationContext#getNativeModule()

The following examples show how to use com.facebook.react.bridge.ReactApplicationContext#getNativeModule() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: RNShadowTextGradient.java    From react-native-text-gradient with MIT License 6 votes vote down vote up
private @Nullable View resolveView(int tag) {
  UiThreadUtil.assertOnUiThread();
  ReactApplicationContext context = mContext.get();

  if (context != null) {
    UIManagerModule uiManager = context.getNativeModule(UIManagerModule.class);

    NativeViewHierarchyManager manager = ReflectUtils.getFieldValue(
      ReflectUtils.getFieldValue(
        uiManager.getUIImplementation(),
        "mOperationsQueue",
        null
      ),
      "mNativeViewHierarchyManager",
      null
    );

    if (manager != null) {
      return manager.resolveView(tag);
    }
  }

  return null;
}
 
Example 2
Source File: NativeAnimatedModule.java    From react-native-GPay with MIT License 5 votes vote down vote up
@Override
public void initialize() {
  ReactApplicationContext reactCtx = getReactApplicationContext();
  UIManagerModule uiManager = reactCtx.getNativeModule(UIManagerModule.class);
  reactCtx.addLifecycleEventListener(this);
  uiManager.addUIManagerListener(this);
}