Correctly generate viewConfig for shadow properties

Reviewed By: fkgozali

Differential Revision: D4090109

fbshipit-source-id: 6aa24ae95ddcbdabdc5d1da8ab817960bde960a4
This commit is contained in:
Pieter De Baets 2016-10-27 12:37:52 -07:00 committed by Facebook Github Bot
parent 844cafd883
commit 285786ad30
1 changed files with 8 additions and 2 deletions

View File

@ -414,11 +414,17 @@ RCT_NOT_IMPLEMENTED(- (instancetype)init)
for (unsigned int i = 0; i < count; i++) { for (unsigned int i = 0; i < count; i++) {
SEL selector = method_getName(methods[i]); SEL selector = method_getName(methods[i]);
const char *selectorName = sel_getName(selector); const char *selectorName = sel_getName(selector);
if (strncmp(selectorName, "propConfig_", strlen("propConfig_")) != 0) { if (strncmp(selectorName, "propConfig", strlen("propConfig")) != 0) {
continue; continue;
} }
NSString *name = @(selectorName + strlen("propConfig_")); // We need to handle both propConfig_* and propConfigShadow_* methods
const char *underscorePos = strchr(selectorName + strlen("propConfig"), '_');
if (!underscorePos) {
continue;
}
NSString *name = @(underscorePos + 1);
NSString *type = ((NSArray<NSString *> *(*)(id, SEL))objc_msgSend)(_managerClass, selector)[0]; NSString *type = ((NSArray<NSString *> *(*)(id, SEL))objc_msgSend)(_managerClass, selector)[0];
if (RCT_DEBUG && propTypes[name] && ![propTypes[name] isEqualToString:type]) { if (RCT_DEBUG && propTypes[name] && ![propTypes[name] isEqualToString:type]) {
RCTLogError(@"Property '%@' of component '%@' redefined from '%@' " RCTLogError(@"Property '%@' of component '%@' redefined from '%@' "