Merge pull request #1083 from esteemapp/bugfix/feed-scrool

Fixed scrool issue on feed screen
This commit is contained in:
uğur erdal 2019-08-26 16:36:39 +03:00 committed by GitHub
commit 72acabf2db
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -340,26 +340,13 @@ class PostsView extends Component {
}; };
_handleOnScroll = event => { _handleOnScroll = event => {
const { scrollOffsetY, isShowFilterBar, lockFilterBar } = this.state; const { scrollOffsetY } = this.state;
const { handleOnScroll } = this.props; const { handleOnScroll } = this.props;
const currentOffset = event.nativeEvent.contentOffset.y; const currentOffset = event.nativeEvent.contentOffset.y;
// WORKAROUND
const _showFilterBar = scrollOffsetY > currentOffset || scrollOffsetY <= 0;
const _lockFilterBar = isShowFilterBar !== _showFilterBar;
if (handleOnScroll) handleOnScroll(); if (handleOnScroll) handleOnScroll();
this.setState({ scrollOffsetY: currentOffset }); this.setState({ scrollOffsetY: currentOffset });
this.setState({ this.setState({ isShowFilterBar: scrollOffsetY > currentOffset || scrollOffsetY <= 0 });
isShowFilterBar: lockFilterBar ? isShowFilterBar : _showFilterBar,
lockFilterBar: lockFilterBar || _lockFilterBar,
});
if (_lockFilterBar) {
setTimeout(() => {
this.setState({ lockFilterBar: false });
}, 1000);
}
}; };
render() { render() {
@ -403,7 +390,7 @@ class PostsView extends Component {
onEndThreshold={0} onEndThreshold={0}
initialNumToRender={10} initialNumToRender={10}
ListFooterComponent={this._renderFooter} ListFooterComponent={this._renderFooter}
onScroll={this._handleOnScroll} onScrollEndDrag={this._handleOnScroll}
ListEmptyComponent={this._renderEmptyContent} ListEmptyComponent={this._renderEmptyContent}
refreshControl={ refreshControl={
<RefreshControl <RefreshControl