created active tab

This commit is contained in:
u-e 2019-03-18 21:39:19 +03:00
parent 7c3cc50829
commit 7057f0ba2c
5 changed files with 19 additions and 6 deletions

View File

@ -1,4 +1,5 @@
import React, { PureComponent } from 'react';
import { withNavigation } from 'react-navigation';
// Constants
import ROUTES from '../../../constants/routeNames';
@ -18,7 +19,7 @@ class VotersDisplayContainer extends PureComponent {
this.state = {};
}
handleOnUserPress = (username) => {
_handleOnUserPress = (username) => {
const { navigation } = this.props;
navigation.navigate({
@ -33,8 +34,8 @@ class VotersDisplayContainer extends PureComponent {
render() {
const { votes } = this.props;
return <VotersDisplayView votes={votes} />;
return <VotersDisplayView handleOnUserPress={this._handleOnUserPress} votes={votes} />;
}
}
export default VotersDisplayContainer;
export default withNavigation(VotersDisplayContainer);

View File

@ -31,7 +31,7 @@ class VotersDisplayView extends PureComponent {
isHasRightItem
isRightColor={item.is_down_vote}
rightText={value}
handleOnPress={handleOnUserPress(item.voter)}
handleOnPress={() => handleOnUserPress(item.voter)}
isClickable
subRightText={percent}
/>

View File

@ -81,6 +81,7 @@ class NotificationContainer extends Component {
};
} else if (data.type === 'transfer') {
routeName = ROUTES.TABBAR.PROFILE;
params = { isWalletTab: true };
}
navigation.navigate({

View File

@ -44,12 +44,14 @@ class ProfileContainer extends Component {
isReverseHeader,
user: null,
selectedQuickProfile: null,
activeTab: 0,
};
}
componentDidMount = () => {
const { navigation, isLoggedIn, currentAccount } = this.props;
const selectedUser = navigation.state && navigation.state.params;
const { isWalletTab } = navigation.state && navigation.state.params;
if (!isLoggedIn && !selectedUser) {
navigation.navigate(ROUTES.SCREENS.LOGIN);
@ -72,6 +74,10 @@ class ProfileContainer extends Component {
} else {
this._loadProfile(currentAccount.name);
}
if (isWalletTab) {
this.setState({ activeTab: 2 });
}
};
componentWillReceiveProps(nextProps) {
@ -328,12 +334,14 @@ class ProfileContainer extends Component {
selectedQuickProfile,
user,
username,
activeTab,
} = this.state;
const { isDarkTheme, isLoggedIn, currency } = this.props;
return (
<ProfileScreen
about={user && user.about && user.about.profile}
activeTab={activeTab}
avatar={avatar}
comments={comments}
currency={currency}

View File

@ -84,6 +84,7 @@ class ProfileScreen extends PureComponent {
selectedQuickProfile,
selectedUser,
username,
activeTab,
} = this.props;
const {
@ -119,8 +120,9 @@ class ProfileScreen extends PureComponent {
if (estimatedWalletValue) {
const { currencyRate, currencySymbol } = currency;
_estimatedWalletValue = `${currencySymbol} ${(estimatedWalletValue * currencyRate).toFixed(
)}`;
_estimatedWalletValue = `${currencySymbol} ${(
estimatedWalletValue * currencyRate
).toFixed()}`;
}
return (
@ -177,6 +179,7 @@ class ProfileScreen extends PureComponent {
)}
<ScrollableTabView
initialPage={activeTab || 0}
style={[globalStyles.tabView, styles.tabView]}
renderTabBar={() => (
<TabBar style={styles.tabbar} tabUnderlineDefaultWidth={80} tabUnderlineScaleX={2} />