Closed shilangyu closed 5 years ago
Should've done much more research before posting, stories' code helped a lot:
<MuiDownshift
getInputProps={() => ({
value: 'default value'
})}
items={filteredItems}
inputRef={node => {
this.input = node
}}
/>
The above method works only visually, mui-downshift doesnt see the value. Reopening.
@shilangyu As this is a wrapper over downshift, I think you need to pass in the actual downshift props to set the initial value or selected value.
See initialSelectedItem and initialInputValue
@cvanem thank you for your reply. I tried both and couldnt get them to work:
<MuiDownshift
initialInputValue={'default value'}
items={filteredItems}
inputRef={node => {
this.input = node
}}
/>
<MuiDownshift
initialSelectedItem={'default value'}
items={filteredItems}
inputRef={node => {
this.input = node
}}
/>
@shilangyu It doesn't appear to be working for me either.
It looks like this package may be using an older version of downshift. See old documentation.
I was able to get it working with defaultSelectedItem:
<StarWarsSelect defaultSelectedItem={{ label: '4-LOM', value: 0 }} />
@techniq Is it time to update this library to downshift 3.x? It looks like it is still using 2.x.
Sure. I'd really like to finish the rewrite to drop react-virtualize so it's all part of the next major semver.
On Sat, Mar 9, 2019, 4:28 PM cvanem notifications@github.com wrote:
@techniq https://github.com/techniq Is it time to update this library to downshift 3.x? It looks like it is still using 2.x.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/techniq/mui-downshift/issues/79#issuecomment-471223588, or mute the thread https://github.com/notifications/unsubscribe-auth/AAK1RGGKF100PpNr0JsCY3nO_ZkJHZ5Bks5vVCeJgaJpZM4bm0Jt .
Downshift 2.x method did work for mui-downshift v1.4.1 Thank you for your help
How do I set the current value programmatically? I want to create a default value during render.