本文整理汇总了Java中com.facebook.react.views.view.ReactViewManager类的典型用法代码示例。如果您正苦于以下问题:Java ReactViewManager类的具体用法?Java ReactViewManager怎么用?Java ReactViewManager使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ReactViewManager类属于com.facebook.react.views.view包,在下文中一共展示了ReactViewManager类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testReplaceExistingNonRootView
import com.facebook.react.views.view.ReactViewManager; //导入依赖的package包/类
/**
* 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);
}
示例2: testReplaceExistingNonRootView
import com.facebook.react.views.view.ReactViewManager; //导入依赖的package包/类
/**
* 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);
}
示例3: createViewManagers
import com.facebook.react.views.view.ReactViewManager; //导入依赖的package包/类
@Override
public List<ViewManager> createViewManagers(ReactApplicationContext reactContext) {
return Arrays.<ViewManager>asList(
new ReactDrawerLayoutManager(),
new ReactHorizontalScrollViewManager(),
new ReactImageManager(),
new ReactProgressBarViewManager(),
new ReactRawTextManager(),
new ReactScrollViewManager(),
new ReactSwitchManager(),
new ReactTextInputManager(),
new ReactTextViewManager(),
new ReactToolbarManager(),
new ReactViewManager(),
new ReactViewPagerManager(),
new ReactTextInlineImageViewManager(),
new ReactVirtualTextViewManager(),
new SwipeRefreshLayoutManager(),
new ReactWebViewManager());
}
示例4: setUp
import com.facebook.react.views.view.ReactViewManager; //导入依赖的package包/类
@Override
protected void setUp() throws Exception {
super.setUp();
List<ViewManager> viewManagers = Arrays.<ViewManager>asList(
new ReactViewManager());
final UIManagerModule mUIManager = new UIManagerModule(
getContext(),
viewManagers,
new UIImplementationProvider(),
false);
UiThreadUtil.runOnUiThread(
new Runnable() {
@Override
public void run() {
mUIManager.onHostResume();
}
});
waitForIdleSync();
mRecordingTestModule = new RecordingTestModule();
mCatalystInstance = ReactTestHelper.catalystInstanceBuilder(this)
.addNativeModule(mRecordingTestModule)
.addNativeModule(new AndroidInfoModule())
.addNativeModule(new DeviceInfoModule(getContext()))
.addNativeModule(new AppStateModule(getContext()))
.addNativeModule(new FakeWebSocketModule())
.addNativeModule(mUIManager)
.addJSModule(TestJSToJavaParametersModule.class)
.build();
}
示例5: setUp
import com.facebook.react.views.view.ReactViewManager; //导入依赖的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();
}
示例6: setUp
import com.facebook.react.views.view.ReactViewManager; //导入依赖的package包/类
@Override
protected void setUp() throws Exception {
super.setUp();
List<ViewManager> viewManagers = Arrays.<ViewManager>asList(new ReactViewManager());
final UIManagerModule uiManager = new UIManagerModule(
getContext(),
viewManagers,
new UIImplementationProvider(),
false);
UiThreadUtil.runOnUiThread(
new Runnable() {
@Override
public void run() {
uiManager.onHostResume();
}
});
waitForIdleSync();
mCatalystInstance = ReactTestHelper.catalystInstanceBuilder(this)
.addNativeModule(uiManager)
.addNativeModule(new AndroidInfoModule())
.addNativeModule(new DeviceInfoModule(getContext()))
.addNativeModule(new AppStateModule(getContext()))
.addNativeModule(new FakeWebSocketModule())
.addJSModule(ViewRenderingTestModule.class)
.build();
mRootView = new ReactRootView(getContext());
mRootTag = uiManager.addMeasuredRootView(mRootView);
}
示例7: setUp
import com.facebook.react.views.view.ReactViewManager; //导入依赖的package包/类
@Override
protected void setUp() throws Exception {
super.setUp();
List<ViewManager> viewManagers = Arrays.<ViewManager>asList(
new ReactViewManager());
final UIManagerModule mUIManager = new UIManagerModule(
getContext(),
viewManagers,
new UIImplementationProvider(),
false);
UiThreadUtil.runOnUiThread(
new Runnable() {
@Override
public void run() {
mUIManager.onHostResume();
}
});
waitForIdleSync();
mAssertModule = new AssertModule();
mInstance = ReactTestHelper.catalystInstanceBuilder(this)
.addNativeModule(mAssertModule)
.addNativeModule(new DeviceInfoModule(getContext()))
.addNativeModule(new AppStateModule(getContext()))
.addNativeModule(new FakeWebSocketModule())
.addJSModule(TestJavaToJSArgumentsModule.class)
.addNativeModule(mUIManager)
.build();
}
示例8: setUp
import com.facebook.react.views.view.ReactViewManager; //导入依赖的package包/类
@Override
protected void setUp() throws Exception {
super.setUp();
List<ViewManager> viewManagers = Arrays.<ViewManager>asList(
new ReactViewManager());
final UIManagerModule mUIManager = new UIManagerModule(
getContext(),
viewManagers,
new UIImplementationProvider(),
false);
UiThreadUtil.runOnUiThread(
new Runnable() {
@Override
public void run() {
mUIManager.onHostResume();
}
});
waitForIdleSync();
mStringRecordingModule = new StringRecordingModule();
mInstance = ReactTestHelper.catalystInstanceBuilder(this)
.addNativeModule(mStringRecordingModule)
.addNativeModule(mUIManager)
.addNativeModule(new DeviceInfoModule(getContext()))
.addNativeModule(new AppStateModule(getContext()))
.addNativeModule(new FakeWebSocketModule())
.addJSModule(TestJSLocaleModule.class)
.build();
}
示例9: setUp
import com.facebook.react.views.view.ReactViewManager; //导入依赖的package包/类
@Override
protected void setUp() throws Exception {
super.setUp();
List<ViewManager> viewManagers = Arrays.<ViewManager>asList(
new ReactViewManager(),
new ReactTextViewManager(),
new ReactRawTextManager());
uiManager = new UIManagerModule(
getContext(),
viewManagers,
new UIImplementationProvider(),
false);
UiThreadUtil.runOnUiThread(new Runnable() {
@Override
public void run() {
uiManager.onHostResume();
}
});
waitForIdleSync();
jsModule = ReactTestHelper.catalystInstanceBuilder(this)
.addNativeModule(uiManager)
.addNativeModule(new AndroidInfoModule())
.addNativeModule(new DeviceInfoModule(getContext()))
.addNativeModule(new AppStateModule(getContext()))
.addNativeModule(new FakeWebSocketModule())
.addJSModule(UIManagerTestModule.class)
.build()
.getJSModule(UIManagerTestModule.class);
}
示例10: testLayoutAppliedToNodes
import com.facebook.react.views.view.ReactViewManager; //导入依赖的package包/类
@Test
public void testLayoutAppliedToNodes() throws Exception {
UIManagerModule uiManager = getUIManagerModule();
TestMoveDeleteHierarchy hierarchy = createMoveDeleteHierarchy(uiManager);
int newViewTag = 10000;
uiManager.createView(
newViewTag,
ReactViewManager.REACT_CLASS,
hierarchy.rootView,
JavaOnlyMap
.of("left", 10.0, "top", 20.0, "width", 30.0, "height", 40.0, "collapsable", false));
uiManager.manageChildren(
hierarchy.rootView,
null,
null,
JavaOnlyArray.of(newViewTag),
JavaOnlyArray.of(4),
null);
uiManager.onBatchComplete();
executePendingFrameCallbacks();
View newView = hierarchy.nativeRootView.getChildAt(4);
assertThat(newView.getLeft()).isEqualTo(10);
assertThat(newView.getTop()).isEqualTo(20);
assertThat(newView.getWidth()).isEqualTo(30);
assertThat(newView.getHeight()).isEqualTo(40);
}
示例11: testAddUpdateRemoveInSingleBatch
import com.facebook.react.views.view.ReactViewManager; //导入依赖的package包/类
/**
* This is to make sure we execute enqueued operations in the order given by JS.
*/
@Test
public void testAddUpdateRemoveInSingleBatch() {
UIManagerModule uiManager = getUIManagerModule();
TestMoveDeleteHierarchy hierarchy = createMoveDeleteHierarchy(uiManager);
int newViewTag = 10000;
uiManager.createView(
newViewTag,
ReactViewManager.REACT_CLASS,
hierarchy.rootView,
JavaOnlyMap.of("collapsable", false));
uiManager.manageChildren(
hierarchy.rootView,
null,
null,
JavaOnlyArray.of(newViewTag),
JavaOnlyArray.of(4),
null);
uiManager.updateView(
newViewTag,
ReactViewManager.REACT_CLASS,
JavaOnlyMap.of("backgroundColor", Color.RED));
uiManager.manageChildren(
hierarchy.rootView,
null,
null,
null,
null,
JavaOnlyArray.of(4));
uiManager.onBatchComplete();
executePendingFrameCallbacks();
assertThat(hierarchy.nativeRootView.getChildCount()).isEqualTo(4);
}
示例12: testLayoutPropertyUpdatingOnlyOnLayoutChange
import com.facebook.react.views.view.ReactViewManager; //导入依赖的package包/类
@Test
public void testLayoutPropertyUpdatingOnlyOnLayoutChange() {
UIManagerModule uiManager = getUIManagerModule();
TestMoveDeleteHierarchy hierarchy = createMoveDeleteHierarchy(uiManager);
// Update layout to some values, this way we can verify it hasn't been updated, because the
// update process would normally reset it back to some non-negative value
View view0 = hierarchy.nativeRootView.getChildAt(0);
view0.layout(1, 2, 3, 4);
// verify that X get updated when we update layout properties
uiManager.updateView(
hierarchy.view0,
ReactViewManager.REACT_CLASS,
JavaOnlyMap.of("left", 10.0, "top", 20.0, "width", 30.0, "height", 40.0));
uiManager.onBatchComplete();
executePendingFrameCallbacks();
assertThat(view0.getLeft()).isGreaterThan(2);
// verify that the layout doesn't get updated when we update style property not affecting the
// position (e.g., background-color)
view0.layout(1, 2, 3, 4);
uiManager.updateView(
hierarchy.view0,
ReactViewManager.REACT_CLASS,
JavaOnlyMap.of("backgroundColor", Color.RED));
uiManager.onBatchComplete();
executePendingFrameCallbacks();
assertThat(view0.getLeft()).isEqualTo(1);
}
示例13: testAddAndRemoveAnimation
import com.facebook.react.views.view.ReactViewManager; //导入依赖的package包/类
@Test
public void testAddAndRemoveAnimation() {
UIManagerModule uiManagerModule = getUIManagerModule();
TestMoveDeleteHierarchy hierarchy = createMoveDeleteHierarchy(uiManagerModule);
AnimationPropertyUpdater mockPropertyUpdater = mock(AnimationPropertyUpdater.class);
Animation mockAnimation = spy(new AnimationStub(1000, mockPropertyUpdater));
Callback callbackMock = mock(Callback.class);
int rootTag = hierarchy.rootView;
uiManagerModule.createView(
hierarchy.rootView,
ReactViewManager.REACT_CLASS,
rootTag,
JavaOnlyMap.of("collapsable", false));
uiManagerModule.registerAnimation(mockAnimation);
uiManagerModule.addAnimation(hierarchy.rootView, 1000, callbackMock);
uiManagerModule.removeAnimation(hierarchy.rootView, 1000);
uiManagerModule.onBatchComplete();
executePendingFrameCallbacks();
verify(callbackMock, times(1)).invoke(false);
verify(mockAnimation).run();
verify(mockAnimation).cancel();
}
示例14: getUIManagerModule
import com.facebook.react.views.view.ReactViewManager; //导入依赖的package包/类
private UIManagerModule getUIManagerModule() {
List<ViewManager> viewManagers = Arrays.<ViewManager>asList(
new ReactViewManager(),
new ReactTextViewManager(),
new ReactRawTextManager());
UIManagerModule uiManagerModule = new UIManagerModule(
mReactContext,
viewManagers,
new UIImplementationProvider(),
false);
uiManagerModule.onHostResume();
return uiManagerModule;
}
示例15: createViewManagers
import com.facebook.react.views.view.ReactViewManager; //导入依赖的package包/类
@Override
public List<ViewManager> createViewManagers(ReactApplicationContext reactContext) {
return Arrays.<ViewManager>asList(
ARTRenderableViewManager.createARTGroupViewManager(),
ARTRenderableViewManager.createARTShapeViewManager(),
ARTRenderableViewManager.createARTTextViewManager(),
new ARTSurfaceViewManager(),
new ReactDialogPickerManager(),
new ReactDrawerLayoutManager(),
new ReactDropdownPickerManager(),
new ReactHorizontalScrollViewManager(),
new ReactImageManager(),
new ReactProgressBarViewManager(),
new ReactRawTextManager(),
new ReactScrollViewManager(),
new ReactSwitchManager(),
new FrescoBasedReactTextInlineImageViewManager(),
new ReactTextInputManager(),
new ReactTextViewManager(),
new ReactToolbarManager(),
new ReactViewManager(),
new ReactViewPagerManager(),
new ReactVirtualTextViewManager(),
new ReactWebViewManager(),
new RecyclerViewBackedScrollViewManager(),
new SwipeRefreshLayoutManager());
}