From bf2ae5f4687df6f193aed7a0ed55b9fea7c2c254 Mon Sep 17 00:00:00 2001 From: Marina Beldi Date: Tue, 1 Oct 2019 19:56:51 -0400 Subject: [PATCH 1/2] bump react-native-remote-svg --- package.json | 2 +- yarn.lock | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index 98c97069817..9bec4577eb2 100644 --- a/package.json +++ b/package.json @@ -119,7 +119,7 @@ "react-native-push-notification": "git+ssh://git@github.com/brunobar79/react-native-push-notification.git#androidx", "react-native-qrcode-svg": "5.1.2", "react-native-randombytes": "3.5.2", - "react-native-remote-svg": "git+ssh://git@github.com/brunobar79/react-native-remote-svg.git#cc0ba8b1a0bd8fc73e10b3078751e362ddcb3aee", + "react-native-remote-svg": "git+ssh://git@github.com/brunobar79/react-native-remote-svg.git#6f071a1cefe25e9a9d56570a74523741bae65a8b", "react-native-screens": "1.0.0-alpha.23", "react-native-scrollable-tab-view": "git+ssh://git@github.com/estebanmino/react-native-scrollable-tab-view.git#f954274c6260a07c956e2185c611aed24b2f1526", "react-native-search-api": "1.2.0", diff --git a/yarn.lock b/yarn.lock index 9f31435f392..3ca3a32f64b 100644 --- a/yarn.lock +++ b/yarn.lock @@ -9039,9 +9039,9 @@ react-native-randombytes@3.5.2: buffer "^4.9.1" sjcl "^1.0.3" -"react-native-remote-svg@git+ssh://git@github.com/brunobar79/react-native-remote-svg.git#cc0ba8b1a0bd8fc73e10b3078751e362ddcb3aee": +"react-native-remote-svg@git+ssh://git@github.com/brunobar79/react-native-remote-svg.git#6f071a1cefe25e9a9d56570a74523741bae65a8b": version "2.0.6" - resolved "git+ssh://git@github.com/brunobar79/react-native-remote-svg.git#cc0ba8b1a0bd8fc73e10b3078751e362ddcb3aee" + resolved "git+ssh://git@github.com/brunobar79/react-native-remote-svg.git#6f071a1cefe25e9a9d56570a74523741bae65a8b" react-native-safe-area-view@^0.14.1: version "0.14.7" From 36a27997568498b1de66e695b8d2048bffefac70 Mon Sep 17 00:00:00 2001 From: Marina Beldi Date: Tue, 1 Oct 2019 20:30:45 -0400 Subject: [PATCH 2/2] fix add tokens crash --- app/components/UI/AddCustomToken/index.js | 21 ++++++++++++++++--- .../UI/SearchTokenAutocomplete/index.js | 20 ++++++++++++++---- 2 files changed, 34 insertions(+), 7 deletions(-) diff --git a/app/components/UI/AddCustomToken/index.js b/app/components/UI/AddCustomToken/index.js index 4e68662c7b7..44fdb390642 100644 --- a/app/components/UI/AddCustomToken/index.js +++ b/app/components/UI/AddCustomToken/index.js @@ -1,5 +1,5 @@ import React, { PureComponent } from 'react'; -import { Text, TextInput, View, StyleSheet } from 'react-native'; +import { Text, TextInput, View, StyleSheet, InteractionManager } from 'react-native'; import { colors, fontStyles } from '../../../styles/common'; import Engine from '../../../core/Engine'; import PropTypes from 'prop-types'; @@ -54,8 +54,23 @@ export default class AddCustomToken extends PureComponent { if (!(await this.validateCustomToken())) return; const { AssetsController } = Engine.context; const { address, symbol, decimals } = this.state; - AssetsController.addToken(address, symbol, decimals); - this.props.navigation.goBack(); + await AssetsController.addToken(address, symbol, decimals); + // Clear state before closing + this.setState( + { + address: '', + symbol: '', + decimals: '', + warningAddress: '', + warningSymbol: '', + warningDecimals: '' + }, + () => { + InteractionManager.runAfterInteractions(() => { + this.props.navigation.goBack(); + }); + } + ); }; cancelAddToken = () => { diff --git a/app/components/UI/SearchTokenAutocomplete/index.js b/app/components/UI/SearchTokenAutocomplete/index.js index d1346855713..14212559a54 100644 --- a/app/components/UI/SearchTokenAutocomplete/index.js +++ b/app/components/UI/SearchTokenAutocomplete/index.js @@ -1,5 +1,5 @@ import React, { PureComponent } from 'react'; -import { View, StyleSheet } from 'react-native'; +import { View, StyleSheet, InteractionManager } from 'react-native'; import { colors } from '../../../styles/common'; import PropTypes from 'prop-types'; import { strings } from '../../../../locales/i18n'; @@ -44,11 +44,23 @@ export default class SearchTokenAutocomplete extends PureComponent { this.setState({ selectedAsset: asset }); }; - addToken = () => { + addToken = async () => { const { AssetsController } = Engine.context; const { address, symbol, decimals } = this.state.selectedAsset; - AssetsController.addToken(address, symbol, decimals); - this.props.navigation.goBack(); + await AssetsController.addToken(address, symbol, decimals); + // Clear state before closing + this.setState( + { + searchResults: [], + searchQuery: '', + selectedAsset: {} + }, + () => { + InteractionManager.runAfterInteractions(() => { + this.props.navigation.goBack(); + }); + } + ); }; render = () => {