aboutsummaryrefslogtreecommitdiffstats
path: root/packages/instant/src/components/zero_ex_instant_container.tsx
diff options
context:
space:
mode:
authorSteve Klebanoff <steve.klebanoff@gmail.com>2019-01-10 00:54:55 +0800
committerSteve Klebanoff <steve.klebanoff@gmail.com>2019-01-10 00:54:55 +0800
commitfb3605026ef63ef6897010a52bf3f4c116cdf271 (patch)
treeaf3887e5f785e049daeaf795e0f3e4a9ad370d93 /packages/instant/src/components/zero_ex_instant_container.tsx
parent76dde294f10bb3d5c1074cd6599668bcb1cdd8ec (diff)
parent5b8c9122a292f6558c45440b053ceae52d36d495 (diff)
downloaddexon-sol-tools-fb3605026ef63ef6897010a52bf3f4c116cdf271.tar
dexon-sol-tools-fb3605026ef63ef6897010a52bf3f4c116cdf271.tar.gz
dexon-sol-tools-fb3605026ef63ef6897010a52bf3f4c116cdf271.tar.bz2
dexon-sol-tools-fb3605026ef63ef6897010a52bf3f4c116cdf271.tar.lz
dexon-sol-tools-fb3605026ef63ef6897010a52bf3f4c116cdf271.tar.xz
dexon-sol-tools-fb3605026ef63ef6897010a52bf3f4c116cdf271.tar.zst
dexon-sol-tools-fb3605026ef63ef6897010a52bf3f4c116cdf271.zip
Merge branch 'development' into feature/instant/tell-amount-available
Diffstat (limited to 'packages/instant/src/components/zero_ex_instant_container.tsx')
-rw-r--r--packages/instant/src/components/zero_ex_instant_container.tsx13
1 files changed, 12 insertions, 1 deletions
diff --git a/packages/instant/src/components/zero_ex_instant_container.tsx b/packages/instant/src/components/zero_ex_instant_container.tsx
index 0337c7714..e8c64d5d1 100644
--- a/packages/instant/src/components/zero_ex_instant_container.tsx
+++ b/packages/instant/src/components/zero_ex_instant_container.tsx
@@ -24,7 +24,10 @@ export interface ZeroExInstantContainerState {
tokenSelectionPanelAnimationState: SlideAnimationState;
}
-export class ZeroExInstantContainer extends React.Component<ZeroExInstantContainerProps, ZeroExInstantContainerState> {
+export class ZeroExInstantContainer extends React.PureComponent<
+ ZeroExInstantContainerProps,
+ ZeroExInstantContainerState
+> {
public state = {
tokenSelectionPanelAnimationState: 'none' as SlideAnimationState,
};
@@ -60,6 +63,7 @@ export class ZeroExInstantContainer extends React.Component<ZeroExInstantContain
<SlidingPanel
animationState={this.state.tokenSelectionPanelAnimationState}
onClose={this._handlePanelCloseClickedX}
+ onAnimationEnd={this._handleSlidingPanelAnimationEnd}
>
<AvailableERC20TokenSelector onTokenSelect={this._handlePanelCloseAfterChose} />
</SlidingPanel>
@@ -98,4 +102,11 @@ export class ZeroExInstantContainer extends React.Component<ZeroExInstantContain
tokenSelectionPanelAnimationState: 'slidOut',
});
};
+ private readonly _handleSlidingPanelAnimationEnd = (): void => {
+ if (this.state.tokenSelectionPanelAnimationState === 'slidOut') {
+ // When the slidOut animation completes, don't keep the panel mounted.
+ // Performance optimization
+ this.setState({ tokenSelectionPanelAnimationState: 'none' });
+ }
+ };
}