Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- scrollToItem = () => {
- const MARGIN = 4;
- let i = this.state.contentOffset.y / (c.PLACE_HEIGHT + MARGIN);
- if (this.state.scrollDirection === 'down') {
- i = Math.ceil(i) // 1.1 2
- } else {
- i = Math.floor(i); // 1.1 1
- }
- i !== -1 && i < this.props.places.length && this.props.scrollToPlace(i, true)
- };
- <FlatList
- data={places}
- enderItem={this.renderPlace}
- keyExtractor={({place_id}) => place_id}
- onScroll={this.onScroll}
- scrollEventThrottle={30}
- onViewableItemsChanged={this.onViewableItemsChanged}
- viewabilityConfig={{itemVisiblePercentThreshold: 0}}
- getItemLayout={this.getItemLayout}
- scrollEnabled={scrollEnabled || !this.state.isFingerPress}
- style={{height: scrollBarHeight}}
- onScrollEndDrag={ () => {}}
- {...this._panResponder.panHandlers}
- />
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement