Skip to content

Commit

Permalink
feat(Input): add autofocus support
Browse files Browse the repository at this point in the history
  • Loading branch information
zouxuoz committed Mar 18, 2019
1 parent 265400d commit 2af0817
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/common/Tag/Tag.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ type TagProps = {|
const COLLECTED_PROPS = [
'aria-busy',
'autoComplete',
'autoFocus',
'checked',
'children',
'className',
Expand Down
4 changes: 4 additions & 0 deletions src/components/Input/Input.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ type InputCommonProps = {
placeholder?: string,
/** html auto-complete representation */
autoComplete?: boolean,
/** html auto-focus representation */
autoFocus?: boolean,
/** disabled */
disabled?: boolean,
/** when true then stretch to the maximal width */
Expand Down Expand Up @@ -121,6 +123,7 @@ class Input extends PureComponent<InputProps> {
readOnly,
clearable,
onClear,
autoFocus,
...rest
} = this.props;
const hasLeftIcon = !!leftIcon;
Expand All @@ -145,6 +148,7 @@ class Input extends PureComponent<InputProps> {
disabled,
readOnly,
stretch,
autoFocus,
};

return (
Expand Down
5 changes: 4 additions & 1 deletion src/components/InputField/InputField.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ type InputFieldProps = {
disabled?: boolean,
/** callback which called on clear */
onClear?: () => void,

/** html auto-focus representation */
autoFocus?: boolean,
};

const InputField = ({
Expand All @@ -63,6 +64,7 @@ const InputField = ({
disabled,
readOnly,
autoComplete,
autoFocus,
onClear,
...rest
}: InputFieldProps) => {
Expand Down Expand Up @@ -103,6 +105,7 @@ const InputField = ({
leftIcon={ leftIcon }
rightIcon={ rightIcon }
onClear={ onClear }
autoFocus={ autoFocus }
/>
</FormField>
);
Expand Down

0 comments on commit 2af0817

Please sign in to comment.