Working with styled components in React Native, I've implemented a boolean value named isTablet. This value is then passed as a prop called platform to the IdTextInput component, which utilizes the TextInput tag.
Though this setup functions correctly, it triggers a type warning:
Property 'platform' does not exist on type 'ThemedStyledProps<TextInputProps & RefAttributes<TextInput>, DefaultTheme>'
No overload matches this call.
Overload 1 of 2, '(props: Omit<Omit<TextInputProps & RefAttributes<TextInput>, never> & Partial<Pick<TextInputProps & RefAttributes<TextInput>, never>>, "theme">....
I attempted to resolve this by defining a boolean type in props, but this approach failed. How should I go about fixing this issue?
const IdTextInput = styled.TextInput`
width: ${(props) =>
props.platform ? 50 : 100}%;
`;
const isTablet = DeviceInfo.isTablet();
return (
<IdTextInput
platform={isTablet}
/>
)