使用以下 .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