forked from Expensify/App
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #66 from software-mansion-labs/wave9/create-onboar…
…ding-navigator [Wave9] Create onboarding navigator
- Loading branch information
Showing
18 changed files
with
322 additions
and
18 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 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
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
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,16 @@ | ||
// eslint-disable-next-line no-restricted-imports | ||
import {useWindowDimensions} from 'react-native'; | ||
import variables from '@styles/variables'; | ||
|
||
type OnboardingLayout = { | ||
shouldUseNarrowLayout: boolean; | ||
}; | ||
|
||
/** | ||
* Onboarding layout for medium screen width is narrowed similarly as on web/desktop. | ||
*/ | ||
export default function useOnboardingLayout(): OnboardingLayout { | ||
const {width: windowWidth} = useWindowDimensions(); | ||
|
||
return {shouldUseNarrowLayout: windowWidth > variables.mobileResponsiveWidthBreakpoint}; | ||
} |
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
44 changes: 44 additions & 0 deletions
44
src/libs/Navigation/AppNavigator/Navigators/OnboardingModalNavigator.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 |
---|---|---|
@@ -0,0 +1,44 @@ | ||
import {createStackNavigator} from '@react-navigation/stack'; | ||
import React, {useMemo} from 'react'; | ||
import {View} from 'react-native'; | ||
import NoDropZone from '@components/DragAndDrop/NoDropZone'; | ||
import useOnboardingLayout from '@hooks/useOnboardingLayout'; | ||
import useThemeStyles from '@hooks/useThemeStyles'; | ||
import OnboardingModalNavigatorScreenOptions from '@libs/Navigation/AppNavigator/OnboardingModalNavigatorScreenOptions'; | ||
import type {OnboardingModalNavigatorParamList} from '@libs/Navigation/types'; | ||
import OnboardingPersonalDetails from '@pages/OnboardingPersonalDetails'; | ||
import OnboardingPurpose from '@pages/OnboardingPurpose'; | ||
import SCREENS from '@src/SCREENS'; | ||
import Overlay from './Overlay'; | ||
|
||
const Stack = createStackNavigator<OnboardingModalNavigatorParamList>(); | ||
|
||
function OnboardingModalNavigator() { | ||
const styles = useThemeStyles(); | ||
const screenOptions = useMemo(() => OnboardingModalNavigatorScreenOptions(styles), [styles]); | ||
const {shouldUseNarrowLayout} = useOnboardingLayout(); | ||
|
||
return ( | ||
<NoDropZone> | ||
<Overlay onPress={() => {}} /> | ||
<View style={styles.onboardingNavigatorOuterView}> | ||
<View style={styles.OnboardingNavigatorInnerView(shouldUseNarrowLayout)}> | ||
<Stack.Navigator screenOptions={screenOptions}> | ||
<Stack.Screen | ||
name={SCREENS.ONBOARDING.PERSONAL_DETAILS} | ||
component={OnboardingPersonalDetails} | ||
/> | ||
<Stack.Screen | ||
name={SCREENS.ONBOARDING.PURPOSE} | ||
component={OnboardingPurpose} | ||
/> | ||
</Stack.Navigator> | ||
</View> | ||
</View> | ||
</NoDropZone> | ||
); | ||
} | ||
|
||
OnboardingModalNavigator.displayName = 'OnboardingModalNavigator'; | ||
|
||
export default OnboardingModalNavigator; |
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
18 changes: 18 additions & 0 deletions
18
src/libs/Navigation/AppNavigator/OnboardingModalNavigatorScreenOptions.ts
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,18 @@ | ||
import type {StackNavigationOptions} from '@react-navigation/stack'; | ||
import {CardStyleInterpolators} from '@react-navigation/stack'; | ||
import type {ThemeStyles} from '@styles/index'; | ||
|
||
/** | ||
* Modal stack navigator screen options generator function | ||
* @returns The screen options object | ||
*/ | ||
const OnboardingModalNavigatorScreenOptions = (themeStyles: ThemeStyles): StackNavigationOptions => ({ | ||
headerShown: false, | ||
animationEnabled: true, | ||
gestureDirection: 'horizontal', | ||
cardStyle: themeStyles.navigationOnboardingScreenCardStyle, | ||
cardStyleInterpolator: CardStyleInterpolators.forHorizontalIOS, | ||
presentation: 'transparentModal', | ||
}); | ||
|
||
export default OnboardingModalNavigatorScreenOptions; |
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
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
Oops, something went wrong.