From d33c17092769114fff55806ff042f0dcc81fe131 Mon Sep 17 00:00:00 2001 From: Felix Hallenberg Date: Sun, 11 Feb 2024 12:32:21 +0200 Subject: [PATCH] Improve NamedInputField onBlur - always trigger onFocus-styles away, and then the optional callback --- src/Screens/components/NamedInputField.tsx | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/Screens/components/NamedInputField.tsx b/src/Screens/components/NamedInputField.tsx index 861d6405..d5496c76 100644 --- a/src/Screens/components/NamedInputField.tsx +++ b/src/Screens/components/NamedInputField.tsx @@ -37,6 +37,13 @@ const NamedInputField = ({ setIsFocused(true); }; + const handleBlur = ( + e: RN.NativeSyntheticEvent, + ) => { + setIsFocused(false); + textInputProps?.onBlur && textInputProps.onBlur(e); + }; + return ( @@ -51,8 +58,8 @@ const NamedInputField = ({ editable={true} secureTextEntry={isSecureText} onFocus={handleFocus} - onBlur={() => setIsFocused(false)} {...textInputProps} + onBlur={handleBlur} /> {isPasswordInput ? (