com.facebook.react.views.view.ReactViewManager Java Examples
The following examples show how to use
com.facebook.react.views.view.ReactViewManager.
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: MainReactPackage.java From react-native-gcm-android with MIT License | 6 votes |
@Override public List<ViewManager> createViewManagers(ReactApplicationContext reactContext) { return Arrays.<ViewManager>asList( new ReactDrawerLayoutManager(), new ReactHorizontalScrollViewManager(), new ReactImageManager(), new ReactProgressBarViewManager(), new ReactRawTextManager(), new ReactScrollViewManager(), new ReactSwitchManager(), new ReactTextInputManager(), new ReactTextViewManager(), new ReactToolbarManager(), new ReactViewManager(), new ReactViewPagerManager(), new ReactTextInlineImageViewManager(), new ReactVirtualTextViewManager(), new SwipeRefreshLayoutManager(), new ReactWebViewManager()); }
Example #2
Source File: UIManagerModuleTest.java From react-native-GPay with MIT License | 6 votes |
/** * Makes sure replaceExistingNonRootView by replacing a view with a new view that has a background * color set. */ @Test public void testReplaceExistingNonRootView() { UIManagerModule uiManager = getUIManagerModule(); TestMoveDeleteHierarchy hierarchy = createMoveDeleteHierarchy(uiManager); int newViewTag = 1234; uiManager.createView( newViewTag, ReactViewManager.REACT_CLASS, hierarchy.rootView, JavaOnlyMap.of("backgroundColor", Color.RED)); uiManager.replaceExistingNonRootView(hierarchy.view2, newViewTag); uiManager.onBatchComplete(); executePendingFrameCallbacks(); assertThat(hierarchy.nativeRootView.getChildCount()).isEqualTo(4); assertThat(hierarchy.nativeRootView.getChildAt(2)).isInstanceOf(ReactViewGroup.class); ReactViewGroup view = (ReactViewGroup) hierarchy.nativeRootView.getChildAt(2); assertThat(view.getBackgroundColor()).isEqualTo(Color.RED); }
Example #3
Source File: FabricUIManagerTest.java From react-native-GPay with MIT License | 6 votes |
@Test public void testSealReactShadowNode() { ReactRootView rootView = new ReactRootView(RuntimeEnvironment.application.getApplicationContext()); int rootTag = mFabricUIManager.addRootView(rootView); String viewClass = ReactViewManager.REACT_CLASS; ReactShadowNode container = mFabricUIManager.createNode(6, viewClass, rootTag, null, randomInstanceHandle()); List<ReactShadowNode> childSet = mFabricUIManager.createChildSet(rootTag); mFabricUIManager.appendChildToSet(childSet, container); assertThat(container.isSealed()).isFalse(); mFabricUIManager.completeRoot(rootTag, childSet); assertThat(container.isSealed()).isTrue(); }
Example #4
Source File: FabricUIManagerTest.java From react-native-GPay with MIT License | 5 votes |
/** * Verifies that the reconciliation phase will always set the originalNode field of every node in * the tree to null once completeRoot has finished to prevent memory leaks. */ @Test public void testRemoveOriginalNodeReferences() { ReactRootView rootView = new ReactRootView(RuntimeEnvironment.application.getApplicationContext()); int rootTag = mFabricUIManager.addRootView(rootView); String viewClass = ReactViewManager.REACT_CLASS; ReactShadowNode aa = mFabricUIManager.createNode(2, viewClass, rootTag, null, randomInstanceHandle()); ReactShadowNode a = mFabricUIManager.createNode(3, viewClass, rootTag, null, randomInstanceHandle()); mFabricUIManager.appendChild(a, aa); ReactShadowNode bb = mFabricUIManager.createNode(4, viewClass, rootTag, null, randomInstanceHandle()); ReactShadowNode b = mFabricUIManager.createNode(5, viewClass, rootTag, null, randomInstanceHandle()); mFabricUIManager.appendChild(b, bb); ReactShadowNode container = mFabricUIManager.createNode(6, viewClass, rootTag, null, randomInstanceHandle()); mFabricUIManager.appendChild(container, a); mFabricUIManager.appendChild(container, b); List<ReactShadowNode> childSet = mFabricUIManager.createChildSet(rootTag); mFabricUIManager.appendChildToSet(childSet, container); mFabricUIManager.completeRoot(rootTag, childSet); ReactShadowNode aaClone = mFabricUIManager.cloneNodeWithNewProps(aa, null); ReactShadowNode aClone = mFabricUIManager.cloneNodeWithNewChildren(a); mFabricUIManager.appendChild(aClone, aaClone); ReactShadowNode containerClone = mFabricUIManager.cloneNodeWithNewChildren(container); mFabricUIManager.appendChild(containerClone, b); mFabricUIManager.appendChild(containerClone, aClone); List<ReactShadowNode> childSet2 = mFabricUIManager.createChildSet(rootTag); mFabricUIManager.appendChildToSet(childSet2, containerClone); mFabricUIManager.completeRoot(rootTag, childSet2); ReactShadowNode[] nodes = new ReactShadowNode[] {aa, a, bb, b, container, aaClone, aClone, containerClone}; for (ReactShadowNode node : nodes) { assertThat(node.getOriginalReactShadowNode()).isNull(); } }
Example #5
Source File: UIManagerModuleTest.java From react-native-GPay with MIT License | 5 votes |
private UIManagerModule getUIManagerModule() { List<ViewManager> viewManagers = Arrays.<ViewManager>asList( new ReactViewManager(), new ReactTextViewManager(), new ReactRawTextManager()); UIManagerModule uiManagerModule = new UIManagerModule(mReactContext, viewManagers, 0); uiManagerModule.onHostResume(); return uiManagerModule; }
Example #6
Source File: UIManagerModuleTest.java From react-native-GPay with MIT License | 5 votes |
@Test public void testAddAndRemoveAnimation() { UIManagerModule uiManagerModule = getUIManagerModule(); TestMoveDeleteHierarchy hierarchy = createMoveDeleteHierarchy(uiManagerModule); AnimationPropertyUpdater mockPropertyUpdater = mock(AnimationPropertyUpdater.class); Animation mockAnimation = spy(new AnimationStub(1000, mockPropertyUpdater)); Callback callbackMock = mock(Callback.class); int rootTag = hierarchy.rootView; uiManagerModule.createView( hierarchy.rootView, ReactViewManager.REACT_CLASS, rootTag, JavaOnlyMap.of("collapsable", false)); uiManagerModule.registerAnimation(mockAnimation); uiManagerModule.addAnimation(hierarchy.rootView, 1000, callbackMock); uiManagerModule.removeAnimation(hierarchy.rootView, 1000); uiManagerModule.onBatchComplete(); executePendingFrameCallbacks(); verify(callbackMock, times(1)).invoke(false); verify(mockAnimation).run(); verify(mockAnimation).cancel(); }
Example #7
Source File: UIManagerModuleTest.java From react-native-GPay with MIT License | 5 votes |
@Test public void testLayoutPropertyUpdatingOnlyOnLayoutChange() { UIManagerModule uiManager = getUIManagerModule(); TestMoveDeleteHierarchy hierarchy = createMoveDeleteHierarchy(uiManager); // Update layout to some values, this way we can verify it hasn't been updated, because the // update process would normally reset it back to some non-negative value View view0 = hierarchy.nativeRootView.getChildAt(0); view0.layout(1, 2, 3, 4); // verify that X get updated when we update layout properties uiManager.updateView( hierarchy.view0, ReactViewManager.REACT_CLASS, JavaOnlyMap.of("left", 10.0, "top", 20.0, "width", 30.0, "height", 40.0)); uiManager.onBatchComplete(); executePendingFrameCallbacks(); assertThat(view0.getLeft()).isGreaterThan(2); // verify that the layout doesn't get updated when we update style property not affecting the // position (e.g., background-color) view0.layout(1, 2, 3, 4); uiManager.updateView( hierarchy.view0, ReactViewManager.REACT_CLASS, JavaOnlyMap.of("backgroundColor", Color.RED)); uiManager.onBatchComplete(); executePendingFrameCallbacks(); assertThat(view0.getLeft()).isEqualTo(1); }
Example #8
Source File: UIManagerModuleTest.java From react-native-GPay with MIT License | 5 votes |
/** * This is to make sure we execute enqueued operations in the order given by JS. */ @Test public void testAddUpdateRemoveInSingleBatch() { UIManagerModule uiManager = getUIManagerModule(); TestMoveDeleteHierarchy hierarchy = createMoveDeleteHierarchy(uiManager); int newViewTag = 10000; uiManager.createView( newViewTag, ReactViewManager.REACT_CLASS, hierarchy.rootView, JavaOnlyMap.of("collapsable", false)); uiManager.manageChildren( hierarchy.rootView, null, null, JavaOnlyArray.of(newViewTag), JavaOnlyArray.of(4), null); uiManager.updateView( newViewTag, ReactViewManager.REACT_CLASS, JavaOnlyMap.of("backgroundColor", Color.RED)); uiManager.manageChildren( hierarchy.rootView, null, null, null, null, JavaOnlyArray.of(4)); uiManager.onBatchComplete(); executePendingFrameCallbacks(); assertThat(hierarchy.nativeRootView.getChildCount()).isEqualTo(4); }
Example #9
Source File: UIManagerModuleTest.java From react-native-GPay with MIT License | 5 votes |
@Test public void testLayoutAppliedToNodes() throws Exception { UIManagerModule uiManager = getUIManagerModule(); TestMoveDeleteHierarchy hierarchy = createMoveDeleteHierarchy(uiManager); int newViewTag = 10000; uiManager.createView( newViewTag, ReactViewManager.REACT_CLASS, hierarchy.rootView, JavaOnlyMap .of("left", 10.0, "top", 20.0, "width", 30.0, "height", 40.0, "collapsable", false)); uiManager.manageChildren( hierarchy.rootView, null, null, JavaOnlyArray.of(newViewTag), JavaOnlyArray.of(4), null); uiManager.onBatchComplete(); executePendingFrameCallbacks(); View newView = hierarchy.nativeRootView.getChildAt(4); assertThat(newView.getLeft()).isEqualTo(10); assertThat(newView.getTop()).isEqualTo(20); assertThat(newView.getWidth()).isEqualTo(30); assertThat(newView.getHeight()).isEqualTo(40); }
Example #10
Source File: ProgressBarTestCase.java From progress-bar-android with MIT License | 5 votes |
@Override protected void setUp() throws Exception { super.setUp(); List<ViewManager> viewManagers = Arrays.<ViewManager>asList( new ReactViewManager(), new ReactProgressBarViewManager()); mUIManager = new UIManagerModule(getContext(), viewManagers, 0); UiThreadUtil.runOnUiThread( new Runnable() { @Override public void run() { mUIManager.onHostResume(); } }); waitForIdleSync(); mInstance = ReactTestHelper.catalystInstanceBuilder(this) .addNativeModule(mUIManager) .addNativeModule(new AndroidInfoModule(getContext())) .addNativeModule(new DeviceInfoModule(getContext())) .addNativeModule(new AppStateModule(getContext())) .addNativeModule(new FakeWebSocketModule()) .build(); mRootView = new ReactRootView(getContext()); DisplayMetrics metrics = getContext().getResources().getDisplayMetrics(); mRootView.setLayoutParams( new FrameLayout.LayoutParams(metrics.widthPixels, metrics.heightPixels)); int rootTag = mUIManager.addRootView(mRootView); mInstance.getJSModule(ProgressBarTestModule.class).renderProgressBarApplication(rootTag); waitForBridgeAndUIIdle(); }
Example #11
Source File: FabricUIManagerTest.java From react-native-GPay with MIT License | 5 votes |
private int createAndRenderRootView() { ReactRootView rootView = new ReactRootView(RuntimeEnvironment.application.getApplicationContext()); int rootTag = mFabricUIManager.addRootView(rootView); int reactTag = mNextReactTag++; String viewClass = ReactViewManager.REACT_CLASS; ReactShadowNode node = mFabricUIManager.createNode(reactTag, viewClass, rootTag, null, randomInstanceHandle()); List<ReactShadowNode> childSet = mFabricUIManager.createChildSet(rootTag); mFabricUIManager.appendChildToSet(childSet, node); mFabricUIManager.completeRoot(rootTag, childSet); return rootTag; }
Example #12
Source File: FabricUIManagerTest.java From react-native-GPay with MIT License | 5 votes |
@Test public void testCreateNode() { ReactRootView rootView = new ReactRootView(RuntimeEnvironment.application.getApplicationContext()); int rootTag = mFabricUIManager.addRootView(rootView); int reactTag = mNextReactTag++; String viewClass = ReactViewManager.REACT_CLASS; ReactShadowNode node = mFabricUIManager.createNode(reactTag, viewClass, rootTag, null, randomInstanceHandle()); assertThat(reactTag).isEqualTo(node.getReactTag()); assertThat(viewClass).isEqualTo(node.getViewClass()); assertThat(rootTag).isEqualTo(rootTag); }
Example #13
Source File: FabricUIManagerTest.java From react-native-GPay with MIT License | 5 votes |
@Before public void setUp() throws Exception { mNextReactTag = 2; ReactApplicationContext reactContext = new ReactApplicationContext(RuntimeEnvironment.application); reactContext.initializeWithInstance(ReactTestHelper.createMockCatalystInstance()); mThemedReactContext = new ThemedReactContext(reactContext, reactContext); List<ViewManager> viewManagers = Arrays.<ViewManager>asList( new ReactViewManager(), new ReactTextViewManager(), new ReactRawTextManager()); ViewManagerRegistry viewManagerRegistry = new ViewManagerRegistry(viewManagers); JavaScriptContextHolder jsContext = mock(JavaScriptContextHolder.class); EventDispatcher eventDispatcher = mock(EventDispatcher.class); mFabricUIManager = new FabricUIManager(reactContext, viewManagerRegistry, jsContext, eventDispatcher); }
Example #14
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 #15
Source File: JSLocaleTest.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() { ReactChoreographer.initialize(); mUIManager.onHostResume(); } }); waitForIdleSync(); mStringRecordingModule = new StringRecordingModule(); mInstance = ReactTestHelper.catalystInstanceBuilder(this) .addNativeModule(mStringRecordingModule) .addNativeModule(mUIManager) .addNativeModule(new DeviceInfoModule(getContext())) .addNativeModule(new AppStateModule(getContext())) .addNativeModule(new FakeWebSocketModule()) .build(); }
Example #16
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 #17
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 #18
Source File: ProgressBarTestCase.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 ReactProgressBarViewManager()); mUIManager = new UIManagerModule(getContext(), viewManagers, 0); UiThreadUtil.runOnUiThread( new Runnable() { @Override public void run() { mUIManager.onHostResume(); } }); waitForIdleSync(); mInstance = ReactTestHelper.catalystInstanceBuilder(this) .addNativeModule(mUIManager) .addNativeModule(new AndroidInfoModule(getContext())) .addNativeModule(new DeviceInfoModule(getContext())) .addNativeModule(new AppStateModule(getContext())) .addNativeModule(new FakeWebSocketModule()) .build(); mRootView = new ReactRootView(getContext()); DisplayMetrics metrics = getContext().getResources().getDisplayMetrics(); mRootView.setLayoutParams( new FrameLayout.LayoutParams(metrics.widthPixels, metrics.heightPixels)); int rootTag = mUIManager.addRootView(mRootView); mInstance.getJSModule(ProgressBarTestModule.class).renderProgressBarApplication(rootTag); waitForBridgeAndUIIdle(); }
Example #19
Source File: CatalystNativeJSToJavaParametersTestCase.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(); mRecordingTestModule = new RecordingTestModule(); mCatalystInstance = ReactTestHelper.catalystInstanceBuilder(this) .addNativeModule(mRecordingTestModule) .addNativeModule(new AndroidInfoModule(getContext())) .addNativeModule(new DeviceInfoModule(getContext())) .addNativeModule(new AppStateModule(getContext())) .addNativeModule(new FakeWebSocketModule()) .addNativeModule(mUIManager) .build(); }
Example #20
Source File: MainReactPackage.java From react-native-GPay with MIT License | 5 votes |
@Override public List<ViewManager> createViewManagers(ReactApplicationContext reactContext) { List<ViewManager> viewManagers = new ArrayList<>(); viewManagers.add(ARTRenderableViewManager.createARTGroupViewManager()); viewManagers.add(ARTRenderableViewManager.createARTShapeViewManager()); viewManagers.add(ARTRenderableViewManager.createARTTextViewManager()); viewManagers.add(new ReactCheckBoxManager()); viewManagers.add(new ReactDialogPickerManager()); viewManagers.add(new ReactDrawerLayoutManager()); viewManagers.add(new ReactDropdownPickerManager()); viewManagers.add(new ReactHorizontalScrollViewManager()); viewManagers.add(new ReactHorizontalScrollContainerViewManager()); viewManagers.add(new ReactProgressBarViewManager()); viewManagers.add(new ReactScrollViewManager()); viewManagers.add(new ReactSliderManager()); viewManagers.add(new ReactSwitchManager()); viewManagers.add(new ReactToolbarManager()); viewManagers.add(new ReactWebViewManager()); viewManagers.add(new SwipeRefreshLayoutManager()); // Native equivalents viewManagers.add(new ARTSurfaceViewManager()); viewManagers.add(new FrescoBasedReactTextInlineImageViewManager()); viewManagers.add(new ReactImageManager()); viewManagers.add(new ReactModalHostManager()); viewManagers.add(new ReactRawTextManager()); viewManagers.add(new ReactTextInputManager()); viewManagers.add(new ReactTextViewManager()); viewManagers.add(new ReactViewManager()); viewManagers.add(new ReactViewPagerManager()); viewManagers.add(new ReactVirtualTextViewManager()); return viewManagers; }
Example #21
Source File: FabricUIManagerTest.java From react-native-GPay with MIT License | 4 votes |
private ReactShadowNode createViewNode() { ReactShadowNode node = new ReactShadowNodeImpl(); node.setViewClassName(ReactViewManager.REACT_CLASS); node.setThemedContext(mThemedReactContext); return node; }
Example #22
Source File: UIManagerModuleTest.java From react-native-GPay with MIT License | 4 votes |
@Test public void testHierarchyWithView() { UIManagerModule uiManager = getUIManagerModule(); ReactRootView rootView = new ReactRootView(RuntimeEnvironment.application.getApplicationContext()); int rootTag = uiManager.addRootView(rootView); int viewTag = rootTag + 1; int subViewTag = viewTag + 1; uiManager.createView( viewTag, ReactViewManager.REACT_CLASS, rootTag, JavaOnlyMap.of("collapsable", false)); uiManager.createView( subViewTag, ReactViewManager.REACT_CLASS, rootTag, JavaOnlyMap.of("collapsable", false)); uiManager.manageChildren( viewTag, null, null, JavaOnlyArray.of(subViewTag), JavaOnlyArray.of(0), null); uiManager.manageChildren( rootTag, null, null, JavaOnlyArray.of(viewTag), JavaOnlyArray.of(0), null); uiManager.onBatchComplete(); executePendingFrameCallbacks(); assertThat(rootView.getChildCount()).isEqualTo(1); ViewGroup child = (ViewGroup) rootView.getChildAt(0); assertThat(child.getChildCount()).isEqualTo(1); ViewGroup grandchild = (ViewGroup) child.getChildAt(0); assertThat(grandchild).isInstanceOf(ViewGroup.class); assertThat(grandchild.getChildCount()).isEqualTo(0); }
Example #23
Source File: UIManagerModuleTest.java From react-native-GPay with MIT License | 4 votes |
/** * Verifies removeSubviewsFromContainerWithID works by adding subviews, removing them, and * checking that the final number of children is correct. */ @Test public void testRemoveSubviewsFromContainerWithID() { UIManagerModule uiManager = getUIManagerModule(); ReactRootView rootView = new ReactRootView(RuntimeEnvironment.application.getApplicationContext()); int rootTag = uiManager.addRootView(rootView); final int containerTag = rootTag + 1; final int containerSiblingTag = containerTag + 1; uiManager.createView( containerTag, ReactViewManager.REACT_CLASS, rootTag, JavaOnlyMap.of("collapsable", false)); uiManager.createView( containerSiblingTag, ReactViewManager.REACT_CLASS, rootTag, JavaOnlyMap.of("collapsable", false)); addChild(uiManager, rootTag, containerTag, 0); addChild(uiManager, rootTag, containerSiblingTag, 1); uiManager.createView( containerTag + 2, ReactTextViewManager.REACT_CLASS, rootTag, JavaOnlyMap.of("collapsable", false)); uiManager.createView( containerTag + 3, ReactTextViewManager.REACT_CLASS, rootTag, JavaOnlyMap.of("collapsable", false)); addChild(uiManager, containerTag, containerTag + 2, 0); addChild(uiManager, containerTag, containerTag + 3, 1); uiManager.onBatchComplete(); executePendingFrameCallbacks(); assertThat(rootView.getChildCount()).isEqualTo(2); assertThat(((ViewGroup) rootView.getChildAt(0)).getChildCount()).isEqualTo(2); uiManager.removeSubviewsFromContainerWithID(containerTag); uiManager.onBatchComplete(); executePendingFrameCallbacks(); assertThat(rootView.getChildCount()).isEqualTo(2); assertThat(((ViewGroup) rootView.getChildAt(0)).getChildCount()).isEqualTo(0); }
Example #24
Source File: UIManagerModuleTest.java From react-native-GPay with MIT License | 4 votes |
private TestMoveDeleteHierarchy createMoveDeleteHierarchy(UIManagerModule uiManager) { ReactRootView rootView = new ReactRootView(mReactContext); int rootTag = uiManager.addRootView(rootView); TestMoveDeleteHierarchy hierarchy = new TestMoveDeleteHierarchy(rootView, rootTag); uiManager.createView( hierarchy.view0, ReactViewManager.REACT_CLASS, rootTag, JavaOnlyMap.of("collapsable", false)); uiManager.createView( hierarchy.viewWithChildren1, ReactViewManager.REACT_CLASS, rootTag, JavaOnlyMap.of("collapsable", false)); uiManager.createView( hierarchy.view2, ReactViewManager.REACT_CLASS, rootTag, JavaOnlyMap.of("collapsable", false)); uiManager.createView( hierarchy.view3, ReactViewManager.REACT_CLASS, rootTag, JavaOnlyMap.of("collapsable", false)); uiManager.createView( hierarchy.childView0, ReactViewManager.REACT_CLASS, rootTag, JavaOnlyMap.of("collapsable", false)); uiManager.createView( hierarchy.childView1, ReactViewManager.REACT_CLASS, rootTag, JavaOnlyMap.of("collapsable", false)); addChild(uiManager, rootTag, hierarchy.view0, 0); addChild(uiManager, rootTag, hierarchy.viewWithChildren1, 1); addChild(uiManager, rootTag, hierarchy.view2, 2); addChild(uiManager, rootTag, hierarchy.view3, 3); addChild(uiManager, hierarchy.viewWithChildren1, hierarchy.childView0, 0); addChild(uiManager, hierarchy.viewWithChildren1, hierarchy.childView1, 1); uiManager.onBatchComplete(); executePendingFrameCallbacks(); return hierarchy; }
Example #25
Source File: BaseViewManagerTest.java From react-native-GPay with MIT License | 4 votes |
@Before public void setUp() { mViewManager = new ReactViewManager(); mView = new ReactViewGroup(RuntimeEnvironment.application); }