com.facebook.react.uimanager.ViewManager Java Examples
The following examples show how to use
com.facebook.react.uimanager.ViewManager.
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: CatalystNativeJavaToJSReturnValuesTestCase.java From react-native-GPay with MIT License | 6 votes |
@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 #2
Source File: CompositeReactPackage.java From react-native-GPay with MIT License | 6 votes |
/** {@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
Source File: ReactInstanceManager.java From react-native-GPay with MIT License | 6 votes |
/** * 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 #4
Source File: Web3WebviewPackage.java From react-native-web3-webview with MIT License | 5 votes |
@Override public List<ViewManager> createViewManagers( ReactApplicationContext reactContext) { return Collections.<ViewManager>singletonList( new Web3WebviewManager(reactContext,this) ); }
Example #5
Source File: BrightcovePlayerPackage.java From react-native-brightcove-player with MIT License | 5 votes |
@Override public List<ViewManager> createViewManagers(ReactApplicationContext reactContext) { return Arrays.<ViewManager>asList( new BrightcovePlayerManager(reactContext), new BrightcovePlayerPosterManager(reactContext) ); }
Example #6
Source File: MPAndroidChartPackage.java From react-native-mp-android-chart with MIT License | 5 votes |
@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 #7
Source File: CompositeReactPackageTest.java From react-native-GPay with MIT License | 5 votes |
@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 #8
Source File: RCTCapturePackage.java From react-native-smart-barcode with MIT License | 5 votes |
@Override public List<ViewManager> createViewManagers(ReactApplicationContext reactApplicationContext) { //noinspection ArraysAsListWithZeroOrOneArgument // return Arrays.<ViewManager>asList(captureManager,linearGradientViewManager); return Arrays.<ViewManager>asList(captureManager); }
Example #9
Source File: TextInputTest.java From react-native-GPay with MIT License | 5 votes |
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 #10
Source File: PjSipModulePackage.java From react-native-pjsip with GNU General Public License v3.0 | 5 votes |
@Override public List<ViewManager> createViewManagers(ReactApplicationContext reactContext) { return Arrays.<ViewManager>asList( new PjSipRemoteVideoViewManager(), new PjSipPreviewVideoViewManager() ); }
Example #11
Source File: CatalystNativeJavaToJSArgumentsTestCase.java From react-native-GPay with MIT License | 5 votes |
@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 #12
Source File: ViewRenderingTestCase.java From react-native-GPay with MIT License | 5 votes |
@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 #13
Source File: RNAKPackage.java From react-native-android-kit with MIT License | 5 votes |
@Override public List<ViewManager> createViewManagers(ReactApplicationContext reactApplicationContext) { return Arrays.<ViewManager>asList( new ButtonManager(), new FabManager(), new TabLayoutManager() ); }
Example #14
Source File: RNShineButtonPackage.java From react-native-shine-button with Apache License 2.0 | 5 votes |
@Override public List<ViewManager> createViewManagers(ReactApplicationContext reactContext) { List<ViewManager> modules = new ArrayList<>(); modules.add(new RNShineButton()); return modules; }
Example #15
Source File: CatalystUIManagerTestCase.java From react-native-GPay with MIT License | 5 votes |
@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 #16
Source File: ReactVideoPackage.java From react-native-video with MIT License | 5 votes |
@Override public List<ViewManager> createViewManagers(ReactApplicationContext reactContext) { if (config == null) { config = new DefaultReactExoplayerConfig(reactContext); } return Collections.singletonList(new ReactExoplayerViewManager(config)); }
Example #17
Source File: ReactAppTestActivity.java From react-native-GPay with MIT License | 4 votes |
public void loadBundle(ReactInstanceSpecForTest spec, String bundleName, boolean useDevSupport) { mBridgeIdleSignaler = new ReactBridgeIdleSignaler(); final ReactInstanceManagerBuilder builder = ReactTestHelper.getReactTestFactory() .getReactInstanceManagerBuilder() .setApplication(getApplication()) .setBundleAssetName(bundleName); if (!spec.getAlternativeReactPackagesForTest().isEmpty()) { builder.addPackages(spec.getAlternativeReactPackagesForTest()); } else { builder.addPackage(new MainReactPackage()); } builder .addPackage(new InstanceSpecForTestPackage(spec)) // By not setting a JS module name, we force the bundle to be always loaded from // assets, not the devserver, even if dev mode is enabled (such as when testing redboxes). // This makes sense because we never run the devserver in tests. // .setJSMainModuleName() .setUseDeveloperSupport(useDevSupport) .setBridgeIdleDebugListener(mBridgeIdleSignaler) .setInitialLifecycleState(mLifecycleState) .setJSIModulesPackage( new JSIModulePackage() { @Override public List<JSIModuleSpec> getJSIModules( final ReactApplicationContext reactApplicationContext, final JavaScriptContextHolder jsContext) { return Arrays.<JSIModuleSpec>asList( new JSIModuleSpec() { @Override public Class<? extends JSIModule> getJSIModuleClass() { return UIManager.class; } @Override public JSIModuleProvider getJSIModuleProvider() { return new JSIModuleProvider() { @Override public FabricUIManager get() { List<ViewManager> viewManagers = mReactInstanceManager.getOrCreateViewManagers( reactApplicationContext); EventDispatcher eventDispatcher = reactApplicationContext .getNativeModule(UIManagerModule.class) .getEventDispatcher(); FabricUIManager fabricUIManager = new FabricUIManager( reactApplicationContext, new ViewManagerRegistry(viewManagers), jsContext, eventDispatcher); new FabricJSCBinding().installFabric(jsContext, fabricUIManager); return fabricUIManager; } }; } }); } }); final CountDownLatch latch = new CountDownLatch(1); runOnUiThread( new Runnable() { @Override public void run() { mReactInstanceManager = builder.build(); mReactInstanceManager.onHostResume( ReactAppTestActivity.this, ReactAppTestActivity.this); latch.countDown(); } }); try { latch.await(1000, TimeUnit.MILLISECONDS); } catch (InterruptedException e) { throw new RuntimeException( "ReactInstanceManager never finished initializing " + bundleName, e); } }
Example #18
Source File: FusedLocationPackage.java From react-native-fused-location with MIT License | 4 votes |
@Override public List<ViewManager> createViewManagers(ReactApplicationContext reactContext) { return Collections.emptyList(); }
Example #19
Source File: RNX5WebViewPackage.java From react-native-x5 with MIT License | 4 votes |
@Override public List<ViewManager> createViewManagers(ReactApplicationContext reactContext) { List<ViewManager> modules = new ArrayList<>(); modules.add(new RNX5WebViewManager(reactContext)); return modules; }
Example #20
Source File: InCallManagerPackage.java From react-native-incall-manager with ISC License | 4 votes |
@Override public List<ViewManager> createViewManagers(ReactApplicationContext reactContext) { return Collections.emptyList(); }
Example #21
Source File: MainApplication.java From react-native-screens with MIT License | 4 votes |
@Override public List<ViewManager> createViewManagers(ReactApplicationContext reactContext) { return Arrays.<ViewManager>asList(new SampleLifecycleAwareViewManager()); }
Example #22
Source File: SyncUiImplementation.java From react-native-navigation with MIT License | 4 votes |
public SyncUiImplementation(ReactApplicationContext reactContext, List<ViewManager> viewManagerList, EventDispatcher eventDispatcher, int minTimeLeftInFrameForNonBatchedOperationMs) { super(reactContext, viewManagerList, eventDispatcher, minTimeLeftInFrameForNonBatchedOperationMs); }
Example #23
Source File: RNAppAuthPackage.java From react-native-app-auth with MIT License | 4 votes |
@Override public List<ViewManager> createViewManagers(ReactApplicationContext reactContext) { return Collections.emptyList(); }
Example #24
Source File: FIRAnalyticsPackage.java From react-native-firebase-analytics with MIT License | 4 votes |
@Override public List<ViewManager> createViewManagers(ReactApplicationContext reactContext) { return Arrays.<ViewManager>asList(); }
Example #25
Source File: RNDetectNavbarAndroidPackage.java From react-native-detect-navbar-android with MIT License | 4 votes |
@Override public List<ViewManager> createViewManagers(ReactApplicationContext reactContext) { return Arrays.<ViewManager>asList(); }
Example #26
Source File: BraintreePackage.java From react-native-braintree-android with MIT License | 4 votes |
@Override public List<ViewManager> createViewManagers(ReactApplicationContext reactContext) { return Collections.emptyList(); }
Example #27
Source File: BeaconsAndroidPackage.java From react-native-beacons-android with MIT License | 4 votes |
@Override public List<ViewManager> createViewManagers(ReactApplicationContext reactContext) { return new ArrayList<>(); }
Example #28
Source File: UdpSocketsModule.java From react-native-udp with MIT License | 4 votes |
@Override public List<ViewManager> createViewManagers( ReactApplicationContext reactContext) { return Collections.emptyList(); }
Example #29
Source File: ReactAztecPackage.java From react-native-aztec with GNU General Public License v2.0 | 4 votes |
@Override public List<ViewManager> createViewManagers(ReactApplicationContext reactContext) { List<ViewManager> views = new ArrayList<>(); views.add(new ReactAztecManager()); return views; }
Example #30
Source File: RNAudioPlayerPackage.java From react-native-audio-streaming-player with MIT License | 4 votes |
@Override public List<ViewManager> createViewManagers( ReactApplicationContext reactContext) { return Collections.emptyList(); }