本文整理汇总了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();
}
示例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;
}
示例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);
}
示例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();
}
示例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);
}