mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-04-04 22:56:32 +08:00
Implement lazy discovery for ViewManagers.
Reviewed By: kathryngray Differential Revision: D5865095 fbshipit-source-id: c94970e4cd7aafb20cf844c48feea053ac8b6b0f
This commit is contained in:
committed by
Facebook Github Bot
parent
c4f7ce9afd
commit
da30b04703
@@ -143,7 +143,7 @@ public class ReactPropConstantsTest {
|
||||
List<ViewManager> viewManagers = Arrays.<ViewManager>asList(new ViewManagerUnderTest());
|
||||
ReactApplicationContext reactContext = new ReactApplicationContext(RuntimeEnvironment.application);
|
||||
UIManagerModule uiManagerModule =
|
||||
new UIManagerModule(reactContext, viewManagers, new UIImplementationProvider(), false, 0);
|
||||
new UIManagerModule(reactContext, viewManagers, new UIImplementationProvider(), 0);
|
||||
Map<String, String> constants =
|
||||
(Map) valueAtPath(uiManagerModule.getConstants(), "SomeView", "NativeProps");
|
||||
assertThat(constants).isEqualTo(
|
||||
|
||||
@@ -69,7 +69,7 @@ public class UIManagerModuleConstantsTest {
|
||||
public void testNoCustomConstants() {
|
||||
List<ViewManager> viewManagers = Arrays.asList(mock(ViewManager.class));
|
||||
UIManagerModule uiManagerModule =
|
||||
new UIManagerModule(mReactContext, viewManagers, mUIImplementationProvider, false, 0);
|
||||
new UIManagerModule(mReactContext, viewManagers, mUIImplementationProvider, 0);
|
||||
Map<String, Object> constants = uiManagerModule.getConstants();
|
||||
assertThat(constants)
|
||||
.containsKey(CUSTOM_BUBBLING_EVENT_TYPES)
|
||||
@@ -84,7 +84,7 @@ public class UIManagerModuleConstantsTest {
|
||||
when(mockViewManager.getExportedCustomBubblingEventTypeConstants())
|
||||
.thenReturn(MapBuilder.of("onTwirl", TWIRL_BUBBLING_EVENT_MAP));
|
||||
UIManagerModule uiManagerModule =
|
||||
new UIManagerModule(mReactContext, viewManagers, mUIImplementationProvider, false, 0);
|
||||
new UIManagerModule(mReactContext, viewManagers, mUIImplementationProvider, 0);
|
||||
Map<String, Object> constants = uiManagerModule.getConstants();
|
||||
assertThat((Map) constants.get(CUSTOM_BUBBLING_EVENT_TYPES))
|
||||
.contains(MapEntry.entry("onTwirl", TWIRL_BUBBLING_EVENT_MAP))
|
||||
@@ -98,7 +98,7 @@ public class UIManagerModuleConstantsTest {
|
||||
when(mockViewManager.getExportedCustomDirectEventTypeConstants())
|
||||
.thenReturn(MapBuilder.of("onTwirl", TWIRL_DIRECT_EVENT_MAP));
|
||||
UIManagerModule uiManagerModule =
|
||||
new UIManagerModule(mReactContext, viewManagers, mUIImplementationProvider, false, 0);
|
||||
new UIManagerModule(mReactContext, viewManagers, mUIImplementationProvider, 0);
|
||||
Map<String, Object> constants = uiManagerModule.getConstants();
|
||||
assertThat((Map) constants.get(CUSTOM_DIRECT_EVENT_TYPES))
|
||||
.contains(MapEntry.entry("onTwirl", TWIRL_DIRECT_EVENT_MAP))
|
||||
@@ -113,7 +113,7 @@ public class UIManagerModuleConstantsTest {
|
||||
when(mockViewManager.getExportedViewConstants())
|
||||
.thenReturn(MapBuilder.of("PhotoSizeType", MapBuilder.of("Small", 1, "Large", 2)));
|
||||
UIManagerModule uiManagerModule =
|
||||
new UIManagerModule(mReactContext, viewManagers, mUIImplementationProvider, false, 0);
|
||||
new UIManagerModule(mReactContext, viewManagers, mUIImplementationProvider, 0);
|
||||
Map<String, Object> constants = uiManagerModule.getConstants();
|
||||
assertThat(constants).containsKey("RedPandaPhotoOfTheDayView");
|
||||
assertThat((Map) constants.get("RedPandaPhotoOfTheDayView")).containsKey("Constants");
|
||||
@@ -129,7 +129,7 @@ public class UIManagerModuleConstantsTest {
|
||||
when(mockViewManager.getNativeProps())
|
||||
.thenReturn(MapBuilder.of("fooProp", "number"));
|
||||
UIManagerModule uiManagerModule =
|
||||
new UIManagerModule(mReactContext, viewManagers, mUIImplementationProvider, false, 0);
|
||||
new UIManagerModule(mReactContext, viewManagers, mUIImplementationProvider, 0);
|
||||
Map<String, Object> constants = uiManagerModule.getConstants();
|
||||
assertThat((String) valueAtPath(constants, "SomeView", "NativeProps", "fooProp"))
|
||||
.isEqualTo("number");
|
||||
@@ -161,7 +161,7 @@ public class UIManagerModuleConstantsTest {
|
||||
|
||||
List<ViewManager> viewManagers = Arrays.asList(managerX, managerY);
|
||||
UIManagerModule uiManagerModule =
|
||||
new UIManagerModule(mReactContext, viewManagers, mUIImplementationProvider, false, 0);
|
||||
new UIManagerModule(mReactContext, viewManagers, mUIImplementationProvider, 0);
|
||||
Map<String, Object> constants = uiManagerModule.getConstants();
|
||||
assertThat((Map) constants.get(CUSTOM_DIRECT_EVENT_TYPES)).containsKey("onTwirl");
|
||||
|
||||
|
||||
@@ -816,7 +816,7 @@ public class UIManagerModuleTest {
|
||||
new ReactTextViewManager(),
|
||||
new ReactRawTextManager());
|
||||
UIManagerModule uiManagerModule =
|
||||
new UIManagerModule(mReactContext, viewManagers, new UIImplementationProvider(), false, 0);
|
||||
new UIManagerModule(mReactContext, viewManagers, new UIImplementationProvider(), 0);
|
||||
uiManagerModule.onHostResume();
|
||||
return uiManagerModule;
|
||||
}
|
||||
|
||||
@@ -430,7 +430,7 @@ public class ReactTextTest {
|
||||
new ReactRawTextManager(),
|
||||
});
|
||||
UIManagerModule uiManagerModule =
|
||||
new UIManagerModule(reactContext, viewManagers, new UIImplementationProvider(), false, 0);
|
||||
new UIManagerModule(reactContext, viewManagers, new UIImplementationProvider(), 0);
|
||||
uiManagerModule.onHostResume();
|
||||
return uiManagerModule;
|
||||
}
|
||||
|
||||
@@ -180,7 +180,7 @@ public class TextInputTest {
|
||||
new ReactTextInputManager(),
|
||||
});
|
||||
UIManagerModule uiManagerModule =
|
||||
new UIManagerModule(reactContext, viewManagers, new UIImplementationProvider(), false, 0);
|
||||
new UIManagerModule(reactContext, viewManagers, new UIImplementationProvider(), 0);
|
||||
uiManagerModule.onHostResume();
|
||||
return uiManagerModule;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user