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


Java ReactRootView.setLayoutParams方法代码示例

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


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

示例1: setUp

import com.facebook.react.ReactRootView; //导入方法依赖的package包/类
@Override
protected void setUp() throws Exception {
  super.setUp();

  List<ViewManager> viewManagers = Arrays.<ViewManager>asList(
      new ReactViewManager(),
      new ReactProgressBarViewManager());
  mUIManager = new UIManagerModule(
      getContext(),
      viewManagers,
      new UIImplementationProvider(),
      false);
  UiThreadUtil.runOnUiThread(
      new Runnable() {
        @Override
        public void run() {
          mUIManager.onHostResume();
        }
      });
  waitForIdleSync();

  mInstance = ReactTestHelper.catalystInstanceBuilder(this)
      .addNativeModule(mUIManager)
      .addNativeModule(new AndroidInfoModule())
      .addNativeModule(new DeviceInfoModule(getContext()))
      .addNativeModule(new AppStateModule(getContext()))
      .addNativeModule(new FakeWebSocketModule())
      .addJSModule(ProgressBarTestModule.class)
      .build();

  mRootView = new ReactRootView(getContext());
  DisplayMetrics metrics = getContext().getResources().getDisplayMetrics();
  mRootView.setLayoutParams(
      new FrameLayout.LayoutParams(metrics.widthPixels, metrics.heightPixels));
  int rootTag = mUIManager.addMeasuredRootView(mRootView);
  mInstance.getJSModule(ProgressBarTestModule.class).renderProgressBarApplication(rootTag);
  waitForBridgeAndUIIdle();
}
 
开发者ID:qq565999484,项目名称:RNLearn_Project1,代码行数:39,代码来源:ProgressBarTestCase.java

示例2: createRootView

import com.facebook.react.ReactRootView; //导入方法依赖的package包/类
private ReactRootView createRootView() {
  ReactRootView rootView = new ReactRootView(getContext());
  final DisplayMetrics metrics = getContext().getResources().getDisplayMetrics();
  rootView.setLayoutParams(
      new FrameLayout.LayoutParams(metrics.widthPixels, metrics.heightPixels));
  uiManager.addMeasuredRootView(rootView);
  // We add the root view by posting to the main thread so wait for that to complete so that the
  // root view tag is added to the view
  waitForIdleSync();
  return rootView;
}
 
开发者ID:qq565999484,项目名称:RNLearn_Project1,代码行数:12,代码来源:CatalystUIManagerTestCase.java

示例3: 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

示例4: setUp

import com.facebook.react.ReactRootView; //导入方法依赖的package包/类
@Override
protected void setUp() throws Exception {
  super.setUp();

  List<ViewManager> viewManagers = Arrays.<ViewManager>asList(
      new ReactViewManager(),
      new ReactProgressBarViewManager());
  mUIManager = new UIManagerModule(
      getContext(),
      viewManagers,
      new UIImplementationProvider());
  UiThreadUtil.runOnUiThread(
      new Runnable() {
        @Override
        public void run() {
          mUIManager.onHostResume();
        }
      });
  waitForIdleSync();

  mInstance = ReactTestHelper.catalystInstanceBuilder(this)
      .addNativeModule(mUIManager)
      .addNativeModule(new AndroidInfoModule())
      .addNativeModule(new FakeWebSocketModule())
      .addJSModule(ProgressBarTestModule.class)
      .build();

  mRootView = new ReactRootView(getContext());
  DisplayMetrics metrics = getContext().getResources().getDisplayMetrics();
  mRootView.setLayoutParams(
      new FrameLayout.LayoutParams(metrics.widthPixels, metrics.heightPixels));
  int rootTag = mUIManager.addMeasuredRootView(mRootView);
  mInstance.getJSModule(ProgressBarTestModule.class).renderProgressBarApplication(rootTag);
  waitForBridgeAndUIIdle();
}
 
开发者ID:Right-Men,项目名称:Ironman,代码行数:36,代码来源:ProgressBarTestCase.java

示例5: 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


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