Skip to content

Commit

Permalink
fix(react): fix missing textfield helpers
Browse files Browse the repository at this point in the history
  • Loading branch information
dackmin committed Oct 18, 2022
1 parent 3dbc7cb commit 5baeb38
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions packages/react/lib/TextField/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ const TextField = forwardRef(({
valid: state.valid,
dirty: state.dirty,
focused: state.focused,
focus,
blur,
reset,
isJunipero: true,
}));
Expand Down Expand Up @@ -87,6 +89,14 @@ const TextField = forwardRef(({
onBlur?.(e);
};

const focus = () => {
inputRef.current?.focus();
};

const blur = () => {
inputRef.current?.blur();
};

const reset = () => {
dispatch({ value: value ?? '', valid: valid ?? false, dirty: false });
updateControl?.({ dirty: false, valid: valid ?? false });
Expand Down

0 comments on commit 5baeb38

Please sign in to comment.