mirror of
https://github.com/react/react-native.git
synced 2026-09-28 13:23:09 +08:00
Correct the excludePlatforms logic in combining schema step of Codegen (#51910)
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/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
This commit is contained in:
committed by
Facebook GitHub Bot
parent
84f9e48331
commit
6104ccdc6e
@@ -85,6 +85,20 @@ for (const file of schemaFiles) {
|
||||
}
|
||||
}
|
||||
|
||||
if (module.type === 'Component') {
|
||||
const components = module.components || {};
|
||||
const isExcludedForPlatform = Object.values(components).some(
|
||||
component =>
|
||||
component.excludedPlatforms
|
||||
?.map(p => p.toLowerCase())
|
||||
.includes(platform),
|
||||
);
|
||||
|
||||
if (isExcludedForPlatform) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
modules[specName] = module;
|
||||
specNameToFile[specName] = file;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user