material-ui textfield with japanese -
excuse poor english.
'textfield' of material-ui have problem japanese input. when use inside 'dialog' tag.
first letter determined without consideration. example, entering 'da' should 'だ', 'pa' should 'ぱ'. become 'dあ' , 'pあ' because first letter determined automatically.
when first letter entered, should suspended until second letter inputted.
does have idea?
import react, { component } 'react'; import dialog 'material-ui/dialog'; import textfield 'material-ui/textfield'; export default class mymodal extends component { constructor(props) { super(props); this.state = { question: '', }; this.oninputchange = this.oninputchange.bind(this); } oninputchange(event) { this.setstate({ question: event.target.value, }); } render() { return ( <dialog open > <textfield value={this.state.question} onchange={this.oninputchange} /> </dialog> ); } }
i think it's material-ui bug. found 2 solutions work around it.
1: don't put value state of textfield in dialog. should write below:
class myform extends component { constructor(props) { super(props); this.state = { question: '', }; this.oninputchange = this.oninputchange.bind(this); } oninputchange(event) { this.setstate({ question: event.target.value, }); } render() { return ( <textfield value={this.state.question} onchange={this.oninputchange} /> ); } } export default class mymodal extends component { render() { return ( <dialog open > <myform /> </dialog> ); } }
2; or can extend material-ui textfield little fix. way pretty dangerous. works fine me now. (i'm using material-ui 0.15.4)
export default class fixedtextfield extends mui.textfield { handleinputchange = (event) => { if (this.props.onchange) this.props.onchange(event, event.target.value); } }
Comments
Post a Comment