Move wallet scrollIntoView into PortalOnboardingFlow

This commit is contained in:
Brandon Millman 2018-06-29 11:55:00 -07:00
parent f89acb49be
commit 03bc7bb935
2 changed files with 7 additions and 7 deletions

View File

@ -47,8 +47,14 @@ class PlainPortalOnboardingFlow extends React.Component<PortalOnboardingFlowProp
public componentWillUnmount(): void {
this._unlisten();
}
public componentDidUpdate(): void {
public componentDidUpdate(prevProps: PortalOnboardingFlowProps): void {
this._overrideOnboardingStateIfShould();
if (!prevProps.isRunning && this.props.isRunning) {
// On mobile, make sure the wallet is completely visible.
if (this.props.screenWidth === ScreenWidths.Sm) {
document.querySelector('.wallet').scrollIntoView();
}
}
}
public render(): React.ReactNode {
return (

View File

@ -154,12 +154,6 @@ export class Portal extends React.Component<PortalProps, PortalState> {
// tslint:disable-next-line:no-floating-promises
this._fetchBalancesAndAllowancesAsync(this._getCurrentTrackedTokensAddresses());
}
if (!prevProps.isPortalOnboardingShowing && this.props.isPortalOnboardingShowing) {
// On mobile, make sure the wallet is completely visible.
if (this.props.screenWidth === ScreenWidths.Sm) {
document.querySelector('.wallet').scrollIntoView();
}
}
}
public componentWillReceiveProps(nextProps: PortalProps): void {
if (nextProps.networkId !== this.state.prevNetworkId) {