From bfea1b225cc58e6472345e7f743819b0a83eaeff Mon Sep 17 00:00:00 2001 From: Szymon Lesisz Date: Tue, 2 Oct 2018 13:17:43 +0200 Subject: [PATCH] fix for LeftNavigation render - removed componentDidMount which resets state applied in contructor - added animationType in constructor if location has network --- src/views/Wallet/components/LeftNavigation/index.js | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/src/views/Wallet/components/LeftNavigation/index.js b/src/views/Wallet/components/LeftNavigation/index.js index b5402d22..6f3bf158 100644 --- a/src/views/Wallet/components/LeftNavigation/index.js +++ b/src/views/Wallet/components/LeftNavigation/index.js @@ -69,7 +69,7 @@ type TransitionMenuProps = { children?: React.Node; } -// TransitionMenu needs to dispatch window.resize even +// TransitionMenu needs to dispatch window.resize event // in order to StickyContainer be recalculated const TransitionMenu = (props: TransitionMenuProps): React$Element => ( @@ -98,19 +98,14 @@ type State = { class LeftNavigation extends React.PureComponent { constructor(props: Props) { super(props); + const { location } = this.props.router; + const hasNetwork = location && location.state && location.state.network; this.state = { - animationType: null, + animationType: hasNetwork ? 'slide-left' : null, shouldRenderDeviceSelection: false, }; } - componentDidMount() { - this.setState({ - animationType: null, - shouldRenderDeviceSelection: false, - }); - } - componentWillReceiveProps(nextProps: Props) { const { deviceDropdownOpened } = nextProps; const { selectedDevice } = nextProps.wallet;