Java 类com.facebook.react.views.view.ReactViewGroup 实例源码

项目:react-native-andorid-shadow    文件:RNReactNativeAndoridShadowModule.java   
@ReactMethod
    public void applyShadowForView(final Integer tag, final ReadableMap param) {
        Log.d(TAG,"AndroidShadowManager applyShadowForView! tag: " + tag);
        if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) {
            return;
        }
        UIManagerModule uiManager = reactContext.getNativeModule(UIManagerModule.class);
        uiManager.addUIBlock(new UIBlock() {

            @Override
            public void execute(NativeViewHierarchyManager nvhm) {
                ReactViewGroup targetView = (ReactViewGroup) nvhm.resolveView(tag);
                Log.d(TAG,"AndroidShadowManager view w = " + targetView.getWidth() + " h = " + targetView.getHeight());
//                targetView.setBackgroundColor(Color.CYAN);
                targetView.getViewTreeObserver().addOnGlobalLayoutListener(new OutlineAdjuster(targetView,param));

            }
        });
    }
项目:RNLearn_Project1    文件:UIManagerModuleTest.java   
/**
 * 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);
}
项目:RNLearn_Project1    文件:UIManagerModuleTest.java   
/**
 * 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);
}
项目:ReactNativeSignatureExample    文件:UIManagerModuleTest.java   
/**
 * 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();
  executePendingChoreographerCallbacks();

  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);
}
项目:native-navigation    文件:SharedElementViewManager.java   
@Override
public void addView(ReactViewGroup parent, View child, int index) {
  String transitionName = (String) parent.getTag(R.id.react_shared_element_transition_name);
  String instanceId = (String) parent.getTag(R.id.react_shared_element_screen_instance_id);
  ReactInterface component = coordinator.componentFromId(instanceId);

  if (child instanceof ReactImageView) {
    ReactImageView iv = (ReactImageView) child;
    // TODO(lmr): do something to wait for image to load
  }

  ViewCompat.setTransitionName(child, transitionName);
  parent.addView(child, index);

  if (component != null) {
    component.notifySharedElementAddition();
  }
}
项目:react-native-ibeacon-android    文件:UIManagerModuleTest.java   
/**
 * 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();
  executePendingChoreographerCallbacks();

  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);
}
项目:react-native-box-loaders    文件:UIManagerModuleTest.java   
/**
 * 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();
  executePendingChoreographerCallbacks();

  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);
}
项目:Ironman    文件:UIManagerModuleTest.java   
/**
 * 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();
  executePendingChoreographerCallbacks();

  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);
}
项目:RNLearn_Project1    文件:ViewRenderingTestCase.java   
public void testViewRenderedWithCorrectProperties() {
  float expectedOpacity = 0.75f;
  int expectedBackgroundColor = Color.rgb(255, 0, 0);

  mCatalystInstance.getJSModule(ViewRenderingTestModule.class).renderViewApplication(mRootTag);
  waitForBridgeAndUIIdle();

  ReactViewGroup view = getViewAtPath(mRootView);
  assertEquals("Incorrect (or not applied) opacity", expectedOpacity, view.getAlpha());
  assertEquals(
      "Incorrect (or not applied) backgroundColor",
      expectedBackgroundColor,
      view.getBackgroundColor());
}
项目:RNLearn_Project1    文件:ViewRenderingTestCase.java   
public void testViewRenderedWithCorrectProperties() {
  float expectedOpacity = 0.75f;
  int expectedBackgroundColor = Color.rgb(255, 0, 0);

  mCatalystInstance.getJSModule(ViewRenderingTestModule.class).renderViewApplication(mRootTag);
  waitForBridgeAndUIIdle();

  ReactViewGroup view = getViewAtPath(mRootView);
  assertEquals("Incorrect (or not applied) opacity", expectedOpacity, view.getAlpha());
  assertEquals(
      "Incorrect (or not applied) backgroundColor",
      expectedBackgroundColor,
      view.getBackgroundColor());
}
项目:react-native-gesture-handler    文件:RNViewConfigurationHelper.java   
@Override
public View getChildInDrawingOrderAtIndex(ViewGroup parent, int index) {
  if (parent instanceof ReactViewGroup) {
    return parent.getChildAt(((ReactViewGroup) parent).getZIndexMappedChildIndex(index));
  }
  return parent.getChildAt(index);
}
项目:Ironman    文件:ViewRenderingTestCase.java   
public void testViewRenderedWithCorrectProperties() {
  float expectedOpacity = 0.75f;
  int expectedBackgroundColor = Color.rgb(255, 0, 0);

  mCatalystInstance.getJSModule(ViewRenderingTestModule.class).renderViewApplication(mRootTag);
  waitForBridgeAndUIIdle();

  ReactViewGroup view = getViewAtPath(mRootView);
  assertEquals("Incorrect (or not applied) opacity", expectedOpacity, view.getAlpha());
  assertEquals(
      "Incorrect (or not applied) backgroundColor",
      expectedBackgroundColor,
      view.getBackgroundColor());
}
项目:react-native-bottom-sheet-behavior    文件:MergedAppBarLayoutBehavior.java   
private View findTitleTextView(Toolbar toolbar){
    for (int i = 0; i < toolbar.getChildCount(); i++) {
        View toolBarChild = toolbar.getChildAt(i);
        if (toolBarChild instanceof TextView ||
            toolBarChild instanceof ReactViewGroup) {
            return toolBarChild;
        }
    }
    return null;
}
项目:react-native-andorid-shadow    文件:RNReactNativeAndoridShadowModule.java   
public OutlineAdjuster(ReactViewGroup mTargetView, ReadableMap mParam) {
    this.mTargetView = mTargetView;

    this.mParam = mParam;
}
项目:RNLearn_Project1    文件:CatalystSubviewsClippingTestCase.java   
@Override
public ReactViewGroup createViewInstance(ThemedReactContext context) {
  return new ClippableView(context, mEvents);
}
项目:RNLearn_Project1    文件:CatalystSubviewsClippingTestCase.java   
@ReactProp(name = "clippableViewID")
public void setClippableViewId(ReactViewGroup view, @Nullable String clippableViewId) {
  ((ClippableView) view).setClippableViewID(clippableViewId);
}
项目:RNLearn_Project1    文件:CatalystSubviewsClippingTestCase.java   
@Override
public ReactViewGroup createViewInstance(ThemedReactContext context) {
  return new ClippableView(context, mEvents);
}
项目:RNLearn_Project1    文件:CatalystSubviewsClippingTestCase.java   
@ReactProp(name = "clippableViewID")
public void setClippableViewId(ReactViewGroup view, @Nullable String clippableViewId) {
  ((ClippableView) view).setClippableViewID(clippableViewId);
}
项目:native-navigation    文件:SharedElementViewManager.java   
@Override
public ReactViewGroup createViewInstance(ThemedReactContext context) {
  return new ReactViewGroup(context);
}
项目:native-navigation    文件:SharedElementViewManager.java   
@ReactProp(name = "id")
public void setIdentifier(ReactViewGroup view, String id) {
  view.setTag(R.id.react_shared_element_transition_name, id);
}
项目:native-navigation    文件:SharedElementViewManager.java   
@ReactProp(name = "nativeNavigationInstanceId")
public void setInstanceId(ReactViewGroup view, String instanceId) {
  view.setTag(R.id.react_shared_element_screen_instance_id, instanceId);
}
项目:native-navigation    文件:SharedElementGroupManager.java   
@Override
public ReactViewGroup createViewInstance(ThemedReactContext context) {
  return new ReactViewGroup(context);
}
项目:native-navigation    文件:SharedElementGroupManager.java   
@ReactProp(name = "id")
public void setIdentifier(ReactViewGroup view, String id) {
  view.setTag(R.id.react_shared_element_group_id, id);
}
项目:react-native-android-slidingtabstrip    文件:ReactSlidingTabStrip.java   
private ReactViewGroup getTabContainer()
{
    return (ReactViewGroup) getChildAt(0);
}
项目:Ironman    文件:CatalystSubviewsClippingTestCase.java   
@Override
public ReactViewGroup createViewInstance(ThemedReactContext context) {
  return new ClippableView(context, mEvents);
}
项目:Ironman    文件:CatalystSubviewsClippingTestCase.java   
@ReactProp(name = "clippableViewID")
public void setClippableViewId(ReactViewGroup view, @Nullable String clippableViewId) {
  ((ClippableView) view).setClippableViewID(clippableViewId);
}