react-native-currency-input
react-native-currency-input copied to clipboard
onFocus not working
onFocus does not work for CurrencyInput.
function test(props) {
const [value, setValue] = React.useState(null);
function focus() {
console.log("FOCUSED")
}
function blur() {
console.log("BLURRED")
}
return (
<CurrencyInput
value={value}
onChangeValue={setValue}
prefix=""
delimiter=","
separator="."
precision={1}
minValue={0}
maxValue={100}
suffix="%"
onFocus={focus}
onBlur={blur}
{...props}
/>
);
}
onBlur works and prints "BLURRED". "FOCUSED" is never printed. I am using onPressIn with the isFocused function to approximate onFocus, but it would be better if it just worked.
function test(props) {
const testRef = useRef(null);
const [value, setValue] = React.useState(null);
function checkFocus() {
setTimeout(function(){
if (testRef.current.isFocused()) {
console.log("FOCUSED")
}
},100);
}
function blur() {
console.log("BLURRED")
}
return (
<CurrencyInput
value={value}
onChangeValue={setValue}
prefix=""
delimiter=","
separator="."
precision={1}
minValue={0}
maxValue={100}
suffix="%"
ref={testRef}
onPressIn={checkFocus}
onBlur={blur}
{...props}
/>
);
}
Any updates?
Similar for me, onFocus works but onBlur does not