Im using platform specific file extensions. If the platform is web
then a ref
is not needed, but for both Android and iOS it is. It seems TypeScript isn’t aware of how this works and is giving me a prop types error:
<MyComponent
foo={bar}
ref={Platform.OS === "web" ? null : childRef}
/>
I could use a ternary operator to use the right component, however presumably then both components would be loaded leading to a needlessly larger bundle size?:
{ Platform.OS === "web" ? <MyWebComponent foo={bar} /> : <MyNativeComponent foo={bar} ref={childRef} /> }
My project uses expo version ^37.0.0 and my CLI version is: 3.17.20.