Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Back to Map or Qr after payment success #82

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 27 additions & 1 deletion src/containers/Navbar/NavBarScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ import Back from '../../assets/back.png';
import Help from '../../assets/help.png';
import Logo from '../../assets/logo.png';
import Menu from '../../assets/menu.png';
import React from 'react';
import React, { useContext } from 'react';

import { Ctx } from '../../components/StateProvider';

export const NavCenter = () => <Image style={styles.logo} source={Logo} />;

Expand All @@ -35,6 +37,8 @@ export const HelpButton = () => {
};

export const HeaderButton = ({ navigation, screen }: Props) => {
const { state } = useContext(Ctx);

const defaultConfig: ButtonConfig = {
action: () => {
if (navigation.canGoBack()) {
Expand Down Expand Up @@ -72,6 +76,28 @@ export const HeaderButton = ({ navigation, screen }: Props) => {
}),
icon: Back,
},
PaymentSuccess: {
action: () => {
if (state.user && state.isEnterpriseMode) {
// @ts-ignore
// Navigating inside a nested navigator gives an tsc error.
navigation.navigate('BottomBar', {
screen: 'Map', // go to Map from PaymentSuccess
});
} else if (state.user) {
// @ts-ignore
// Navigating inside a nested navigator gives an tsc error.
navigation.navigate('BottomBar', {
screen: 'Qr', // go to Map from PaymentSuccess
});
} else {
// @ts-ignore
// Navigating inside a nested navigator gives an tsc error.
navigation.navigate('Qr');
}
},
icon: Back,
},
};

const pressHandler = () => {
Expand Down