I have an component called TextInput extending React-native's TextInput.I founded that the component name is used as a type of Ref:const ref = useRef<TextInput | null>(null)
How can I achieve this (without using typeof)?
Below is my code:
export interface TextInputProps extends ComponentPropsWithRef<typeof RNTextInput>, RNTextInputProps {}const TextInputComponent = forwardRef<RNTextInput, TextInputProps>( ({ style, ...rest }: TextInputProps, ref: Ref<RNTextInput>) => { return (<RNTextInput ref={ref} style={[styles.textInput, style]} {...rest} /> ); },);const TextInput = memo(TextInputComponent);TextInput.displayName = 'TextInput';export default TextInput;
I looked up at others code, but still did not get it