Showing
1 changed file
with
10 additions
and
8 deletions
@@ -367,14 +367,15 @@ export default class NewArrival extends Component { | @@ -367,14 +367,15 @@ export default class NewArrival extends Component { | ||
367 | }} | 367 | }} |
368 | scrollEventThrottle={300} | 368 | scrollEventThrottle={300} |
369 | initialListSize={40} | 369 | initialListSize={40} |
370 | - onScroll={(event) => { | ||
371 | - if (this.state.showBackToTopButton && event.nativeEvent.contentOffset.y < height) { | ||
372 | - this.setState({showBackToTopButton: false}); | ||
373 | - } | ||
374 | - if (this.state.showBackToTopButton == false && event.nativeEvent.contentOffset.y > height) { | ||
375 | - this.setState({showBackToTopButton: true}); | ||
376 | - } | ||
377 | - }} | 370 | + |
371 | + onScrollEndDrag={(event) => { | ||
372 | + if (this.state.showBackToTopButton && event.nativeEvent.contentOffset.y < height) { | ||
373 | + this.setState({showBackToTopButton: false}); | ||
374 | + } | ||
375 | + if (this.state.showBackToTopButton == false && event.nativeEvent.contentOffset.y > height) { | ||
376 | + this.setState({showBackToTopButton: true}); | ||
377 | + } | ||
378 | + }} | ||
378 | /> | 379 | /> |
379 | {productList.isFilter ? | 380 | {productList.isFilter ? |
380 | <NewArrivalCategoryList | 381 | <NewArrivalCategoryList |
@@ -400,6 +401,7 @@ export default class NewArrival extends Component { | @@ -400,6 +401,7 @@ export default class NewArrival extends Component { | ||
400 | style={styles.backToTopButton} | 401 | style={styles.backToTopButton} |
401 | onPress={()=>{ | 402 | onPress={()=>{ |
402 | this.listView && this.listView.scrollTo({x: 0, y: 0, animated: true}); | 403 | this.listView && this.listView.scrollTo({x: 0, y: 0, animated: true}); |
404 | + this.setState({showBackToTopButton: false}); | ||
403 | }}> | 405 | }}> |
404 | <Image style={{flex:1}} source={require('../../image/backtop.png')}/> | 406 | <Image style={{flex:1}} source={require('../../image/backtop.png')}/> |
405 | </TouchableOpacity>: null | 407 | </TouchableOpacity>: null |
-
Please register or login to post a comment