From 42cfcdc98a63c279ad4b0c19a350a172276bb155 Mon Sep 17 00:00:00 2001 From: syedsaroshfarrukhdot Date: Fri, 29 Jul 2022 10:04:14 +0500 Subject: [PATCH 1/4] Fixing Previous Chat Open On Escape Press --- .../Navigation/AppNavigator/BaseDrawerNavigator.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/libs/Navigation/AppNavigator/BaseDrawerNavigator.js b/src/libs/Navigation/AppNavigator/BaseDrawerNavigator.js index 7114959db546..6d6f065f7ae3 100644 --- a/src/libs/Navigation/AppNavigator/BaseDrawerNavigator.js +++ b/src/libs/Navigation/AppNavigator/BaseDrawerNavigator.js @@ -49,6 +49,17 @@ class BaseDrawerNavigator extends Component { }; } + componentDidUpdate(prevProps) { + // You don't have to do this check first, but it can help prevent an unneeded render + if (prevProps.isSmallScreenWidth !== this.props.isSmallScreenWidth) { + this.setState({ + defaultStatus: Navigation.getDefaultDrawerState( + this.props.isSmallScreenWidth, + ), + }); + } + } + render() { const content = ( Date: Sat, 30 Jul 2022 02:06:00 +0500 Subject: [PATCH 2/4] Lint Fixes --- .../AppNavigator/BaseDrawerNavigator.js | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/src/libs/Navigation/AppNavigator/BaseDrawerNavigator.js b/src/libs/Navigation/AppNavigator/BaseDrawerNavigator.js index 6d6f065f7ae3..dbbac56413d2 100644 --- a/src/libs/Navigation/AppNavigator/BaseDrawerNavigator.js +++ b/src/libs/Navigation/AppNavigator/BaseDrawerNavigator.js @@ -51,14 +51,20 @@ class BaseDrawerNavigator extends Component { componentDidUpdate(prevProps) { // You don't have to do this check first, but it can help prevent an unneeded render - if (prevProps.isSmallScreenWidth !== this.props.isSmallScreenWidth) { - this.setState({ + if (prevProps.isSmallScreenWidth === this.props.isSmallScreenWidth) { + return; + } + this.updateNavigationState(this.props.isSmallScreenWidth); + } + + // This Function will update Drawer Status to Open + updateNavigationState(props) { + this.setState({ defaultStatus: Navigation.getDefaultDrawerState( - this.props.isSmallScreenWidth, + props, ), - }); - } - } + }); + } render() { const content = ( From b9ffe711768394bbefb711e027ff540a59245ce2 Mon Sep 17 00:00:00 2001 From: syedsaroshfarrukhdot Date: Sun, 31 Jul 2022 18:36:21 +0500 Subject: [PATCH 3/4] Lint Error Fix --- src/libs/Navigation/AppNavigator/BaseDrawerNavigator.js | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/src/libs/Navigation/AppNavigator/BaseDrawerNavigator.js b/src/libs/Navigation/AppNavigator/BaseDrawerNavigator.js index dbbac56413d2..a2c8832aa422 100644 --- a/src/libs/Navigation/AppNavigator/BaseDrawerNavigator.js +++ b/src/libs/Navigation/AppNavigator/BaseDrawerNavigator.js @@ -50,18 +50,13 @@ class BaseDrawerNavigator extends Component { } componentDidUpdate(prevProps) { - // You don't have to do this check first, but it can help prevent an unneeded render if (prevProps.isSmallScreenWidth === this.props.isSmallScreenWidth) { return; } - this.updateNavigationState(this.props.isSmallScreenWidth); - } - - // This Function will update Drawer Status to Open - updateNavigationState(props) { + // eslint-disable-next-line react/no-did-update-set-state this.setState({ defaultStatus: Navigation.getDefaultDrawerState( - props, + this.props.isSmallScreenWidth, ), }); } From bdb106918c90fee5ceda5939a7c74f416ad62b10 Mon Sep 17 00:00:00 2001 From: syedsaroshfarrukhdot Date: Mon, 1 Aug 2022 10:42:56 +0500 Subject: [PATCH 4/4] Formatting Change --- src/libs/Navigation/AppNavigator/BaseDrawerNavigator.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/libs/Navigation/AppNavigator/BaseDrawerNavigator.js b/src/libs/Navigation/AppNavigator/BaseDrawerNavigator.js index a2c8832aa422..96664751686b 100644 --- a/src/libs/Navigation/AppNavigator/BaseDrawerNavigator.js +++ b/src/libs/Navigation/AppNavigator/BaseDrawerNavigator.js @@ -53,11 +53,10 @@ class BaseDrawerNavigator extends Component { if (prevProps.isSmallScreenWidth === this.props.isSmallScreenWidth) { return; } + // eslint-disable-next-line react/no-did-update-set-state this.setState({ - defaultStatus: Navigation.getDefaultDrawerState( - this.props.isSmallScreenWidth, - ), + defaultStatus: Navigation.getDefaultDrawerState(this.props.isSmallScreenWidth), }); }