Closed barbalex closed 8 years ago
I can confirm, that passing values to inputProps doesn't work for me. Could you please fix it?
value
prop is accepted by TypeaheadComponent itself
<Typeahead
inputProps={{name: "q", autoComplete: "off"}}
onOptionSelected={this.handleOptionSelected}
ref="typeahead"
value="abcd"
....
that only works on first load for me
2015-08-25 22:53 GMT+02:00 Ceslovas Lopan notifications@github.com:
value prop is accepted by TypeaheadComponent itself
<Typeahead inputProps={{name: "q", autoComplete: "off"}} onOptionSelected={this.handleOptionSelected} ref="typeahead" value="abcd" ....
— Reply to this email directly or view it on GitHub https://github.com/fmoo/react-typeahead/issues/96#issuecomment-134737686 .
I'm loading Typeahead with inputProps in a modal and it doesn't look like working.
<Typeahead
options={['John', 'Paul', 'George', 'Ringo']}
maxVisible={5}
placeholder="Add people"
inputProps={{ ref: 'peopleName' }}
customClasses={{
input: 'people-name'
}}
/>
Do I miss something?
FYI @fmoo
I found this solution to empty the typeahead in a different issue:
this.refs.typeahead.setState({
entryValue: '',
selection: null,
selectionIndex: null,
visible: []
})
@aganglada change ref
to Ref
with uppercase
Noob alarm: this issue is probably only due to my not understanding React or react-typeahead yet. If so, sorry for pestering you issues list.
I am trying to control the content of the typeahead input, for instance:
My idea was to incorporate the selected option in state. When the typeahead input should empty, I would pass it's inputProps an apropriate option (I am not 100% sure what this option would look like though).
My options are built like this example:
To see if this basically works, I tested if I could pass a specific option via inputProps like this:
and inside render:
Unfortunately the passed in option does not appear in the typeahead input.
What am I doing wrong?