参考下面代码片段即可,具体用法的来源在react的文档里面,并没有写在react native的文档里面,所以你找不到:https://facebook.github.io/re... class MyComponent extends Component { ... // 触发滚动到顶部的事件 someEventAfterComponentDidMount() { // 必须在componentDidMount之后才能获取到 this.refs.list this.refs.list.scrollTo([0, 0]); } render = ()=>( <ListView ref="list" /> ) } 补充 刚刚看了下官方文档,上面的写法准备弃用了,改成如下 class MyComponent extends Component { ... // 触发滚动到顶部的事件 someEventAfterComponentDidMount() { // 必须在componentDidMount之后才能获取到 this.listView this.listView.scrollTo([0, 0]); } render = ()=>( <ListView ref={ listView => this.listView = listView} /> ) }
参考下面代码片段即可,具体用法的来源在
react
的文档里面,并没有写在react native
的文档里面,所以你找不到:https://facebook.github.io/re...补充
刚刚看了下官方文档,上面的写法准备弃用了,改成如下