com.facebook.react.views.view.ReactViewGroup Java Examples

The following examples show how to use com.facebook.react.views.view.ReactViewGroup. 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: SharedElementViewManager.java    From native-navigation with MIT License 6 votes vote down vote up
@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();
  }
}
 
Example #2
Source File: UIManagerModuleTest.java    From react-native-GPay with MIT License 6 votes vote down vote up
/**
 * 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: MergedAppBarLayoutBehavior.java    From react-native-bottom-sheet-behavior with MIT License 5 votes vote down vote up
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;
}
 
Example #4
Source File: ViewRenderingTestCase.java    From react-native-GPay with MIT License 5 votes vote down vote up
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());
}
 
Example #5
Source File: BaseViewManagerTest.java    From react-native-GPay with MIT License 4 votes vote down vote up
@Before
public void setUp() {
  mViewManager = new ReactViewManager();
  mView = new ReactViewGroup(RuntimeEnvironment.application);
}
 
Example #6
Source File: SharedElementGroupManager.java    From native-navigation with MIT License 4 votes vote down vote up
@ReactProp(name = "id")
public void setIdentifier(ReactViewGroup view, String id) {
  view.setTag(R.id.react_shared_element_group_id, id);
}
 
Example #7
Source File: SharedElementGroupManager.java    From native-navigation with MIT License 4 votes vote down vote up
@Override
public ReactViewGroup createViewInstance(ThemedReactContext context) {
  return new ReactViewGroup(context);
}
 
Example #8
Source File: SharedElementViewManager.java    From native-navigation with MIT License 4 votes vote down vote up
@ReactProp(name = "nativeNavigationInstanceId")
public void setInstanceId(ReactViewGroup view, String instanceId) {
  view.setTag(R.id.react_shared_element_screen_instance_id, instanceId);
}
 
Example #9
Source File: SharedElementViewManager.java    From native-navigation with MIT License 4 votes vote down vote up
@ReactProp(name = "id")
public void setIdentifier(ReactViewGroup view, String id) {
  view.setTag(R.id.react_shared_element_transition_name, id);
}
 
Example #10
Source File: SharedElementViewManager.java    From native-navigation with MIT License 4 votes vote down vote up
@Override
public ReactViewGroup createViewInstance(ThemedReactContext context) {
  return new ReactViewGroup(context);
}
 
Example #11
Source File: ScreenStackHeaderSubviewManager.java    From react-native-screens with MIT License 4 votes vote down vote up
@Override
public ReactViewGroup createViewInstance(ThemedReactContext context) {
  return new ScreenStackHeaderSubview(context);
}
 
Example #12
Source File: SajjadBlurOverlayManager.java    From react-native-blur-overlay with MIT License 4 votes vote down vote up
@Override
protected ReactViewGroup createViewInstance(ThemedReactContext reactContext) {
    return new ReactViewGroup(reactContext);
}
 
Example #13
Source File: CatalystSubviewsClippingTestCase.java    From react-native-GPay with MIT License 4 votes vote down vote up
@ReactProp(name = "clippableViewID")
public void setClippableViewId(ReactViewGroup view, @Nullable String clippableViewId) {
  ((ClippableView) view).setClippableViewID(clippableViewId);
}
 
Example #14
Source File: CatalystSubviewsClippingTestCase.java    From react-native-GPay with MIT License 4 votes vote down vote up
@Override
public ReactViewGroup createViewInstance(ThemedReactContext context) {
  return new ClippableView(context, mEvents);
}
 
Example #15
Source File: SajjadBlurOverlayManager.java    From react-native-blur-overlay with MIT License 4 votes vote down vote up
@ReactProp(name = "brightness")
public void setBrightness(ReactViewGroup view, float brightness) {
    mBrightness = brightness;
    setBlurred(view);
    view.requestFocus();
}
 
Example #16
Source File: SajjadBlurOverlayManager.java    From react-native-blur-overlay with MIT License 4 votes vote down vote up
@ReactProp(name = "downsampling")
public void setRadius(ReactViewGroup view, float factor) {
    mFactor = factor;
}
 
Example #17
Source File: SajjadBlurOverlayManager.java    From react-native-blur-overlay with MIT License 4 votes vote down vote up
@ReactProp(name = "radius")
public void setRadius(ReactViewGroup view, int Radius) {
    mRadius = Radius;
}