-
When defining Codegen specifications for a Fabric component, what's the best way to deal with different props between platforms? It seems that every file ending with NativeComponent gets picked out by Codegen, am I right? So it might generate code for props that will never be used on both platforms. Setting |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
Upon further investigation, I found out that it's possible to specify which platform to exclude directly in the codegenNativeComponent function: export default codegenNativeComponent<NativeProps>('RNComponent', {
excludedPlatforms: ['android'],
}) as HostComponent<NativeProps>; Digging into Codegen source code it also seems that — for modules only — it's possible to separate platforms by appending One thing that's not entirely clear is why C++ files in |
Beta Was this translation helpful? Give feedback.
-
Thanks for your investigation @gispada
Ideally, the codegen should be able to handle
This is a bug to me and should be fixed. Not a major one as you will probably ignore those sources, but still somethign to clean up. |
Beta Was this translation helpful? Give feedback.
Thanks for your investigation @gispada
This is currently not easily doable out of the box. The current solution is either to:
excludedPlatforms: ['...']
as you suggest. You'll be effectively not generating spec for one of the two platform.Ideally, the codegen should be able to handle
.android.js
and.ios.js
file extensions.