-
Notifications
You must be signed in to change notification settings - Fork 3.9k
Feat: use sub page hook #78266
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
Merged
arosiclair
merged 21 commits into
Expensify:main
from
callstack-internal:feat/use-sub-page-hook
Jan 23, 2026
Merged
Feat: use sub page hook #78266
Changes from all commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
227bc35
feat: use sub page
MrMuzyk 2df0c09
Merge branch 'main' of https://github.com/Expensify/App into feat/use…
MrMuzyk c6a0497
feat: docs and small corrections
MrMuzyk 73a6d2d
Merge branch 'main' of https://github.com/Expensify/App into feat/use…
MrMuzyk 64bce52
fix: automated checks and guide
MrMuzyk 025037d
Merge branch 'main' of https://github.com/Expensify/App into feat/use…
MrMuzyk 2f81035
unit tests and doc corrections
MrMuzyk 9dc04e0
Merge branch 'main' of https://github.com/Expensify/App into feat/use…
MrMuzyk 8b1eee9
fix: continue where you left off
MrMuzyk 3847cf7
fix: linter
MrMuzyk f91eef1
feat: new header component
MrMuzyk d9656e6
feat: back animation
MrMuzyk a3da80e
Merge branch 'main' of https://github.com/Expensify/App into feat/use…
MrMuzyk a69ad82
feat: updated docs, tests and last fixes
MrMuzyk ed2495d
Merge branch 'main' of https://github.com/Expensify/App into feat/use…
MrMuzyk 328c262
fix: cspell
MrMuzyk ed370ba
Merge branch 'main' of https://github.com/Expensify/App into feat/use…
MrMuzyk 06ef42f
fix: icon import
MrMuzyk 2eb8ced
Merge branch 'main' of https://github.com/Expensify/App into feat/use…
MrMuzyk ec4e8ef
fix: cr fixes
MrMuzyk 831cbd8
fix: Small adjustment in guide
MrMuzyk File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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,90 @@ | ||
| import React from 'react'; | ||
| import type {ViewStyle} from 'react-native'; | ||
| import {View} from 'react-native'; | ||
| import {useMemoizedLazyExpensifyIcons} from '@hooks/useLazyAsset'; | ||
| import useThemeStyles from '@hooks/useThemeStyles'; | ||
| import colors from '@styles/theme/colors'; | ||
| import variables from '@styles/variables'; | ||
| import CONST from '@src/CONST'; | ||
| import Icon from './Icon'; | ||
| import PressableWithFeedback from './Pressable/PressableWithFeedback'; | ||
| import Text from './Text'; | ||
|
|
||
| type InteractiveStepSubPageHeaderProps = { | ||
| /** List of step names to display */ | ||
| stepNames: readonly string[]; | ||
|
|
||
| /** Current step index (0-based) */ | ||
| currentStepIndex: number; | ||
|
|
||
| /** Function to call when a step is selected */ | ||
| onStepSelected?: (stepIndex: number) => void; | ||
| }; | ||
|
|
||
| const MIN_AMOUNT_FOR_EXPANDING = 3; | ||
| const MIN_AMOUNT_OF_STEPS = 2; | ||
|
|
||
| function InteractiveStepSubPageHeader({stepNames, currentStepIndex, onStepSelected}: InteractiveStepSubPageHeaderProps) { | ||
| const styles = useThemeStyles(); | ||
| const icons = useMemoizedLazyExpensifyIcons(['Checkmark']); | ||
| const containerWidthStyle: ViewStyle = stepNames.length < MIN_AMOUNT_FOR_EXPANDING ? styles.mnw60 : styles.mnw100; | ||
|
|
||
| if (stepNames.length < MIN_AMOUNT_OF_STEPS) { | ||
| throw new Error(`stepNames list must have at least ${MIN_AMOUNT_OF_STEPS} elements.`); | ||
| } | ||
|
|
||
| const lastStepIndex = stepNames.length - 1; | ||
|
|
||
| const handleStepPress = (isLockedStep: boolean, index: number) => { | ||
| if (isLockedStep || !onStepSelected) { | ||
| return; | ||
| } | ||
| onStepSelected(index); | ||
| }; | ||
|
|
||
| return ( | ||
| <View style={[styles.interactiveStepHeaderContainer, containerWidthStyle]}> | ||
| {stepNames.map((stepName, index) => { | ||
| const isCompletedStep = currentStepIndex > index; | ||
| const isLockedStep = currentStepIndex < index; | ||
| const isLockedLine = currentStepIndex < index + 1; | ||
| const hasConnectingLine = index < lastStepIndex; | ||
|
|
||
| return ( | ||
| <View | ||
| style={[styles.interactiveStepHeaderStepContainer, hasConnectingLine && styles.flex1]} | ||
| key={stepName} | ||
| > | ||
| <PressableWithFeedback | ||
| style={[ | ||
| styles.interactiveStepHeaderStepButton, | ||
|
arosiclair marked this conversation as resolved.
|
||
| isLockedStep && styles.interactiveStepHeaderLockedStepButton, | ||
| isCompletedStep && styles.interactiveStepHeaderCompletedStepButton, | ||
| !onStepSelected && styles.cursorDefault, | ||
| ]} | ||
| disabled={isLockedStep || !onStepSelected} | ||
| onPress={() => handleStepPress(isLockedStep, index)} | ||
| accessible | ||
| accessibilityLabel={stepName} | ||
| role={CONST.ROLE.BUTTON} | ||
| > | ||
| {isCompletedStep ? ( | ||
| <Icon | ||
| src={icons.Checkmark} | ||
| width={variables.iconSizeNormal} | ||
| height={variables.iconSizeNormal} | ||
| fill={colors.white} | ||
| /> | ||
| ) : ( | ||
| <Text style={[styles.interactiveStepHeaderStepText, isLockedStep && styles.textSupporting]}>{index + 1}</Text> | ||
|
arosiclair marked this conversation as resolved.
|
||
| )} | ||
| </PressableWithFeedback> | ||
| {hasConnectingLine ? <View style={[styles.interactiveStepHeaderStepLine, isLockedLine && styles.interactiveStepHeaderLockedStepLine]} /> : null} | ||
|
arosiclair marked this conversation as resolved.
|
||
| </View> | ||
| ); | ||
| })} | ||
| </View> | ||
| ); | ||
| } | ||
|
|
||
| export default InteractiveStepSubPageHeader; | ||
This file contains hidden or 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.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.