Material-ui-pickers: focus loses after each keyboard input for custom TextFieldComponent

Created on 15 Jul 2019  路  7Comments  路  Source: mui-org/material-ui-pickers

Overriding TextFieldComponent forces losing focus after each keyboard input

TextFieldComponent={props => { return ( <TextField {...props} value={formattedValue} onChange={event => setFormattedValue(event.target.value)} /> ); }}

Live example

Sandbox example https://codesandbox.io/embed/datepicker-y0dn7

Most helpful comment

All 7 comments

You must call props.onChange on textfield change. But the issue is that you are changing the datepicker value on each keystroke. It forces to reapply value
https://codesandbox.io/embed/datepicker-y0dn7

So there is no way to pass a value to custom TextFieldComponent?

Ohh god you are using v2. We are not supporting it
In v3 you can use inputValue and pass any string from the root of <KeyboardDatePicker />

I still can't understand how to make it work

https://codesandbox.io/embed/clever-brattain-5bujt

Having same issue as @bjutkoski .
@dmtrKovalenko can you provide more details or example please?

So simple. Thank you @dmtrKovalenko
@De-Santa it works for me

Was this page helpful?
0 / 5 - 0 ratings

Related issues

sakulstra picture sakulstra  路  3Comments

Lysander picture Lysander  路  3Comments

filipenevola picture filipenevola  路  4Comments

Harasz picture Harasz  路  3Comments

mnemanja picture mnemanja  路  3Comments