Im trying to detect when user click outside the input, but feel like it only work with onFocus but it onBlur don't do anything, here is the simple code
/* eslint-disable react-native/no-inline-styles */
import React, {useState} from 'react';
import {
TouchableWithoutFeedback,
TextInput,
View,
SafeAreaView,
} from 'react-native';
const TextInputTest = () => {
const [isBorder, setBorder] = useState(false);
return (
<SafeAreaView
style={{flex: 1, justifyContent: 'center', alignItems: 'center'}}>
<View style={{borderWidth: isBorder ? 1 : 0}}>
<TextInput
placeholder="sometext"
onFocus={() => setBorder(!isBorder)}
onBlur={() => setBorder(!isBorder)}
/>
</View>
</SafeAreaView>
);
};
export default TextInputTest;
I can only see the border turn black and it never blank again, what happen, please help, thank you a lots
