Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -328,10 +328,24 @@ exports[`execute test-app "ReactCodegen/RCTThirdPartyComponentsProvider.mm" shou
static dispatch_once_t nativeComponentsToken;

dispatch_once(&nativeComponentsToken, ^{
thirdPartyComponents = @{
@\\"TestAppComponent\\": NSClassFromString(@\\"RCTTestAppComponent\\"), // test-app
@\\"TestLibraryComponent\\": NSClassFromString(@\\"RCTTestLibraryComponent\\"), // test-library
NSDictionary<NSString *, NSString *> * componentMapping = @{
@\\"TestAppComponent\\": @\\"RCTTestAppComponent\\", // test-app
@\\"TestLibraryComponent\\": @\\"RCTTestLibraryComponent\\", // test-library
};

NSMutableDictionary *dict = [[NSMutableDictionary alloc] initWithCapacity:componentMapping.count];

for (NSString *key in componentMapping) {
// Nil for a library this target does not link (an app extension, macOS).
Class klass = NSClassFromString(componentMapping[key]);
if (!klass) {
continue;
}

[dict setObject:klass forKey:key];
}

thirdPartyComponents = dict;
});

return thirdPartyComponents;
Expand Down Expand Up @@ -817,9 +831,23 @@ exports[`execute test-app-legacy "ReactCodegen/RCTThirdPartyComponentsProvider.m
static dispatch_once_t nativeComponentsToken;

dispatch_once(&nativeComponentsToken, ^{
thirdPartyComponents = @{
@\\"TestAppDeprecatedComponent\\": NSClassFromString(@\\"RCTTestAppDeprecatedComponentClass\\"), // test-app-legacy
NSDictionary<NSString *, NSString *> * componentMapping = @{
@\\"TestAppDeprecatedComponent\\": @\\"RCTTestAppDeprecatedComponentClass\\", // test-app-legacy
};

NSMutableDictionary *dict = [[NSMutableDictionary alloc] initWithCapacity:componentMapping.count];

for (NSString *key in componentMapping) {
// Nil for a library this target does not link (an app extension, macOS).
Class klass = NSClassFromString(componentMapping[key]);
if (!klass) {
continue;
}

[dict setObject:klass forKey:key];
}

thirdPartyComponents = dict;
});

return thirdPartyComponents;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ function generateRCTThirdPartyComponents(
.flatMap(library => {
const components = componentsInLibraries[library];
return components.map(({componentName, className}) => {
return `\t\t@"${componentName}": NSClassFromString(@"${className}"), // ${library}`;
return `\t\t@"${componentName}": @"${className}", // ${library}`;
});
})
.join('\n');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,23 @@
static dispatch_once_t nativeComponentsToken;

dispatch_once(&nativeComponentsToken, ^{
thirdPartyComponents = @{
NSDictionary<NSString *, NSString *> * componentMapping = @{
{thirdPartyComponentsMapping}
};

NSMutableDictionary *dict = [[NSMutableDictionary alloc] initWithCapacity:componentMapping.count];

for (NSString *key in componentMapping) {
// Nil for a library this target does not link (an app extension, macOS).
Class klass = NSClassFromString(componentMapping[key]);
if (!klass) {
continue;
}

[dict setObject:klass forKey:key];
}

thirdPartyComponents = dict;
});

return thirdPartyComponents;
Expand Down