[FIX] Navigation object undefined when tapping sidebar's user header on tablet (#2259)
This commit is contained in:
parent
b8f87f7006
commit
afb0707028
|
@ -144,6 +144,14 @@ class Sidebar extends Component {
|
||||||
return state?.routeNames[state?.index];
|
return state?.routeNames[state?.index];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
onPressUser = () => {
|
||||||
|
const { navigation, isMasterDetail } = this.props;
|
||||||
|
if (isMasterDetail) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
navigation.closeDrawer();
|
||||||
|
}
|
||||||
|
|
||||||
renderAdmin = () => {
|
renderAdmin = () => {
|
||||||
const { isAdmin } = this.state;
|
const { isAdmin } = this.state;
|
||||||
const { theme, isMasterDetail } = this.props;
|
const { theme, isMasterDetail } = this.props;
|
||||||
|
@ -210,7 +218,7 @@ class Sidebar extends Component {
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const {
|
const {
|
||||||
user, Site_Name, baseUrl, useRealName, allowStatusMessage, isMasterDetail, theme, navigation
|
user, Site_Name, baseUrl, useRealName, allowStatusMessage, isMasterDetail, theme
|
||||||
} = this.props;
|
} = this.props;
|
||||||
|
|
||||||
if (!user) {
|
if (!user) {
|
||||||
|
@ -229,7 +237,7 @@ class Sidebar extends Component {
|
||||||
]}
|
]}
|
||||||
{...scrollPersistTaps}
|
{...scrollPersistTaps}
|
||||||
>
|
>
|
||||||
<TouchableWithoutFeedback onPress={() => navigation.closeDrawer()} testID='sidebar-close-drawer'>
|
<TouchableWithoutFeedback onPress={this.onPressUser} testID='sidebar-close-drawer'>
|
||||||
<View style={styles.header} theme={theme}>
|
<View style={styles.header} theme={theme}>
|
||||||
<Avatar
|
<Avatar
|
||||||
text={user.username}
|
text={user.username}
|
||||||
|
|
Loading…
Reference in New Issue