-
Notifications
You must be signed in to change notification settings - Fork 583
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: revert navigations (#8223)
* chor: reverting navigations changes * yes * with ff
- Loading branch information
Sam Raj
authored
Feb 20, 2023
1 parent
523159b
commit d30ebae
Showing
7 changed files
with
178 additions
and
59 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
import { NavigationContainer } from "@react-navigation/native" | ||
import { createStackNavigator, TransitionPresets } from "@react-navigation/stack" | ||
import { ArtQuizNavigationQuery } from "__generated__/ArtQuizNavigationQuery.graphql" | ||
import { ArtQuizArtworks } from "app/Scenes/ArtQuiz/ArtQuizArtworks" | ||
import { ArtQuizLoader } from "app/Scenes/ArtQuiz/ArtQuizLoader" | ||
import { ArtQuizResults } from "app/Scenes/ArtQuiz/ArtQuizResults/ArtQuizResults" | ||
import { ArtQuizWelcome } from "app/Scenes/ArtQuiz/ArtQuizWelcome" | ||
import { Suspense } from "react" | ||
import { graphql, useLazyLoadQuery } from "react-relay" | ||
|
||
export type ArtQuizNavigationStack = { | ||
ArtQuizWelcome: undefined | ||
ArtQuizArtworks: undefined | ||
ArtQuizResults: { isCalculatingResult?: boolean } | ||
} | ||
|
||
export const StackNavigator = createStackNavigator<ArtQuizNavigationStack>() | ||
|
||
const ArtQuiz: React.FC = () => { | ||
const quizCompleted = useLazyLoadQuery<ArtQuizNavigationQuery>(artQuizNavigationQuery, {}).me | ||
?.quiz.completedAt | ||
|
||
if (quizCompleted) { | ||
return <ArtQuizResults /> | ||
} | ||
|
||
return ( | ||
<NavigationContainer independent> | ||
<StackNavigator.Navigator | ||
screenOptions={{ | ||
...TransitionPresets.DefaultTransition, | ||
headerShown: false, | ||
headerMode: "screen", | ||
gestureEnabled: false, | ||
}} | ||
> | ||
<StackNavigator.Screen name="ArtQuizWelcome" component={ArtQuizWelcome} /> | ||
<StackNavigator.Screen name="ArtQuizArtworks" component={ArtQuizArtworks} /> | ||
<StackNavigator.Screen name="ArtQuizResults" component={ArtQuizResults} /> | ||
</StackNavigator.Navigator> | ||
</NavigationContainer> | ||
) | ||
} | ||
|
||
export const ArtQuizNavigation = () => { | ||
return ( | ||
<Suspense fallback={<ArtQuizLoader />}> | ||
<ArtQuiz /> | ||
</Suspense> | ||
) | ||
} | ||
|
||
const artQuizNavigationQuery = graphql` | ||
query ArtQuizNavigationQuery { | ||
me { | ||
quiz { | ||
completedAt | ||
} | ||
} | ||
} | ||
` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
src/app/Scenes/Onboarding/OnboardingQuiz/OnboardingArtTasteQuiz.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
import { ArtQuiz } from "app/Scenes/ArtQuiz/ArtQuiz" | ||
import { ArtQuizNavigation } from "app/Scenes/ArtQuiz/ArtQuizNavigation" | ||
|
||
export const OnboardingArtTasteQuiz: React.FC = () => { | ||
return <ArtQuiz /> | ||
return <ArtQuizNavigation /> | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters