React Native

ScrollView 관련

Machine_웅 2020. 8. 22. 16:28
728x90
반응형

offset 변경 관련

<ScrollView
  onLayout={event => {
    this.frameHeight = event.nativeEvent.layout.height;
    const maxOffset = this.contentHeight - this.frameHeight;
    if (maxOffset < this.yOffset) {
      this.yOffset = maxOffset;
    }
  }}
  onContentSizeChange={(contentWidth, contentHeight) => {
    this.contentHeight = contentHeight;
    const maxOffset = this.contentHeight - this.frameHeight;
    if (maxOffset < this.yOffset) {
      this.yOffset = maxOffset;
    }
  }}
  onScroll={event => { 
    this.yOffset = event.nativeEvent.contentOffset.y;
  }}
  onScrollEndDrag={event => { 
    this.yOffset = event.nativeEvent.contentOffset.y;
  }}
  scrollEventThrottle={160}
>

 

728x90
반응형

'React Native' 카테고리의 다른 글

초기 설정  (0) 2020.10.30
flatlist 성능 이슈 관련  (0) 2020.08.23
(작성중) function component example  (0) 2020.08.17
이슈 ) 파일 업로드시 [TypeError : Network request failed]  (0) 2020.08.12
자바스크립트 Map  (0) 2020.08.06