I got an error when I tried to focus a TextInput after selecting a Dropdown value.And also, when I tried to write, it's lost focus, but I think it is related to how I'm trying to do this.
This is the function that I use to set the inputRef
let inputRef = useRef<TextInput | null>(null) const onSelectFormat = (format) => { setDropdownListVisibility('') setInputFocused(true) inputRef.current && inputRef.current.focus() }
The CustomInput Component that I send the inputRef variable
<CustomInput value={value} onChangeText={onChangeInputText} isFocused={isInputFocused} onFocus={() => setInputFocused(true)} getRef={ref => (inputRef = { current: ref })} />
And finally, this is the child component that I pass the ref.
<TextInput ref={getRef} value={value} onChangeText={onChangeText} style={styles.input} onFocus={onFocus} />