diff --git a/Navigation.js b/Navigation.js index a9212551a..ef7af8630 100644 --- a/Navigation.js +++ b/Navigation.js @@ -143,6 +143,14 @@ const WalletsRoot = () => ( + ); diff --git a/screen/send/success.js b/screen/send/success.js index a6d115a47..1f33f90a8 100644 --- a/screen/send/success.js +++ b/screen/send/success.js @@ -9,9 +9,13 @@ import loc from '../../loc'; import { useNavigation, useRoute, useTheme } from '@react-navigation/native'; const Success = () => { + const pop = () => { + dangerouslyGetParent().pop(); + }; + const { colors } = useTheme(); const { dangerouslyGetParent } = useNavigation(); - const { amount = 0, fee = 0, amountUnit = BitcoinUnit.BTC, invoiceDescription = '' } = useRoute().params; + const { amount = 0, fee = 0, amountUnit = BitcoinUnit.BTC, invoiceDescription = '', onDonePressed = pop } = useRoute().params; const animationRef = useRef(); const stylesHook = StyleSheet.create({ root: { @@ -29,9 +33,6 @@ const Success = () => { ReactNativeHapticFeedback.trigger('notificationSuccess', { ignoreAndroidSystemSettings: false }); // eslint-disable-next-line react-hooks/exhaustive-deps }, []); - const pop = () => { - dangerouslyGetParent().pop(); - }; useEffect(() => { animationRef.current.reset(); @@ -84,7 +85,7 @@ const Success = () => { /> - + ); diff --git a/screen/transactions/CPFP.js b/screen/transactions/CPFP.js index ee4fab288..bbd09892f 100644 --- a/screen/transactions/CPFP.js +++ b/screen/transactions/CPFP.js @@ -14,7 +14,6 @@ import { BlueText, BlueSpacing, BlueNavigationStyle, - BlueBigCheckmark, } from '../../BlueComponents'; import { BlueCurrentTheme } from '../../components/themes'; import { HDSegwitBech32Transaction, HDSegwitBech32Wallet } from '../../class'; @@ -101,7 +100,6 @@ export default class CPFP extends Component { await BlueElectrum.waitTillConnected(); const result = await this.state.wallet.broadcastTx(this.state.txhex); if (result) { - this.setState({ stage: 3, isLoading: false }); this.onSuccessBroadcast(); } else { ReactNativeHapticFeedback.trigger('notificationError', { ignoreAndroidSystemSettings: false }); @@ -119,6 +117,7 @@ export default class CPFP extends Component { onSuccessBroadcast() { this.context.txMetadata[this.state.newTxid] = { memo: 'Child pays for parent (CPFP)' }; Notifications.majorTomToGroundControl([], [], [this.state.newTxid]); + this.props.navigation.navigate('Success', { onDonePressed: () => this.props.navigation.popToTop(), amount: undefined }); } async componentDidMount() { @@ -203,20 +202,6 @@ export default class CPFP extends Component { ); } - renderStage3() { - return ( - - - - - - - this.props.navigation.popToTop()} title={loc.send.success_done} /> - - - ); - } - render() { if (this.state.isLoading) { return ( @@ -226,10 +211,6 @@ export default class CPFP extends Component { ); } - if (this.state.stage === 3) { - return this.renderStage3(); - } - if (this.state.stage === 2) { return this.renderStage2(); } diff --git a/screen/transactions/RBFBumpFee.js b/screen/transactions/RBFBumpFee.js index ceb0d2077..52b781c56 100644 --- a/screen/transactions/RBFBumpFee.js +++ b/screen/transactions/RBFBumpFee.js @@ -65,6 +65,7 @@ export default class RBFBumpFee extends CPFP { if (this.context.txMetadata[this.state.txid]) { this.context.txMetadata[this.state.newTxid] = this.context.txMetadata[this.state.txid]; } + this.props.navigation.navigate('Success', { onDonePressed: () => this.props.navigation.popToTop(), amount: undefined }); } render() { @@ -76,10 +77,6 @@ export default class RBFBumpFee extends CPFP { ); } - if (this.state.stage === 3) { - return this.renderStage3(); - } - if (this.state.stage === 2) { return this.renderStage2(); } diff --git a/screen/transactions/RBFCancel.js b/screen/transactions/RBFCancel.js index ed277ccba..48c9c6a2c 100644 --- a/screen/transactions/RBFCancel.js +++ b/screen/transactions/RBFCancel.js @@ -75,6 +75,7 @@ export default class RBFCancel extends CPFP { } else { this.context.txMetadata[this.state.newTxid].memo = 'Cancelled transaction'; } + this.props.navigation.navigate('Success', { onDonePressed: () => this.props.navigation.popToTop(), amount: undefined }); } render() { @@ -86,10 +87,6 @@ export default class RBFCancel extends CPFP { ); } - if (this.state.stage === 3) { - return this.renderStage3(); - } - if (this.state.stage === 2) { return this.renderStage2(); }