diff --git a/src/components/Buttons/CheckButton.test.tsx b/src/components/Buttons/CheckButton.test.tsx
index 22ed94a..542f00b 100644
--- a/src/components/Buttons/CheckButton.test.tsx
+++ b/src/components/Buttons/CheckButton.test.tsx
@@ -41,7 +41,7 @@ const mockStore = () => {
describe('CheckButton', () => {
const navigation = useNavigationMock();
- it('should navigate to Game screen when pressed', async () => {
+ it('should navigate to Game screen when pressed from new game', async () => {
const store = mockStore();
const { getByRole } = render(
@@ -58,7 +58,7 @@ describe('CheckButton', () => {
});
}, 10000);
- it('should navigate back a screen when pressed', async () => {
+ it('should navigate back to list screen screen when pressed from list screen menu', async () => {
const store = mockStore();
const { getByRole } = render(
@@ -75,6 +75,23 @@ describe('CheckButton', () => {
});
}, 10000);
+ it('should navigate back to share screen screen when pressed from share screen', async () => {
+ const store = mockStore();
+
+ const { getByRole } = render(
+
+
+
+ );
+
+ const button = getByRole('button');
+ fireEvent.press(button);
+
+ await waitFor(() => {
+ expect(navigation.navigate).toHaveBeenCalledWith('Share');
+ });
+ }, 10000);
+
it('should log an analytics event when pressed', async () => {
const store = mockStore();
diff --git a/src/components/Buttons/CheckButton.tsx b/src/components/Buttons/CheckButton.tsx
index 88e7366..071b645 100644
--- a/src/components/Buttons/CheckButton.tsx
+++ b/src/components/Buttons/CheckButton.tsx
@@ -36,8 +36,12 @@ const CheckButton: React.FunctionComponent = ({ navigation, route }) => {
if (route?.params?.source === 'list_screen') {
navigation.navigate('List');
- } else {
+ } else if (route?.params?.source === 'share_screen') {
+ navigation.navigate('Share');
+ } else if (route?.params?.source === 'new_game') {
navigation.navigate('Game');
+ } else {
+ navigation.goBack();
}
}}>
Done
diff --git a/src/screens/ShareScreen.tsx b/src/screens/ShareScreen.tsx
index 3d6cbbc..59d3932 100644
--- a/src/screens/ShareScreen.tsx
+++ b/src/screens/ShareScreen.tsx
@@ -67,7 +67,7 @@ const ShareScreen: React.FunctionComponent = ({ navigation }) => {
icon={}
style={{ padding: 10 }}
onPress={async () => {
- navigation.navigate('Settings');
+ navigation.navigate('Settings', { source: 'share_screen' });
}} />