Skip to content

Commit d4d1788

Browse files
cipolleschiblakef
authored andcommitted
Exclude mapping generation of core component (#48145)
Summary: Pull Request resolved: #48145 While writing the docs for 0.77, I found an edge case in the generation of the RCTThirdPartyComponentProvider: * If the app has the `codegenConfig` field set in the `package.json` * And it does not have the `ios.componentProvider` field is not provided Codegen was generating the mapping for the react-native core components. That's not expected as, in that case, it should only generate components that are declared in the app or in libraries. This change fixes this edge case. ## Changelog: [Internal] - Exclude mapping generation of core component Reviewed By: blakef Differential Revision: D66875080 fbshipit-source-id: 65fe10381729ec7808efec70feacf2a55f0056e9
1 parent a78d74c commit d4d1788

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

packages/react-native/scripts/codegen/generate-artifacts-executor.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -778,6 +778,11 @@ function findFilesWithExtension(filePath, extension) {
778778
// Given a filepath, read the file and look for a string that starts with 'Class<RCTComponentViewProtocol> '
779779
// and ends with 'Cls(void)'. Return the string between the two.
780780
function findRCTComponentViewProtocolClass(filepath) {
781+
// Exclude files provided by react-native
782+
if (filepath.includes(`${path.sep}react-native${path.sep}`)) {
783+
return null;
784+
}
785+
781786
const fileContent = fs.readFileSync(filepath, 'utf8');
782787
const regex = /Class<RCTComponentViewProtocol> (.*)Cls\(/;
783788
const match = fileContent.match(regex);

0 commit comments

Comments
 (0)