Skip to content

Commit

Permalink
[FIX] Navigation object undefined when tapping sidebar's user header …
Browse files Browse the repository at this point in the history
…on tablet (#2259)
  • Loading branch information
diegolmello authored Jul 8, 2020
1 parent b8f87f7 commit afb0707
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions app/views/SidebarView/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,14 @@ class Sidebar extends Component {
return state?.routeNames[state?.index];
}

onPressUser = () => {
const { navigation, isMasterDetail } = this.props;
if (isMasterDetail) {
return;
}
navigation.closeDrawer();
}

renderAdmin = () => {
const { isAdmin } = this.state;
const { theme, isMasterDetail } = this.props;
Expand Down Expand Up @@ -210,7 +218,7 @@ class Sidebar extends Component {

render() {
const {
user, Site_Name, baseUrl, useRealName, allowStatusMessage, isMasterDetail, theme, navigation
user, Site_Name, baseUrl, useRealName, allowStatusMessage, isMasterDetail, theme
} = this.props;

if (!user) {
Expand All @@ -229,7 +237,7 @@ class Sidebar extends Component {
]}
{...scrollPersistTaps}
>
<TouchableWithoutFeedback onPress={() => navigation.closeDrawer()} testID='sidebar-close-drawer'>
<TouchableWithoutFeedback onPress={this.onPressUser} testID='sidebar-close-drawer'>
<View style={styles.header} theme={theme}>
<Avatar
text={user.username}
Expand Down

0 comments on commit afb0707

Please sign in to comment.