React Native 0.41 이상일 경우
<ScrollView
ref={ref => this.scrollView = ref}
onContentSizeChange={(contentWidth, contentHeight)=>{
this.scrollView.scrollToEnd({animated: true});
}}>
</ScrollView>
flatList에서
<FlatList
ref={'flatList'}
data={this.state.message}
renderItem={({ item }) => this._onRefresh(item)}
keyExtractor={(item, index: number) => { return index.toString() }}
onContentSizeChange={(contentWidth, contentHeight)=>{
(this.refs.flatList as FlatList).scrollToEnd({animated: true});
}}
/>
'프로그래밍 > React' 카테고리의 다른 글
React-Native Base64 string을 이미지로 표현 (0) | 2020.08.13 |
---|---|
React Native REST API에서 POST시 헤더 Authorization Type Basic Auth로 전송해야할 때 (0) | 2020.08.11 |
[React-native] VirtualizedLists should never be nested inside plain ScrollViews with the same orientation - use another VirtualizedList-backed container instead. (0) | 2020.07.30 |
React Router (0) | 2020.03.12 |
React에 들어가며... (0) | 2020.03.12 |