Skip to content

Commit

Permalink
Improve NamedInputField onBlur
Browse files Browse the repository at this point in the history
- always trigger onFocus-styles away, and then the optional callback
  • Loading branch information
rottabonus committed Feb 11, 2024
1 parent 63f46c6 commit d33c170
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/Screens/components/NamedInputField.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,13 @@ const NamedInputField = ({
setIsFocused(true);
};

const handleBlur = (
e: RN.NativeSyntheticEvent<RN.TextInputFocusEventData>,
) => {
setIsFocused(false);
textInputProps?.onBlur && textInputProps.onBlur(e);
};

return (
<RN.View style={style}>
<Message style={[styles.nameText, labelStyle]} id={name} />
Expand All @@ -51,8 +58,8 @@ const NamedInputField = ({
editable={true}
secureTextEntry={isSecureText}
onFocus={handleFocus}
onBlur={() => setIsFocused(false)}
{...textInputProps}
onBlur={handleBlur}
/>
{isPasswordInput ? (
<RN.TouchableOpacity
Expand Down

0 comments on commit d33c170

Please sign in to comment.