Let's say I have the input component, and a wrapper component called FancyInput
.
I want to forward the inner Input
ref through FancyInput
, and also use the same ref inside the FancyInput
, like calling ref.focus.
edit:
const SomeComponent = React.forwardRef((props, ref) => {
const textInputRef = useRef<TextInput>(null)
// how should I use textInputRef here, and also
// pass the ref to the FancyInput?
return (
<View>
<FancyInput ref={textInputRef} />
</View>
)
})