-
开满天机
触摸事件:onTouchCancel\onTouchEnd\onTouchMove\onTouchStart(只会在移动设备上接受)键盘事件:onKeyDown\onKeyPress\onKeyUp剪切事件:onCopy\onCut\onPaste表单事件:onChange\onInput\onSubmit焦点事件:onFocus\onBlurUI元素:onScroll(移动设备是手指滚动和PC的鼠标滑动)滚动事件:onWheel(鼠标滚轮)鼠标类型:onClick\onContextMenu(右键)\onDoubleClick\onMouseDown\onMouseEnter\onMouseLeave\onMouseMove\onMouseOut\onMouseOver\onMouseUponDrag\onDrop\onDragEnd\onDragEnter\onDragExit\onDragLeave\onDragOver\onDragStart
-
慕少森
state在constructor方法里写...constructor(props) {this.state = {n: ...}}写default props有两种方法//1 在组件内部的使用static...static defaultProps = {name: ...}//2 在组件外部Hello.defaultProps = {name: ...}
-
翻阅古今
解决方法可以参照这个代码试一试。const { quotes } = require('./quotes.json')classQuoteScreen extends Component {state = {QuoteIndex: 0}handleUpdateState = () => {this.setState(({ QuoteIndex }) => ({QuoteIndex: (QuoteIndex + 1) % (quotes.length - 1)}));}render() {return (<Image ...><View ...>...<ButtonNextQuoteonPress={this.handleUpdateState}/></View></Image>)}}