mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-04-05 09:29:07 +08:00
access view managers as Native Modules
Reviewed By: achen1 Differential Revision: D4338782 fbshipit-source-id: 1573e45ee3af5a44d033a166424e556b2c091fb6
This commit is contained in:
committed by
Facebook Github Bot
parent
577fd0cbb9
commit
5e9db574ee
@@ -148,7 +148,8 @@ public class ReactPropConstantsTest {
|
||||
UIManagerModule uiManagerModule = new UIManagerModule(
|
||||
reactContext,
|
||||
viewManagers,
|
||||
new UIImplementationProvider());
|
||||
new UIImplementationProvider(),
|
||||
false);
|
||||
Map<String, String> constants =
|
||||
(Map) valueAtPath(uiManagerModule.getConstants(), "SomeView", "NativeProps");
|
||||
assertThat(constants).isEqualTo(
|
||||
|
||||
@@ -69,9 +69,10 @@ public class UIManagerModuleConstantsTest {
|
||||
public void testNoCustomConstants() {
|
||||
List<ViewManager> viewManagers = Arrays.asList(mock(ViewManager.class));
|
||||
UIManagerModule uiManagerModule = new UIManagerModule(
|
||||
mReactContext,
|
||||
viewManagers,
|
||||
mUIImplementationProvider);
|
||||
mReactContext,
|
||||
viewManagers,
|
||||
mUIImplementationProvider,
|
||||
false);
|
||||
Map<String, Object> constants = uiManagerModule.getConstants();
|
||||
assertThat(constants)
|
||||
.containsKey(CUSTOM_BUBBLING_EVENT_TYPES)
|
||||
@@ -86,9 +87,10 @@ public class UIManagerModuleConstantsTest {
|
||||
when(mockViewManager.getExportedCustomBubblingEventTypeConstants())
|
||||
.thenReturn(MapBuilder.of("onTwirl", TWIRL_BUBBLING_EVENT_MAP));
|
||||
UIManagerModule uiManagerModule = new UIManagerModule(
|
||||
mReactContext,
|
||||
viewManagers,
|
||||
mUIImplementationProvider);
|
||||
mReactContext,
|
||||
viewManagers,
|
||||
mUIImplementationProvider,
|
||||
false);
|
||||
Map<String, Object> constants = uiManagerModule.getConstants();
|
||||
assertThat((Map) constants.get(CUSTOM_BUBBLING_EVENT_TYPES))
|
||||
.contains(MapEntry.entry("onTwirl", TWIRL_BUBBLING_EVENT_MAP))
|
||||
@@ -102,9 +104,10 @@ public class UIManagerModuleConstantsTest {
|
||||
when(mockViewManager.getExportedCustomDirectEventTypeConstants())
|
||||
.thenReturn(MapBuilder.of("onTwirl", TWIRL_DIRECT_EVENT_MAP));
|
||||
UIManagerModule uiManagerModule = new UIManagerModule(
|
||||
mReactContext,
|
||||
viewManagers,
|
||||
mUIImplementationProvider);
|
||||
mReactContext,
|
||||
viewManagers,
|
||||
mUIImplementationProvider,
|
||||
false);
|
||||
Map<String, Object> constants = uiManagerModule.getConstants();
|
||||
assertThat((Map) constants.get(CUSTOM_DIRECT_EVENT_TYPES))
|
||||
.contains(MapEntry.entry("onTwirl", TWIRL_DIRECT_EVENT_MAP))
|
||||
@@ -119,9 +122,10 @@ public class UIManagerModuleConstantsTest {
|
||||
when(mockViewManager.getExportedViewConstants())
|
||||
.thenReturn(MapBuilder.of("PhotoSizeType", MapBuilder.of("Small", 1, "Large", 2)));
|
||||
UIManagerModule uiManagerModule = new UIManagerModule(
|
||||
mReactContext,
|
||||
viewManagers,
|
||||
mUIImplementationProvider);
|
||||
mReactContext,
|
||||
viewManagers,
|
||||
mUIImplementationProvider,
|
||||
false);
|
||||
Map<String, Object> constants = uiManagerModule.getConstants();
|
||||
assertThat(constants).containsKey("RedPandaPhotoOfTheDayView");
|
||||
assertThat((Map) constants.get("RedPandaPhotoOfTheDayView")).containsKey("Constants");
|
||||
@@ -137,9 +141,10 @@ public class UIManagerModuleConstantsTest {
|
||||
when(mockViewManager.getNativeProps())
|
||||
.thenReturn(MapBuilder.of("fooProp", "number"));
|
||||
UIManagerModule uiManagerModule = new UIManagerModule(
|
||||
mReactContext,
|
||||
viewManagers,
|
||||
mUIImplementationProvider);
|
||||
mReactContext,
|
||||
viewManagers,
|
||||
mUIImplementationProvider,
|
||||
false);
|
||||
Map<String, Object> constants = uiManagerModule.getConstants();
|
||||
assertThat((String) valueAtPath(constants, "SomeView", "NativeProps", "fooProp"))
|
||||
.isEqualTo("number");
|
||||
@@ -171,9 +176,10 @@ public class UIManagerModuleConstantsTest {
|
||||
|
||||
List<ViewManager> viewManagers = Arrays.asList(managerX, managerY);
|
||||
UIManagerModule uiManagerModule = new UIManagerModule(
|
||||
mReactContext,
|
||||
viewManagers,
|
||||
mUIImplementationProvider);
|
||||
mReactContext,
|
||||
viewManagers,
|
||||
mUIImplementationProvider,
|
||||
false);
|
||||
Map<String, Object> constants = uiManagerModule.getConstants();
|
||||
assertThat((Map) constants.get(CUSTOM_DIRECT_EVENT_TYPES)).containsKey("onTwirl");
|
||||
|
||||
|
||||
@@ -820,7 +820,8 @@ public class UIManagerModuleTest {
|
||||
UIManagerModule uiManagerModule = new UIManagerModule(
|
||||
mReactContext,
|
||||
viewManagers,
|
||||
new UIImplementationProvider());
|
||||
new UIImplementationProvider(),
|
||||
false);
|
||||
uiManagerModule.onHostResume();
|
||||
return uiManagerModule;
|
||||
}
|
||||
|
||||
@@ -434,7 +434,8 @@ public class ReactTextTest {
|
||||
UIManagerModule uiManagerModule = new UIManagerModule(
|
||||
reactContext,
|
||||
viewManagers,
|
||||
new UIImplementationProvider());
|
||||
new UIImplementationProvider(),
|
||||
false);
|
||||
uiManagerModule.onHostResume();
|
||||
return uiManagerModule;
|
||||
}
|
||||
|
||||
@@ -186,7 +186,8 @@ public class TextInputTest {
|
||||
UIManagerModule uiManagerModule = new UIManagerModule(
|
||||
reactContext,
|
||||
viewManagers,
|
||||
new UIImplementationProvider());
|
||||
new UIImplementationProvider(),
|
||||
false);
|
||||
uiManagerModule.onHostResume();
|
||||
return uiManagerModule;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user