当前位置: 首页>>代码示例>>Java>>正文


Java ReactRootView.getChildAt方法代码示例

本文整理汇总了Java中com.facebook.react.ReactRootView.getChildAt方法的典型用法代码示例。如果您正苦于以下问题:Java ReactRootView.getChildAt方法的具体用法?Java ReactRootView.getChildAt怎么用?Java ReactRootView.getChildAt使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.facebook.react.ReactRootView的用法示例。


在下文中一共展示了ReactRootView.getChildAt方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testResizeRootView

import com.facebook.react.ReactRootView; //导入方法依赖的package包/类
@Ignore("t6596940: fix intermittently failing test")
public void testResizeRootView() throws Throwable {
  final ReactRootView rootView = (ReactRootView) getRootView();
  final View childView = rootView.getChildAt(0);

  assertEquals(rootView.getWidth(), childView.getWidth());

  final int newWidth = rootView.getWidth() / 2;

  runTestOnUiThread(
      new Runnable() {
        @Override
        public void run() {
          rootView.setLayoutParams(new FrameLayout.LayoutParams(
                  newWidth,
                  ViewGroup.LayoutParams.MATCH_PARENT));
        }
      });

  getInstrumentation().waitForIdleSync();
  waitForBridgeAndUIIdle();

  assertEquals(newWidth, childView.getWidth());
}
 
开发者ID:qq565999484,项目名称:RNLearn_Project1,代码行数:25,代码来源:ReactRootViewTestCase.java

示例2: testTextDecorationLineUnderlineApplied

import com.facebook.react.ReactRootView; //导入方法依赖的package包/类
@Test
public void testTextDecorationLineUnderlineApplied() {
  UIManagerModule uiManager = getUIManagerModule();

  ReactRootView rootView = createText(
      uiManager,
      JavaOnlyMap.of(ViewProps.TEXT_DECORATION_LINE, "underline"),
      JavaOnlyMap.of(ReactTextShadowNode.PROP_TEXT, "test text"));

  TextView textView = (TextView) rootView.getChildAt(0);
  Spanned text = (Spanned) textView.getText();
  UnderlineSpan underlineSpan = getSingleSpan(textView, UnderlineSpan.class);
  StrikethroughSpan[] strikeThroughSpans =
      text.getSpans(0, text.length(), StrikethroughSpan.class);
  assertThat(underlineSpan instanceof UnderlineSpan).isTrue();
  assertThat(strikeThroughSpans).hasSize(0);
}
 
开发者ID:qq565999484,项目名称:RNLearn_Project1,代码行数:18,代码来源:ReactTextTest.java

示例3: testTextDecorationLineLineThroughApplied

import com.facebook.react.ReactRootView; //导入方法依赖的package包/类
@Test
public void testTextDecorationLineLineThroughApplied() {
  UIManagerModule uiManager = getUIManagerModule();

  ReactRootView rootView = createText(
      uiManager,
      JavaOnlyMap.of(ViewProps.TEXT_DECORATION_LINE, "line-through"),
      JavaOnlyMap.of(ReactTextShadowNode.PROP_TEXT, "test text"));

  TextView textView = (TextView) rootView.getChildAt(0);
  Spanned text = (Spanned) textView.getText();
  UnderlineSpan[] underlineSpans =
      text.getSpans(0, text.length(), UnderlineSpan.class);
  StrikethroughSpan strikeThroughSpan =
      getSingleSpan(textView, StrikethroughSpan.class);
  assertThat(underlineSpans).hasSize(0);
  assertThat(strikeThroughSpan instanceof StrikethroughSpan).isTrue();
}
 
开发者ID:qq565999484,项目名称:RNLearn_Project1,代码行数:19,代码来源:ReactTextTest.java

示例4: testPropsApplied

import com.facebook.react.ReactRootView; //导入方法依赖的package包/类
@Test
public void testPropsApplied() {
  UIManagerModule uiManager = getUIManagerModule();

  ReactRootView rootView = new ReactRootView(RuntimeEnvironment.application);
  rootView.setLayoutParams(new ReactRootView.LayoutParams(100, 100));
  int rootTag = uiManager.addMeasuredRootView(rootView);
  int textInputTag = rootTag + 1;
  final String hintStr = "placeholder text";

  uiManager.createView(
      textInputTag,
      ReactTextInputManager.REACT_CLASS,
      rootTag,
      JavaOnlyMap.of(
          ViewProps.FONT_SIZE, 13.37, ViewProps.HEIGHT, 20.0, "placeholder", hintStr));

  uiManager.manageChildren(
      rootTag,
      null,
      null,
      JavaOnlyArray.of(textInputTag),
      JavaOnlyArray.of(0),
      null);

  uiManager.onBatchComplete();
  executePendingChoreographerCallbacks();

  EditText editText = (EditText) rootView.getChildAt(0);
  assertThat(editText.getHint()).isEqualTo(hintStr);
  assertThat(editText.getTextSize()).isEqualTo((float) Math.ceil(13.37));
  assertThat(editText.getHeight()).isEqualTo(20);
}
 
开发者ID:qq565999484,项目名称:RNLearn_Project1,代码行数:34,代码来源:TextInputTest.java

示例5: testMaxLinesApplied

import com.facebook.react.ReactRootView; //导入方法依赖的package包/类
@TargetApi(Build.VERSION_CODES.JELLY_BEAN)
@Test
public void testMaxLinesApplied() {
  UIManagerModule uiManager = getUIManagerModule();

  ReactRootView rootView = createText(
      uiManager,
      JavaOnlyMap.of(ViewProps.NUMBER_OF_LINES, 2),
      JavaOnlyMap.of(ReactTextShadowNode.PROP_TEXT, "test text"));

  TextView textView = (TextView) rootView.getChildAt(0);
  assertThat(textView.getText().toString()).isEqualTo("test text");
  assertThat(textView.getMaxLines()).isEqualTo(2);
  assertThat(textView.getEllipsize()).isEqualTo(TextUtils.TruncateAt.END);
}
 
开发者ID:qq565999484,项目名称:RNLearn_Project1,代码行数:16,代码来源:ReactTextTest.java

示例6: testPropsApplied

import com.facebook.react.ReactRootView; //导入方法依赖的package包/类
@Test
public void testPropsApplied() {
  UIManagerModule uiManager = getUIManagerModule();

  ReactRootView rootView = new ReactRootView(RuntimeEnvironment.application);
  int rootTag = uiManager.addMeasuredRootView(rootView);
  int textInputTag = rootTag + 1;
  final String hintStr = "placeholder text";

  uiManager.createView(
      textInputTag,
      ReactTextInputManager.REACT_CLASS,
      rootTag,
      JavaOnlyMap.of(
          ViewProps.FONT_SIZE, 13.37, ViewProps.HEIGHT, 20.0, "placeholder", hintStr));

  uiManager.manageChildren(
      rootTag,
      null,
      null,
      JavaOnlyArray.of(textInputTag),
      JavaOnlyArray.of(0),
      null);

  uiManager.onBatchComplete();
  executePendingChoreographerCallbacks();

  EditText editText = (EditText) rootView.getChildAt(0);
  assertThat(editText.getHint()).isEqualTo(hintStr);
  assertThat(editText.getTextSize()).isEqualTo((float) Math.ceil(13.37));
  assertThat(editText.getHeight()).isEqualTo(20);
}
 
开发者ID:john1jan,项目名称:ReactNativeSignatureExample,代码行数:33,代码来源:TextInputTest.java

示例7: testPropsUpdate

import com.facebook.react.ReactRootView; //导入方法依赖的package包/类
@Test
public void testPropsUpdate() {
  UIManagerModule uiManager = getUIManagerModule();

  ReactRootView rootView = new ReactRootView(RuntimeEnvironment.application);
  rootView.setLayoutParams(new ReactRootView.LayoutParams(100, 100));
  int rootTag = uiManager.addMeasuredRootView(rootView);
  int textInputTag = rootTag + 1;
  final String hintStr = "placeholder text";

  uiManager.createView(
      textInputTag,
      ReactTextInputManager.REACT_CLASS,
      rootTag,
      JavaOnlyMap.of(
          ViewProps.FONT_SIZE, 13.37, ViewProps.HEIGHT, 20.0, "placeholder", hintStr));

  uiManager.manageChildren(
      rootTag,
      null,
      null,
      JavaOnlyArray.of(textInputTag),
      JavaOnlyArray.of(0),
      null);
  uiManager.onBatchComplete();
  executePendingChoreographerCallbacks();

  EditText editText = (EditText) rootView.getChildAt(0);
  assertThat(editText.getHint()).isEqualTo(hintStr);
  assertThat(editText.getTextSize()).isEqualTo((float) Math.ceil(13.37));
  assertThat(editText.getHeight()).isEqualTo(20);

  final String hintStr2 = "such hint";
  uiManager.updateView(
      textInputTag,
      ReactTextInputManager.REACT_CLASS,
      JavaOnlyMap.of(
          ViewProps.FONT_SIZE, 26.74, ViewProps.HEIGHT, 40.0, "placeholder", hintStr2));

  uiManager.onBatchComplete();
  executePendingChoreographerCallbacks();

  EditText updatedEditText = (EditText) rootView.getChildAt(0);
  assertThat(updatedEditText.getHint()).isEqualTo(hintStr2);
  assertThat(updatedEditText.getTextSize()).isEqualTo((float) Math.ceil(26.74f));
  assertThat(updatedEditText.getHeight()).isEqualTo(40);
}
 
开发者ID:qq565999484,项目名称:RNLearn_Project1,代码行数:48,代码来源:TextInputTest.java

示例8: testHierarchyWithView

import com.facebook.react.ReactRootView; //导入方法依赖的package包/类
@Test
public void testHierarchyWithView() {
  UIManagerModule uiManager = getUIManagerModule();

  ReactRootView rootView =
      new ReactRootView(RuntimeEnvironment.application.getApplicationContext());
  int rootTag = uiManager.addMeasuredRootView(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);
}
 
开发者ID:qq565999484,项目名称:RNLearn_Project1,代码行数:50,代码来源:UIManagerModuleTest.java

示例9: testPropsUpdate

import com.facebook.react.ReactRootView; //导入方法依赖的package包/类
@Test
public void testPropsUpdate() {
  UIManagerModule uiManager = getUIManagerModule();

  ReactRootView rootView = new ReactRootView(RuntimeEnvironment.application);
  int rootTag = uiManager.addMeasuredRootView(rootView);
  int textInputTag = rootTag + 1;
  final String hintStr = "placeholder text";

  uiManager.createView(
      textInputTag,
      ReactTextInputManager.REACT_CLASS,
      rootTag,
      JavaOnlyMap.of(
          ViewProps.FONT_SIZE, 13.37, ViewProps.HEIGHT, 20.0, "placeholder", hintStr));

  uiManager.manageChildren(
      rootTag,
      null,
      null,
      JavaOnlyArray.of(textInputTag),
      JavaOnlyArray.of(0),
      null);
  uiManager.onBatchComplete();
  executePendingChoreographerCallbacks();

  EditText editText = (EditText) rootView.getChildAt(0);
  assertThat(editText.getHint()).isEqualTo(hintStr);
  assertThat(editText.getTextSize()).isEqualTo((float) Math.ceil(13.37));
  assertThat(editText.getHeight()).isEqualTo(20);

  final String hintStr2 = "such hint";
  uiManager.updateView(
      textInputTag,
      ReactTextInputManager.REACT_CLASS,
      JavaOnlyMap.of(
          ViewProps.FONT_SIZE, 26.74, ViewProps.HEIGHT, 40.0, "placeholder", hintStr2));

  uiManager.onBatchComplete();
  executePendingChoreographerCallbacks();

  EditText updatedEditText = (EditText) rootView.getChildAt(0);
  assertThat(updatedEditText.getHint()).isEqualTo(hintStr2);
  assertThat(updatedEditText.getTextSize()).isEqualTo((float) Math.ceil(26.74f));
  assertThat(updatedEditText.getHeight()).isEqualTo(40);
}
 
开发者ID:john1jan,项目名称:ReactNativeSignatureExample,代码行数:47,代码来源:TextInputTest.java

示例10: testHierarchyWithView

import com.facebook.react.ReactRootView; //导入方法依赖的package包/类
@Test
public void testHierarchyWithView() {
  UIManagerModule uiManager = getUIManagerModule();

  ReactRootView rootView =
      new ReactRootView(RuntimeEnvironment.application.getApplicationContext());
  int rootTag = uiManager.addMeasuredRootView(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();
  executePendingChoreographerCallbacks();

  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);
}
 
开发者ID:john1jan,项目名称:ReactNativeSignatureExample,代码行数:50,代码来源:UIManagerModuleTest.java


注:本文中的com.facebook.react.ReactRootView.getChildAt方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。