如何在聚焦材料-ui TextField时打开IOS键盘?

时间:2017-11-14 10:18:08

标签: javascript ios material-ui

我无法让移动设备上的IOS键盘在焦点上打开。任何建议的解决方案或解决方法?我摆弄了autoFocus属性,但它不会打开键盘。目前的代码:

class Input extends React.Component {
    muiTextFieldRef = null;
    get inputNode() {
      if (!this.muiTextFieldRef) {
         return null;
      }
      return this.muiTextFieldRef.getInputNode();
    }

    componentDidMount() {
      if(this.inputNode) {
        this.inputNode.focus();
      }
    }

    render() {
      return (
        <TextField
           ref={(muiTextFieldRef) => {
             this.muiTextFieldRef = muiTextFieldRef;
           }}
        />
      );
    }
}

0 个答案:

没有答案