Skip to content

Commit

Permalink
Add onFocus support to TypeaheadField
Browse files Browse the repository at this point in the history
This resolves my issue RXNT#93.
  • Loading branch information
Kilian authored Jul 25, 2018
1 parent 70598a5 commit 981c57b
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/TypeaheadField.js
Original file line number Diff line number Diff line change
Expand Up @@ -174,9 +174,11 @@ export class TypeaheadField extends BaseTypeaheadField {

let labelKey = mapLabelKey(typeahead.labelKey);
let selected = toSelected(formData, schema, typeahead.mapping, labelKey);
let onFocus = () => { this.props.onFocus($id); }

let typeConf = Object.assign({}, DEFAULT_OPTIONS, typeahead, {
onChange: this.handleSelectionChange(typeahead),
onFocus,
labelKey,
selected,
});
Expand Down Expand Up @@ -251,11 +253,13 @@ export class AsyncTypeaheadField extends BaseTypeaheadField {
asyncTypeahead.mapping,
labelKey
);
let onFocus = () => { this.props.onFocus($id); }

let typeConf = Object.assign({}, DEFAULT_OPTIONS, asyncTypeahead, {
selected,
labelKey,
onChange: this.handleSelectionChange(asyncTypeahead),
onFocus,
onSearch: this.handleSearch,
options: this.state.options,
});
Expand Down

0 comments on commit 981c57b

Please sign in to comment.