From afb07070282bbccf0b7c04d6034946906bfd6c2d Mon Sep 17 00:00:00 2001 From: Diego Mello Date: Wed, 8 Jul 2020 16:40:10 -0300 Subject: [PATCH] [FIX] Navigation object undefined when tapping sidebar's user header on tablet (#2259) --- app/views/SidebarView/index.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/app/views/SidebarView/index.js b/app/views/SidebarView/index.js index a4e2c52ca6..2da42c460c 100644 --- a/app/views/SidebarView/index.js +++ b/app/views/SidebarView/index.js @@ -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; @@ -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) { @@ -229,7 +237,7 @@ class Sidebar extends Component { ]} {...scrollPersistTaps} > - navigation.closeDrawer()} testID='sidebar-close-drawer'> +