Merge pull request #1952 from ecency/nt/accessing-own-profile

NT - Own Profile Fix
This commit is contained in:
Feruz M 2021-05-23 11:48:44 +03:00 committed by GitHub
commit 149c4252a9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 15 additions and 3 deletions

View File

@ -242,14 +242,14 @@ class ProfileView extends PureComponent {
}
render() {
const { handleOnBackPress, isOwnProfile, quickProfile } = this.props;
const { handleOnBackPress, isOwnProfile, quickProfile, reverseHeader } = this.props;
return (
<View style={styles.container}>
<Header
key={quickProfile && quickProfile.name}
selectedUser={quickProfile}
isReverse={!isOwnProfile}
isReverse={reverseHeader}
handleOnBackPress={handleOnBackPress}
/>
<View style={styles.container}>

View File

@ -33,6 +33,13 @@ class ProfileContainer extends Component {
constructor(props) {
super(props);
//check if is signed in user profile
const username = props.navigation.getParam('username');
const {
currentAccount: { name: currentAccountUsername },
} = props;
const isOwnProfile = !username || currentAccountUsername === username;
this.state = {
comments: [],
follows: {},
@ -42,12 +49,13 @@ class ProfileContainer extends Component {
isMuted: false,
isProfileLoading: false,
isReady: false,
isOwnProfile: !has(props, 'navigation.state.params.username'),
isOwnProfile,
user: null,
quickProfile: {
reputation: get(props, 'navigation.state.params.reputation', ''),
name: get(props, 'navigation.state.params.username', ''),
},
reverseHeader: !!username,
};
}
@ -427,6 +435,7 @@ class ProfileContainer extends Component {
quickProfile,
user,
username,
reverseHeader,
} = this.state;
const { currency, isDarkTheme, isLoggedIn, navigation, children, isHideImage } = this.props;
const activePage = get(navigation.state.params, 'state', 0);
@ -476,6 +485,7 @@ class ProfileContainer extends Component {
quickProfile,
selectedUser: user,
username,
reverseHeader,
})
);
}

View File

@ -39,6 +39,7 @@ const ProfileScreen = () => (
setEstimatedWalletValue,
username,
votingPower,
reverseHeader,
}) => (
<Profile
about={about}
@ -74,6 +75,7 @@ const ProfileScreen = () => (
username={username}
votingPower={votingPower}
isHideImage={isHideImage}
reverseHeader={reverseHeader}
/>
)}
</ProfileContainer>