TextInput is working fine on android but on ios, it's not working until I added the prop autoFocus in TextInput. But after adding it works on a first component mount and then again I am not able to use the keyboard or write something in TextInput.
<TouchableOpacity
activeOpacity={0.7}
onLongPress={() => console.log("Long pressed")}
style={{ ...this.props.itemStyle }}
onPress={() => {
console.log("Item is", item);
this.setState({ item: item, focus: false });
// this.props.onItemSelect(item);
Keyboard.dismiss();
setTimeout(() => {
this.props.onItemSelect(item);
if (this.props.resetValue) {
this.setState({ focus: false, item: defaultItemValue });
this.input.focus();
}
}, 0);
}}
>
{this.props.selectedItems &&
this.props.selectedItems.length > 3 &&
this.props.selectedItems.find((x) => x.id === item.id) ? null : (
<Image style={{ margin: 2 }} source={trend} />
)}
<Text style={{ ...this.props.itemTextStyle }}>{item.name}</Text>
</TouchableOpacity>
<TextInput
autoFocus
pointerEvents="none"
autoCapitalize="none"
onKeyPress={null}
{...textInputProps}
/>
I don't know how can make it focused?