I want to make a search bar in react-native like that :
If I click on icon, I focus on textInput, but if I click on other part of screen, unfocus the textInput.
The focus part is working with the ref
, but I don't know if it's possible to unfocus the textinput when I click in other part of the screen.
<TextInput multiline={false} onChangeText={(text) => onChangeText(text)} placeholder="search" style={styles.textInput} value={value} ref={research}></TextInput><TouchableOpacity onPress={()=>research.current.focus()}><Ionicons name="md-search" size={24} ></Ionicons></TouchableOpacity>