React中的合成触摸事件

时间:2017-03-15 22:10:18

标签: reactjs touch-event synthetic

使用以下.js,在浏览器中调整文本区域大小不会显示任何触摸事件类型,尽管其他事件按预期工作。

class App extends React.Component{
    constructor(){
        super();
        this.state = {currentEvent: "---"};
        this.update = this.update.bind(this)
    }

    update(e){
        this.setState({currentEvent: e.type})
    }


    render(){
        return (
            <div>
                <textarea cols='30' rows='10' 
                    onKeyPress={this.update}
                    onCopy={this.update}
                    onDoubleClick={this.update}
                    onTouchStart={this.update}
                    onTouchMove={this.update}
                    onTouchEnd={this.update}
                    />
                <h1>{this.state.currentEvent}</h1>
            </div>
        )
    }
}

export default App

1 个答案:

答案 0 :(得分:0)

基本上没有浏览器会触发FATAL EXCEPTION: main Process: com.example.gdick.databasepractice2, PID: 8071 java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.gdick.databasepractice2/com.example.gdick.databasepractice2.MainActivity}: android.database.sqlite.SQLiteException: near "Details": syntax error (code 1): , while compiling: CREATE TABLE Registration Details(1 INTEGER PRIMARY KEY AUTOINCREMENT,email_address TEXT,user_name TEXT,password TEXT,dob TEXT,mobile_number TEXT) 的{​​{1}}事件。相反,您必须监听用户调整大小后发生的resizetextarea事件。但是,由于只需单击mouseup即可触发这些事件,您可能希望将元素的新大小与旧大小进行比较,以确定它是否实际调整大小。

相关问题