Java Code Examples for com.facebook.react.uimanager.ViewManager

The following examples show how to use com.facebook.react.uimanager.ViewManager. These examples are extracted from open source projects. 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 want to check out the right sidebar which shows the related API usage.
Example 1
Source Project: react-native-GPay   Source File: ReactInstanceManager.java    License: MIT License 6 votes vote down vote up
/**
 * Uses configured {@link ReactPackage} instances to create all view managers.
 */
public List<ViewManager> getOrCreateViewManagers(
    ReactApplicationContext catalystApplicationContext) {
  ReactMarker.logMarker(CREATE_VIEW_MANAGERS_START);
  Systrace.beginSection(TRACE_TAG_REACT_JAVA_BRIDGE, "createAllViewManagers");
  try {
    if (mViewManagers == null) {
      synchronized (mPackages) {
        if (mViewManagers == null) {
          mViewManagers = new ArrayList<>();
          for (ReactPackage reactPackage : mPackages) {
            mViewManagers.addAll(reactPackage.createViewManagers(catalystApplicationContext));
          }
          return mViewManagers;
        }
      }
    }
    return mViewManagers;
  } finally {
    Systrace.endSection(TRACE_TAG_REACT_JAVA_BRIDGE);
    ReactMarker.logMarker(CREATE_VIEW_MANAGERS_END);
  }
}
 
Example 2
Source Project: react-native-GPay   Source File: CompositeReactPackage.java    License: MIT License 6 votes vote down vote up
/** {@inheritDoc} */
@Override
public @Nullable ViewManager createViewManager(
    ReactApplicationContext reactContext, String viewManagerName) {
  ListIterator<ReactPackage> iterator =
      mChildReactPackages.listIterator(mChildReactPackages.size());
  while (iterator.hasPrevious()) {
    ReactPackage reactPackage = iterator.previous();
    if (reactPackage instanceof ViewManagerOnDemandReactPackage) {
      ViewManager viewManager =
          ((ViewManagerOnDemandReactPackage) reactPackage)
              .createViewManager(reactContext, viewManagerName);
      if (viewManager != null) {
        return viewManager;
      }
    }
  }
  return null;
}
 
Example 3
@Override
protected void setUp() throws Exception {
  super.setUp();

  final UIManagerModule mUIManager =
      new UIManagerModule(
          getContext(), new ArrayList<ViewManager>(), 0);

  mAssertModule = new AssertModule();

  mInstance = ReactTestHelper.catalystInstanceBuilder(this)
      .addNativeModule(mAssertModule)
      .addNativeModule(new DeviceInfoModule(getContext()))
      .addNativeModule(new AppStateModule(getContext()))
      .addNativeModule(new FakeWebSocketModule())
      .addNativeModule(mUIManager)
      .addNativeModule(new TestModule())
      .build();
}
 
Example 4
Source Project: react-native-GPay   Source File: ViewRenderingTestCase.java    License: MIT License 5 votes vote down vote up
@Override
protected void setUp() throws Exception {
  super.setUp();

  List<ViewManager> viewManagers = Arrays.<ViewManager>asList(new ReactViewManager());
  final UIManagerModule uiManager =
      new UIManagerModule(getContext(), viewManagers, 0);
  UiThreadUtil.runOnUiThread(
      new Runnable() {
        @Override
        public void run() {
          uiManager.onHostResume();
        }
      });
  waitForIdleSync();

  mCatalystInstance = ReactTestHelper.catalystInstanceBuilder(this)
      .addNativeModule(uiManager)
      .addNativeModule(new AndroidInfoModule(getContext()))
      .addNativeModule(new DeviceInfoModule(getContext()))
      .addNativeModule(new AppStateModule(getContext()))
      .addNativeModule(new FakeWebSocketModule())
      .build();

  mRootView = new ReactRootView(getContext());
  mRootTag = uiManager.addRootView(mRootView);
}
 
Example 5
Source Project: react-native-smart-barcode   Source File: RCTCapturePackage.java    License: MIT License 5 votes vote down vote up
@Override
        public List<ViewManager> createViewManagers(ReactApplicationContext reactApplicationContext) {
            //noinspection ArraysAsListWithZeroOrOneArgument

//            return Arrays.<ViewManager>asList(captureManager,linearGradientViewManager);
            return Arrays.<ViewManager>asList(captureManager);
        }
 
Example 6
Source Project: react-native-GPay   Source File: CompositeReactPackageTest.java    License: MIT License 5 votes vote down vote up
@Test
public void testThatCompositeReturnsASumOfViewManagers() {
  // Given
  CompositeReactPackage composite = new CompositeReactPackage(packageNo1, packageNo2);

  ViewManager managerNo1 = mock(ViewManager.class);
  when(managerNo1.getName()).thenReturn("ManagerNo1");

  // managerNo2 and managerNo3 will share same name, composite should return only the latter one
  final String sameModuleName = "SameModuleName";

  ViewManager managerNo2 = mock(ViewManager.class);
  when(managerNo2.getName()).thenReturn(sameModuleName);

  ViewManager managerNo3 = mock(ViewManager.class);
  when(managerNo3.getName()).thenReturn(sameModuleName);

  ViewManager managerNo4 = mock(ViewManager.class);
  when(managerNo4.getName()).thenReturn("ManagerNo4");

  when(packageNo1.createViewManagers(reactContext)).thenReturn(
      Arrays.asList(new ViewManager[]{managerNo1, managerNo2}));

  when(packageNo2.createViewManagers(reactContext)).thenReturn(
      Arrays.asList(new ViewManager[]{managerNo3, managerNo4}));

  // When
  List<ViewManager> compositeModules = composite.createViewManagers(reactContext);

  // Then

  // Wrapping lists into sets to be order-independent.
  // Note that there should be no managerNo2 returned.
  Set<ViewManager> expected = new HashSet<>(
      Arrays.asList(new ViewManager[]{managerNo1, managerNo3, managerNo4})
  );
  Set<ViewManager> actual = new HashSet<>(compositeModules);

  assertEquals(expected, actual);
}
 
Example 7
@Override
public List<ViewManager> createViewManagers(ReactApplicationContext reactContext) {
    return Arrays.<ViewManager>asList(
        new BarChartManager(),
        new BubbleChartManager(),
        new CandleStickChartManager(),
        new LineChartManager(),
        new PieChartManager(),
        new RadarChartManager(),
        new ScatterChartManager()
    );
}
 
Example 8
Source Project: react-native-GPay   Source File: TextInputTest.java    License: MIT License 5 votes vote down vote up
public UIManagerModule getUIManagerModule() {
  ReactApplicationContext reactContext = ReactTestHelper.createCatalystContextForTest();
  List<ViewManager> viewManagers = Arrays.asList(
      new ViewManager[] {
          new ReactTextInputManager(),
      });
  UIManagerModule uiManagerModule =
      new UIManagerModule(reactContext, viewManagers, 0);
  uiManagerModule.onHostResume();
  return uiManagerModule;
}
 
Example 9
@Override
public List<ViewManager> createViewManagers(ReactApplicationContext reactContext) {
    return Arrays.<ViewManager>asList(
        new PjSipRemoteVideoViewManager(),
        new PjSipPreviewVideoViewManager()
    );
}
 
Example 10
Source Project: react-native-web3-webview   Source File: Web3WebviewPackage.java    License: MIT License 5 votes vote down vote up
@Override
public List<ViewManager> createViewManagers(
        ReactApplicationContext reactContext) {
    return Collections.<ViewManager>singletonList(
            new Web3WebviewManager(reactContext,this)
    );
}
 
Example 11
@Override
public List<ViewManager> createViewManagers(ReactApplicationContext reactContext) {
    List<ViewManager> modules = new ArrayList<>();
    modules.add(new RNShineButton());

    return modules;
}
 
Example 12
Source Project: react-native-GPay   Source File: CatalystUIManagerTestCase.java    License: MIT License 5 votes vote down vote up
@Override
protected void setUp() throws Exception {
  super.setUp();

  List<ViewManager> viewManagers = Arrays.<ViewManager>asList(
      new ReactViewManager(),
      new ReactTextViewManager(),
      new ReactRawTextManager());
  uiManager =
      new UIManagerModule(getContext(), viewManagers, 0);
  UiThreadUtil.runOnUiThread(new Runnable() {
    @Override
    public void run() {
      uiManager.onHostResume();
    }
  });
  waitForIdleSync();

  jsModule = ReactTestHelper.catalystInstanceBuilder(this)
      .addNativeModule(uiManager)
      .addNativeModule(new AndroidInfoModule(getContext()))
      .addNativeModule(new DeviceInfoModule(getContext()))
      .addNativeModule(new AppStateModule(getContext()))
      .addNativeModule(new FakeWebSocketModule())
      .build()
      .getJSModule(UIManagerTestModule.class);
}
 
Example 13
Source Project: react-native-video   Source File: ReactVideoPackage.java    License: MIT License 5 votes vote down vote up
@Override
public List<ViewManager> createViewManagers(ReactApplicationContext reactContext) {
    if (config == null) {
        config = new DefaultReactExoplayerConfig(reactContext);
    }
    return Collections.singletonList(new ReactExoplayerViewManager(config));
}
 
Example 14
@Override
protected void setUp() throws Exception {
  super.setUp();

  List<ViewManager> viewManagers = Arrays.<ViewManager>asList(
      new ReactViewManager());
  final UIManagerModule mUIManager =
      new UIManagerModule(getContext(), viewManagers, 0);
  UiThreadUtil.runOnUiThread(
      new Runnable() {
        @Override
        public void run() {
          mUIManager.onHostResume();
        }
      });
  waitForIdleSync();

  mAssertModule = new AssertModule();

  mInstance = ReactTestHelper.catalystInstanceBuilder(this)
      .addNativeModule(mAssertModule)
      .addNativeModule(new DeviceInfoModule(getContext()))
      .addNativeModule(new AppStateModule(getContext()))
      .addNativeModule(new FakeWebSocketModule())
      .addNativeModule(mUIManager)
      .build();
}
 
Example 15
@Override
public List<ViewManager> createViewManagers(ReactApplicationContext reactContext) {
    return Arrays.<ViewManager>asList(
            new BrightcovePlayerManager(reactContext),
            new BrightcovePlayerPosterManager(reactContext)
    );
}
 
Example 16
Source Project: react-native-android-kit   Source File: RNAKPackage.java    License: MIT License 5 votes vote down vote up
@Override
public List<ViewManager> createViewManagers(ReactApplicationContext reactApplicationContext) {
	return Arrays.<ViewManager>asList(
			new ButtonManager(),
			new FabManager(),
			new TabLayoutManager()
	);
}
 
Example 17
Source Project: react-native-speech   Source File: speechModulePackage.java    License: MIT License 4 votes vote down vote up
@Override
public List<ViewManager> createViewManagers(ReactApplicationContext reactContext) {
    return Collections.emptyList();
}
 
Example 18
@Override
public List<ViewManager> createViewManagers(ReactApplicationContext reactContext) {
  return Collections.emptyList();
}
 
Example 19
@Override
public List<ViewManager> createViewManagers(ReactApplicationContext reactContext) {
    return Arrays.<ViewManager>asList(new RNArcGISMapViewManager());
}
 
Example 20
Source Project: rn-range-slider   Source File: RangeSliderPackage.java    License: MIT License 4 votes vote down vote up
@Override
public List<ViewManager> createViewManagers(ReactApplicationContext reactContext) {
    List<ViewManager> viewManagers = new ArrayList<>();
    viewManagers.add(new RangeSliderViewManager());
    return viewManagers;
}
 
Example 21
@Override
public List<ViewManager> createViewManagers(ReactApplicationContext reactContext) {
    return Arrays.<ViewManager>asList(new RNTShadowViewManager());
}
 
Example 22
@Override
public List<ViewManager> createViewManagers(ReactApplicationContext reactContext) {
    return Collections.emptyList();
}
 
Example 23
@Override
public List<ViewManager> createViewManagers(ReactApplicationContext reactContext) {
    return Collections.emptyList();
}
 
Example 24
Source Project: react-native-scratch   Source File: ScratchViewPackage.java    License: MIT License 4 votes vote down vote up
@Override
public List<ViewManager> createViewManagers(ReactApplicationContext reactContext) {
    return Arrays.<ViewManager>asList(new RNTScratchViewManager());
}
 
Example 25
@Override
public List<ViewManager> createViewManagers(ReactApplicationContext reactContext) {
    return Arrays.<ViewManager>asList(
            new BlurryOverlayManager(mActivity)
    );
}
 
Example 26
Source Project: react-native-audioplayer   Source File: RNAudioPlayer.java    License: MIT License 4 votes vote down vote up
@Override
public List<ViewManager> createViewManagers(ReactApplicationContext reactContext) {
  return Collections.emptyList();
}
 
Example 27
Source Project: react-native-tcp-socket   Source File: TcpSocketPackage.java    License: MIT License 4 votes vote down vote up
@Override
public @NonNull List<ViewManager> createViewManagers(@NonNull ReactApplicationContext reactContext) {
    return Collections.emptyList();
}
 
Example 28
Source Project: react-native-idfa   Source File: IDFAPackage.java    License: MIT License 4 votes vote down vote up
@Override
public List<ViewManager> createViewManagers(ReactApplicationContext reactContext) {
    return Collections.emptyList();
}
 
Example 29
@Override
public List<ViewManager> createViewManagers(ReactApplicationContext reactContext) {
    return Collections.emptyList();
}
 
Example 30
@Override
public List<ViewManager> createViewManagers(ReactApplicationContext context) {
    return Collections.emptyList();
}
 
Example 31
Source Project: react-native-get-real-path   Source File: RNGRPPackage.java    License: MIT License 4 votes vote down vote up
@Override
public List<ViewManager> createViewManagers(ReactApplicationContext reactContext) {
  return Arrays.<ViewManager>asList();
}
 
Example 32
Source Project: react-native-exit-app   Source File: RNExitAppPackage.java    License: MIT License 4 votes vote down vote up
@Override
public List<ViewManager> createViewManagers(
        ReactApplicationContext reactContext) {
    return Collections.emptyList();
}
 
Example 33
Source Project: dingo   Source File: PIPVideoPlayerPackage.java    License: GNU General Public License v3.0 4 votes vote down vote up
@Override
public List<ViewManager> createViewManagers(ReactApplicationContext reactContext) {
    return Collections.emptyList();
}
 
Example 34
@NonNull
@Override
public List<ViewManager> createViewManagers(@NonNull ReactApplicationContext reactContext) {
    return Collections.emptyList();
}
 
Example 35
Source Project: react-native-batch-push   Source File: RNBatchPackage.java    License: MIT License 4 votes vote down vote up
@Override
public List<ViewManager> createViewManagers(ReactApplicationContext reactContext) {
  return Collections.emptyList();
}
 
Example 36
Source Project: ReactNativeDropdownAndroid   Source File: DropdownPackage.java    License: MIT License 4 votes vote down vote up
@Override
public List<ViewManager> createViewManagers(ReactApplicationContext reactApplicationContext) {
    return Arrays.<ViewManager>asList(
            new DropdownManager()
    );
}
 
Example 37
Source Project: react-native-android-voice   Source File: VoicePackage.java    License: MIT License 4 votes vote down vote up
@Override
public List<ViewManager> createViewManagers(ReactApplicationContext reactApplicationContext) {
    return Collections.emptyList();
}
 
Example 38
@Override
public List<ViewManager> createViewManagers(ReactApplicationContext reactContext) {
    return Collections.emptyList();
}
 
Example 39
@Override
public List<ViewManager> createViewManagers(ReactApplicationContext reactContext) {
  return Collections.emptyList();
}
 
Example 40
Source Project: things-notification   Source File: NotificationPackage.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public List<ViewManager> createViewManagers(ReactApplicationContext reactContext) {
    return Collections.emptyList();
}