Removed duplicate UIManager constants

Summary: public

We were calling constantsToExport twice for every ViewManager, and including two copies of the values in __fbBatchedBridgeConfig. This diff removes the copy from UIManager and then puts it back on the JS side.

Reviewed By: tadeuzagallo

Differential Revision: D2665625

fb-gh-sync-id: 147ec4bfb404835e3875964476ba233d619c28aa
This commit is contained in:
Nick Lockwood
2015-11-18 04:45:22 -08:00
committed by facebook-github-bot-7
parent 32c19c1994
commit ca20d710fc
2 changed files with 28 additions and 8 deletions

View File

@@ -1197,14 +1197,8 @@ RCT_EXPORT_METHOD(clearJSResponder)
NSMutableDictionary<NSString *, id> *constantsNamespace =
[NSMutableDictionary dictionaryWithDictionary:allJSConstants[name]];
// Add custom constants
// TODO: should these be inherited?
NSDictionary<NSString *, id> *constants = RCTClassOverridesInstanceMethod([manager class], @selector(constantsToExport)) ? [manager constantsToExport] : nil;
if (constants.count) {
RCTAssert(constantsNamespace[@"Constants"] == nil , @"Cannot redefine Constants in namespace: %@", name);
// add an additional 'Constants' namespace for each class
constantsNamespace[@"Constants"] = constants;
}
// Add manager class
constantsNamespace[@"Manager"] = RCTBridgeModuleNameForClass([manager class]);
// Add native props
NSDictionary<NSString *, id> *viewConfig = [componentData viewConfig];