rn 点击按钮 屏幕滑动到底部

<ScrollView style={{flex:1}}
//showsVerticalScrollIndicator={false}
// ref={(r) => this.scrollview = r}
ref={c => this._scrollview = c}
scrollsToEnd={true}
>
 
 
addRemarks = () => {

// this._scrollview.scrollTo({x:0,y:windowHeight*2,animated:true})



const editIndex = this.remarksArr.length;
this.setState({
editFlag: false,
editIndex,
addFlag: true,
 
})

setTimeout(()=> {
this._scrollview.scrollToEnd({animated:true,duration:500});

},500)



}
 
必须要加个延迟,不然方法无法执行
posted @ 2020-11-18 10:55  樱花飞落ll  阅读(238)  评论(0编辑  收藏  举报