Implement lazy discovery for ViewManagers.

Reviewed By: kathryngray

Differential Revision: D5865095

fbshipit-source-id: c94970e4cd7aafb20cf844c48feea053ac8b6b0f
This commit is contained in:
Dmitry Zakharov
2017-09-28 09:40:39 -07:00
committed by Facebook Github Bot
parent c4f7ce9afd
commit da30b04703
24 changed files with 469 additions and 169 deletions

View File

@@ -79,13 +79,10 @@ if (Platform.OS === 'ios') {
});
}
});
} else if (
Platform.OS === 'android' &&
UIManager.AndroidLazyViewManagersEnabled
) {
} else if (Platform.OS === 'android' && UIManager.ViewManagerNames) {
UIManager.ViewManagerNames.forEach(viewManagerName => {
defineLazyObjectProperty(UIManager, viewManagerName, {
get: () => NativeModules[viewManagerName.replace(/^(RCT|RK)/, '')],
get: () => UIManager.getConstantsForViewManager(viewManagerName),
});
});
}