Repository navigation
ConfirmationPage composition migration #103070
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
mountiny
merged 31 commits into
Expensify:main
from
software-mansion-labs:Guccio163/confirmationPage/introduction
Oct 21, 2026
Merged
Changes from all commits
Commits
Show all changes
31 commits
Select commit
Hold shift + click to select a range
ff1977f
introduce Button primitives
Guccio163 40b1a61
add ConfirmationPageContent
Guccio163 1a7e459
add ConfirmationPageIllustration
Guccio163 838d9c1
add ConfirmationPageHeading and Description
Guccio163 46e7016
add ConfirmationPageDefault
Guccio163 f23d484
migrate ConfirmationPageDefault
Guccio163 6850aaa
migrate the rest of the callsites
Guccio163 5dba2d3
fix after review
Guccio163 81de054
fix CONSISTENCY violations in ConfirmationPage primitives
Guccio163 6d05530
extract MergeResultPage config into useMergeResultConfirmationConfig …
Guccio163 481c7b5
remove unused ConfirmationPageProps export to fix knip
Guccio163 cbbc8fe
Merge remote-tracking branch 'origin/main' into Guccio163/confirmatio…
Guccio163 fa604cd
migrate CollectDepositAccount Success to ConfirmationPageDefault
Guccio163 cc5d2c7
fix CLEAN-REACT-PATTERNS-7 and CONSISTENCY-13 review findings
Guccio163 c0046d3
Merge branch 'main' of github.com:software-mansion-labs/expensify-app…
Guccio163 d986569
implement comments
Guccio163 aff57d2
remove redundant h100 from ConfirmationPage callsites
Guccio163 0895f6c
Merge branch 'main' of github.com:software-mansion-labs/expensify-app…
Guccio163 a9cd852
adjust to main changes
Guccio163 adffa1d
change styles order in ConfirmationPageDescription
Guccio163 495826e
remove redundant flexGrow1
Guccio163 9bf5875
remove redundant props from useMergeResultConfirmationConfig result
Guccio163 4fa5ad3
default button text and onPress to the most popular/always used options
Guccio163 001015f
deduplicate useMergeResultConfirmationConfig configurations
Guccio163 f08a295
remove cta in favor of ctaComponent
Guccio163 bdf3c10
remove description in favor of descriptionComponent
Guccio163 06871f0
Migrate ConfirmationPageTest to ConfirmationPage.Illustration
Guccio163 ed0742a
Merge branch 'main' of github.com:software-mansion-labs/expensify-app…
Guccio163 aba0d87
fix ts check
Guccio163 1d8ba8c
Merge branch 'main' of github.com:software-mansion-labs/expensify-app…
Guccio163 dee89c5
Revert unintended .github/actions/javascript changes
Guccio163 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 was deleted.
Oops, something went wrong.
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,18 @@ | ||
| import useThemeStyles from '@hooks/useThemeStyles'; | ||
|
|
||
| import type {StyleProp, ViewStyle} from 'react-native'; | ||
|
|
||
| import {View} from 'react-native'; | ||
|
|
||
| type ConfirmationPageProps = { | ||
| children: React.ReactNode; | ||
| style?: StyleProp<ViewStyle>; | ||
| }; | ||
|
|
||
| function ConfirmationPage({children, style}: ConfirmationPageProps) { | ||
| const styles = useThemeStyles(); | ||
|
|
||
| return <View style={[styles.flex1, style]}>{children}</View>; | ||
| } | ||
|
|
||
| export default ConfirmationPage; |
101 changes: 101 additions & 0 deletions
101
src/components/ConfirmationPage/composed/ConfirmationPageDefault.tsx
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,101 @@ | ||
| import ConfirmationPage from '@components/ConfirmationPage/ConfirmationPage'; | ||
| import ConfirmationPageContent from '@components/ConfirmationPage/layout/ConfirmationPageContent'; | ||
| import ConfirmationPageDescription from '@components/ConfirmationPage/primitives/ConfirmationPageDescription'; | ||
| import ConfirmationPageHeading from '@components/ConfirmationPage/primitives/ConfirmationPageHeading'; | ||
| import ConfirmationPageIllustration from '@components/ConfirmationPage/primitives/ConfirmationPageIllustration'; | ||
| import ConfirmationPagePrimaryButton from '@components/ConfirmationPage/primitives/ConfirmationPagePrimaryButton'; | ||
| import FixedFooter from '@components/FixedFooter'; | ||
| import LottieAnimations from '@components/LottieAnimations'; | ||
| import type DotLottieAnimation from '@components/LottieAnimations/types'; | ||
|
|
||
| import type {Errors} from '@src/types/onyx/OnyxCommon'; | ||
| import type IconAsset from '@src/types/utils/IconAsset'; | ||
|
|
||
| import type {StyleProp, TextStyle, ViewStyle} from 'react-native'; | ||
|
|
||
| type ConfirmationPageProps = { | ||
| /** Illustration shown at the top: a Lottie animation or a static icon. Defaults to the fireworks animation */ | ||
| illustration?: DotLottieAnimation | IconAsset; | ||
|
|
||
| /** Heading text displayed below the illustration */ | ||
| heading: string; | ||
|
|
||
| /** Description text displayed below the heading */ | ||
| description: string; | ||
|
|
||
| /** The text for the button label */ | ||
| buttonText?: string; | ||
|
|
||
| /** A function that is called when the button is clicked on */ | ||
| onButtonPress?: () => void; | ||
|
|
||
| /** Whether the button should be disabled */ | ||
| isButtonDisabled?: boolean; | ||
|
|
||
| /** Whether the button should show a loading spinner */ | ||
| isButtonLoading?: boolean; | ||
|
|
||
| /** Errors rendered as a message inside the footer, above the button */ | ||
| requestErrors?: Errors | null; | ||
|
|
||
| /** Additional style for the outermost container */ | ||
| containerStyle?: StyleProp<ViewStyle>; | ||
|
|
||
| /** Additional style for the centered container wrapping the illustration, heading and description */ | ||
| innerContainerStyle?: StyleProp<ViewStyle>; | ||
|
|
||
| /** Additional style for the illustration */ | ||
| illustrationStyle?: StyleProp<ViewStyle>; | ||
|
|
||
| /** Additional style for the heading text */ | ||
| headingStyle?: StyleProp<TextStyle>; | ||
|
|
||
| /** Additional style for the description text */ | ||
| descriptionStyle?: StyleProp<TextStyle>; | ||
|
|
||
| /** Additional style for the footer containing the button */ | ||
| footerStyle?: StyleProp<ViewStyle>; | ||
| }; | ||
|
|
||
| function ConfirmationPageDefault({ | ||
| illustration = LottieAnimations.Fireworks, | ||
| heading, | ||
| description, | ||
| buttonText = '', | ||
| onButtonPress = () => {}, | ||
| isButtonDisabled = false, | ||
| isButtonLoading = false, | ||
| headingStyle, | ||
| illustrationStyle, | ||
| descriptionStyle, | ||
| footerStyle, | ||
| requestErrors, | ||
| containerStyle, | ||
| innerContainerStyle, | ||
| }: ConfirmationPageProps) { | ||
| return ( | ||
| <ConfirmationPage style={containerStyle}> | ||
| <ConfirmationPageContent | ||
| style={innerContainerStyle} | ||
| requestErrors={requestErrors} | ||
| > | ||
| <ConfirmationPageIllustration | ||
| illustration={illustration} | ||
| illustrationStyle={illustrationStyle} | ||
| /> | ||
| <ConfirmationPageHeading style={headingStyle}>{heading}</ConfirmationPageHeading> | ||
| <ConfirmationPageDescription style={descriptionStyle}>{description}</ConfirmationPageDescription> | ||
| </ConfirmationPageContent> | ||
| <FixedFooter style={footerStyle}> | ||
| <ConfirmationPagePrimaryButton | ||
| text={buttonText} | ||
| isDisabled={isButtonDisabled} | ||
| isLoading={isButtonLoading} | ||
| onPress={onButtonPress} | ||
| /> | ||
| </FixedFooter> | ||
| </ConfirmationPage> | ||
| ); | ||
| } | ||
|
|
||
| export default ConfirmationPageDefault; | ||
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,48 @@ | ||
| /** | ||
| * ConfirmationPage: a confirmation/illustration screen built with composition API. | ||
| * | ||
| * Instead of a large flat props list (illustration, heading, description, shouldShowButton, …), | ||
| * sub-components are composed as children: | ||
| * | ||
| * @example | ||
| * ```tsx | ||
| * import ConfirmationPage from '@components/ConfirmationPage'; | ||
| * | ||
| * <ConfirmationPage> | ||
| * <ConfirmationPage.Content> | ||
| * <ConfirmationPage.Illustration illustration={LottieAnimations.Fireworks} /> | ||
| * <ConfirmationPage.Heading>All set!</ConfirmationPage.Heading> | ||
| * <ConfirmationPage.Description>Your changes have been saved.</ConfirmationPage.Description> | ||
| * </ConfirmationPage.Content> | ||
| * <FixedFooter> | ||
| * <ConfirmationPage.PrimaryButton text="Got it" onPress={handleConfirm} /> | ||
| * </FixedFooter> | ||
| * </ConfirmationPage> | ||
| * ``` | ||
| * | ||
| * For the common illustration/heading/description/button shape without custom composition, use `ConfirmationPageDefault` instead. | ||
| */ | ||
| import React from 'react'; | ||
|
|
||
| import ConfirmationPageComponent from './ConfirmationPage'; | ||
| import ConfirmationPageContent from './layout/ConfirmationPageContent'; | ||
| import ConfirmationPageDescription from './primitives/ConfirmationPageDescription'; | ||
| import ConfirmationPageHeading from './primitives/ConfirmationPageHeading'; | ||
| import ConfirmationPageIllustration from './primitives/ConfirmationPageIllustration'; | ||
| import ConfirmationPagePrimaryButton from './primitives/ConfirmationPagePrimaryButton'; | ||
| import ConfirmationPageSecondaryButton from './primitives/ConfirmationPageSecondaryButton'; | ||
|
|
||
| function ConfirmationPageBase(props: React.ComponentProps<typeof ConfirmationPageComponent>) { | ||
| return <ConfirmationPageComponent {...props} />; | ||
| } | ||
|
|
||
| const ConfirmationPage = Object.assign(ConfirmationPageBase, { | ||
| Illustration: ConfirmationPageIllustration, | ||
| Heading: ConfirmationPageHeading, | ||
| Description: ConfirmationPageDescription, | ||
| PrimaryButton: ConfirmationPagePrimaryButton, | ||
| SecondaryButton: ConfirmationPageSecondaryButton, | ||
| Content: ConfirmationPageContent, | ||
| }); | ||
|
|
||
| export default ConfirmationPage; |
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.