点击输入时,Chrome Android React键盘消失

时间:2018-10-30 07:49:01

标签: android reactjs google-chrome

因此,我的网站已删除-当我单击来自Android 9或8(三星)的新一代Android设备的输入时 S9或S8,Huaweii P9,...)键盘出现,但立即消失。 代码是这样的:

import React from "react";
import immer from "immer";

export default class LoginPage extends React.Component {
    constructor(props) {
        super(props);

        this.userRef = React.createRef();

        this.state = {
            user: "",
            pass: ""
        };
    }

    render() {
        return [
            <h1 key="title">Panoro</h1>,
            <form 
                key="form"
                id="loginForm" 
                onSubmit={(e) => { e.preventDefault(); setTimeout(this.onFormSubmit, 200); }} 
                autoComplete="new-password"
            >
                <input 
                    key="userInput" 
                    ref={this.userRef} 
                    type="text" 
                    placeholder="Email"
                    value={this.state.user}
                    onChange={(e) => { 
                        this.setState(immer(this.state, draftState => {
                            draftState.user = e.target.value;
                        })); 
                    }} 
                    required
                />
                <input 
                    key="passInput" 
                    type="password" 
                    placeholder="Parola" 
                    value={this.state.pass} 
                    onChange={(e) => { 
                        this.setState(immer(this.state, draftState => {
                            draftState.pass = e.target.value; 
                        }));
                    }} 
                    required
                />
                <button type="submit">{(this.isInvite) ? "Inregistrare" : "Login"}</button>
            </form>
        ];
    }
} 

0 个答案:

没有答案