Skip to content

Commit 6104ccd

Browse files
Correct the excludePlatforms logic in combining schema step of Codegen (facebook#51910)
Summary: Pull Request resolved: facebook#51910 **Changelog:** [Android] [Fixed] - Fix combining schema in Codegen process to exclude platforms correctly Discovered an issue with how we are excluding platforms in processing codegen schema. `excludedPlatforms` is a field on `OptionsShape` part of `ComponentShape` not Module https://www.internalfb.com/code/fbsource/[153d78d4cd5d0fa652e5a0919bcdb26f32d0945e]/xplat/js/react-native-github/packages/react-native-codegen/src/CodegenSchema.js?lines=112 Hence for components modifying the script to iterate over component and for then exclude accordingly based on `platform`. Reviewed By: cipolleschi Differential Revision: D76158851 fbshipit-source-id: 791ec12d068794e36f34da7419082887483ce6c5
1 parent 84f9e48 commit 6104ccd

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

packages/react-native-codegen/src/cli/combine/combine-schemas-cli.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,20 @@ for (const file of schemaFiles) {
8585
}
8686
}
8787

88+
if (module.type === 'Component') {
89+
const components = module.components || {};
90+
const isExcludedForPlatform = Object.values(components).some(
91+
component =>
92+
component.excludedPlatforms
93+
?.map(p => p.toLowerCase())
94+
.includes(platform),
95+
);
96+
97+
if (isExcludedForPlatform) {
98+
continue;
99+
}
100+
}
101+
88102
modules[specName] = module;
89103
specNameToFile[specName] = file;
90104
}

0 commit comments

Comments
 (0)