I'm creating a custom component for TextInput. But I've got a problem when I try to pass a function prop to the custom component. This is the code
// Screen.tsxexport const RegisterScreen = ({props}: Props) => { const [text, setText] = useState(""); const onChangeInputText = (text: string) => setText(text); return (<View><CustomInput onChangeText={onChangeInputText} text={text} /></View>// CustomTextInput.tsxtype Props = { onChangeText: () => void; text?: string;};export const CustomInput = ({ onChangeText, text }: Props) => { return (<TextInput style={styles.container} onChangeText={onChangeText} value={text} placeholder="Type here" /> );};
With this code, I got this error
Type '(text: string) => void' is not assignable to type '() => void'
I think I know what causes this (it's probably on the type declaration?) but since this is actually my first time trying TypeScript, I can't really figure out how to solve this. Tried googling about this first but I didn't find any error similar to mine.