Reduced prop mapping overhead

This commit is contained in:
Nick Lockwood
2015-04-22 04:03:46 -07:00
parent 0f7ebf23a9
commit 462224727a
2 changed files with 26 additions and 27 deletions

View File

@@ -41,18 +41,19 @@ function requireNativeComponent(
viewName: string,
wrapperComponent: ?Function
): Function {
var viewConfig = RCTUIManager.viewConfigs && RCTUIManager.viewConfigs[viewName];
if (!viewConfig) {
var viewConfig = RCTUIManager[viewName];
if (!viewConfig || !viewConfig.nativeProps) {
return UnimplementedView;
}
var nativeProps = {
...RCTUIManager.viewConfigs.RCTView.nativeProps,
...RCTUIManager.RCTView.nativeProps,
...viewConfig.nativeProps,
};
viewConfig.uiViewClassName = viewName;
viewConfig.validAttributes = {};
for (var key in nativeProps) {
// TODO: deep diff by default in diffRawProperties instead of setting it here
var differ = TypeToDifferMap[nativeProps[key].type] || deepDiffer;
var differ = TypeToDifferMap[nativeProps[key]] || deepDiffer;
viewConfig.validAttributes[key] = {diff: differ};
}
if (__DEV__) {