mirror of
https://github.com/BlueWallet/BlueWallet.git
synced 2024-11-19 01:40:12 +01:00
FIX: Save unit change fixed
This commit is contained in:
parent
1a4f820c63
commit
a5455d2549
@ -163,10 +163,11 @@ export class LightningButton extends Component {
|
||||
export class BlueWalletNavigationHeader extends Component {
|
||||
static propTypes = {
|
||||
wallet: PropTypes.shape().isRequired,
|
||||
onWalletUnitChange: PropTypes.func,
|
||||
};
|
||||
|
||||
static getDerivedStateFromProps(props, _state) {
|
||||
return { wallet: props.wallet };
|
||||
return { wallet: props.wallet, onWalletUnitChange: props.onWalletUnitChange };
|
||||
}
|
||||
|
||||
constructor(props) {
|
||||
@ -230,7 +231,9 @@ export class BlueWalletNavigationHeader extends Component {
|
||||
walletPreviousPreferredUnit = BitcoinUnit.BTC;
|
||||
}
|
||||
|
||||
this.setState({ wallet, walletPreviousPreferredUnit: walletPreviousPreferredUnit });
|
||||
this.setState({ wallet, walletPreviousPreferredUnit: walletPreviousPreferredUnit }, () => {
|
||||
this.props.onWalletUnitChange(wallet);
|
||||
});
|
||||
}
|
||||
|
||||
render() {
|
||||
@ -241,8 +244,7 @@ export class BlueWalletNavigationHeader extends Component {
|
||||
>
|
||||
<Image
|
||||
source={
|
||||
(LightningCustodianWallet.type === this.state.wallet.type && require('./img/lnd-shape.png')) ||
|
||||
require('./img/btc-shape.png')
|
||||
(LightningCustodianWallet.type === this.state.wallet.type && require('./img/lnd-shape.png')) || require('./img/btc-shape.png')
|
||||
}
|
||||
style={{
|
||||
width: 99,
|
||||
|
10
analytics.js
10
analytics.js
@ -5,9 +5,13 @@ amplitude.getInstance().init('8b7cf19e8eea3cdcf16340f5fbf16330', null, {
|
||||
useNativeDeviceInfo: true,
|
||||
});
|
||||
|
||||
let A = event => {
|
||||
amplitude.getInstance().logEvent(event);
|
||||
Analytics.trackEvent(event);
|
||||
let A = async event => {
|
||||
amplitude.getInstance().logEvent(event, {});
|
||||
try {
|
||||
Analytics.trackEvent(event);
|
||||
} catch (err) {
|
||||
console.log(err);
|
||||
}
|
||||
};
|
||||
|
||||
A.ENUM = {
|
||||
|
@ -204,7 +204,6 @@ export default class WalletTransactions extends Component {
|
||||
|
||||
async onWillBlur() {
|
||||
StatusBar.setBarStyle('dark-content');
|
||||
await BlueApp.saveToDisk();
|
||||
}
|
||||
|
||||
componentWillUnmount() {
|
||||
@ -227,7 +226,14 @@ export default class WalletTransactions extends Component {
|
||||
onWillBlur={() => this.onWillBlur()}
|
||||
onDidFocus={() => this.props.navigation.setParams({ isLoading: false })}
|
||||
/>
|
||||
<BlueWalletNavigationHeader wallet={this.state.wallet} />
|
||||
<BlueWalletNavigationHeader
|
||||
wallet={this.state.wallet}
|
||||
onWalletUnitChange={wallet =>
|
||||
InteractionManager.runAfterInteractions(async () => {
|
||||
this.setState({ wallet }, () => BlueApp.saveToDisk());
|
||||
})
|
||||
}
|
||||
/>
|
||||
<View style={{ flex: 1, backgroundColor: '#FFFFFF' }}>
|
||||
{this.state.wallet.type === LightningCustodianWallet.type && (
|
||||
<TouchableOpacity
|
||||
|
Loading…
Reference in New Issue
Block a user