added close when scroll feature for wallet comments and posts on profile tab

This commit is contained in:
ue 2019-08-10 01:52:02 +03:00
parent 8a5aba31ae
commit ba314972dd
5 changed files with 13 additions and 6 deletions

View File

@ -316,9 +316,11 @@ class PostsView extends Component {
_handleOnScroll = event => {
const { scrollOffsetY } = this.state;
const { handleOnScroll } = this.props;
const currentOffset = event.nativeEvent.contentOffset.y;
this.setState({ scrollOffsetY: currentOffset });
if (handleOnScroll) handleOnScroll();
this.setState({ scrollOffsetY: currentOffset });
this.setState({ isShowFilterBar: scrollOffsetY > currentOffset || scrollOffsetY <= 0 });
};

View File

@ -137,7 +137,7 @@ class WalletContainer extends Component {
};
render() {
const { currentAccount, selectedUser, isDarkTheme } = this.props;
const { currentAccount, selectedUser, isDarkTheme, handleOnScroll } = this.props;
const { walletData, isClaiming, isRefreshing } = this.state;
return (
@ -150,6 +150,7 @@ class WalletContainer extends Component {
handleOnWalletRefresh={this._handleOnWalletRefresh}
isRefreshing={isRefreshing}
isDarkTheme={isDarkTheme}
handleOnScroll={handleOnScroll}
/>
);
}

View File

@ -1,3 +1,4 @@
/* eslint-disable react/jsx-wrap-multilines */
import React, { PureComponent, Fragment } from 'react';
import { View, Text, ScrollView, RefreshControl } from 'react-native';
import { injectIntl } from 'react-intl';
@ -53,10 +54,13 @@ class WalletView extends PureComponent {
selectedUsername,
walletData,
isDarkTheme,
handleOnScroll,
} = this.props;
return (
<ScrollView
onScroll={handleOnScroll && handleOnScroll}
style={styles.scrollView}
refreshControl={
<RefreshControl
refreshing={isRefreshing}
@ -67,7 +71,6 @@ class WalletView extends PureComponent {
colors={['#fff']}
/>
}
style={styles.scrollView}
>
{!walletData ? (
<Fragment>

View File

@ -1,6 +1,6 @@
/* eslint-disable react/jsx-wrap-multilines */
import React, { PureComponent } from 'react';
import { View, Text, FlatList, ActivityIndicator } from 'react-native';
import { View, Text, FlatList } from 'react-native';
import { injectIntl } from 'react-intl';
// Constants

View File

@ -207,7 +207,7 @@ class ProfileScreen extends PureComponent {
getFor="blog"
tag={username}
key={username}
handleOnScroll={this._handleOnScroll}
handleOnScroll={isSummaryOpen ? this._handleOnScroll : null}
forceLoadPost={forceLoadPost}
changeForceLoadPostState={changeForceLoadPostState}
/>
@ -225,7 +225,7 @@ class ProfileScreen extends PureComponent {
style={styles.commentsTabBar}
>
{comments && comments.length > 0 ? (
<ScrollView>
<ScrollView onScroll={this._handleOnScroll}>
<Comments isProfilePreview comments={comments} fetchPost={getReplies} />
</ScrollView>
) : (
@ -253,6 +253,7 @@ class ProfileScreen extends PureComponent {
<Wallet
setEstimatedWalletValue={this._setEstimatedWalletValue}
selectedUser={selectedUser}
handleOnScroll={isSummaryOpen ? this._handleOnScroll : null}
/>
) : (
<WalletDetailsPlaceHolder />