diff options
| author | Andrej Mihajlov <and@mullvad.net> | 2018-07-05 16:19:24 +0200 |
|---|---|---|
| committer | Andrej Mihajlov <and@mullvad.net> | 2018-07-05 16:19:24 +0200 |
| commit | f5628a7a1a185e5d71cbeb8d1c3d56bd87ff30b5 (patch) | |
| tree | da38bcd09eaca01af7a5b4fd1adf041cf47aa8ef /app/components | |
| parent | e288920bec3000b6cb0da7e16b95c27e4e34be6c (diff) | |
| parent | 09adf211269ff66eb53af007289765fc53e59b15 (diff) | |
| download | mullvadvpn-f5628a7a1a185e5d71cbeb8d1c3d56bd87ff30b5.tar.xz mullvadvpn-f5628a7a1a185e5d71cbeb8d1c3d56bd87ff30b5.zip | |
Merge branch 'remove-backend'
Diffstat (limited to 'app/components')
| -rw-r--r-- | app/components/AccountInput.js | 14 | ||||
| -rw-r--r-- | app/components/Connect.js | 2 | ||||
| -rw-r--r-- | app/components/Login.js | 2 |
3 files changed, 10 insertions, 8 deletions
diff --git a/app/components/AccountInput.js b/app/components/AccountInput.js index 5a8fa47336..cb7cd258c5 100644 --- a/app/components/AccountInput.js +++ b/app/components/AccountInput.js @@ -1,7 +1,7 @@ // @flow import * as React from 'react'; -import { formatAccount } from '../lib/formatters'; import { TextInput } from 'reactxp'; +import { formatAccount } from '../lib/formatters'; import { colors } from '../config'; // @TODO: move it into types.js @@ -66,10 +66,13 @@ export default class AccountInput extends React.Component<AccountInputProps, Acc } shouldComponentUpdate(nextProps: AccountInputProps, nextState: AccountInputState) { + const mergedProps = { ...this.props, ...nextProps }; + const hasPropChanges = Object.keys(mergedProps).some((key) => { + return this.props[key] !== nextProps[key]; + }); + return ( - this.props.value !== nextProps.value || - this.props.onEnter !== nextProps.onEnter || - this.props.onChange !== nextProps.onChange || + hasPropChanges || this.state.value !== nextState.value || this.state.selectionRange[0] !== nextState.selectionRange[0] || this.state.selectionRange[1] !== nextState.selectionRange[1] @@ -78,8 +81,7 @@ export default class AccountInput extends React.Component<AccountInputProps, Acc render() { const displayString = formatAccount(this.state.value || ''); - // eslint-disable-next-line no-unused-vars - const { value, onChange, onEnter, ...otherProps } = this.props; + const { value: _value, onChange: _onChange, onEnter: _onEnter, ...otherProps } = this.props; return ( <TextInput {...otherProps} diff --git a/app/components/Connect.js b/app/components/Connect.js index d14b768d44..79723e5672 100644 --- a/app/components/Connect.js +++ b/app/components/Connect.js @@ -9,7 +9,7 @@ import { TransparentButton, RedTransparentButton, GreenButton, Label } from './s import Accordion from './Accordion'; import styles from './ConnectStyles'; -import { NoCreditError, NoInternetError } from '../lib/backend'; +import { NoCreditError, NoInternetError } from '../errors'; import Map from './Map'; import type { HeaderBarStyle } from './HeaderBar'; diff --git a/app/components/Login.js b/app/components/Login.js index e70d84b7aa..355396a77c 100644 --- a/app/components/Login.js +++ b/app/components/Login.js @@ -352,7 +352,7 @@ export default class Login extends Component<Props, State> { onChange={this._onInputChange} onEnter={this._onLogin} value={this.props.accountToken || ''} - disabled={!this._shouldEnableAccountInput()} + editable={this._shouldEnableAccountInput()} autoFocus={true} ref={(ref) => (this._accountInput = ref)} testName="AccountInput" |
