-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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 #13744 from Puneet-here/AddConfirmationPage
Add confirmation page
- Loading branch information
Showing
10 changed files
with
127 additions
and
214 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
import React from 'react'; | ||
import {Image, View} from 'react-native'; | ||
import PropTypes from 'prop-types'; | ||
import Text from './Text'; | ||
import styles from '../styles/styles'; | ||
import Button from './Button'; | ||
import FixedFooter from './FixedFooter'; | ||
import CONST from '../CONST'; | ||
|
||
const propTypes = { | ||
/** The asset to render */ | ||
illustration: PropTypes.string, | ||
|
||
/** Heading of the confirmation page */ | ||
heading: PropTypes.string, | ||
|
||
/** Description of the confirmation page */ | ||
description: PropTypes.string, | ||
|
||
/** The text for the button label */ | ||
buttonText: PropTypes.string, | ||
|
||
/** A function that is called when the button is clicked on */ | ||
onButtonPress: PropTypes.func, | ||
|
||
/** Whether we should show a confirmation button */ | ||
shouldShowButton: PropTypes.bool, | ||
}; | ||
|
||
const defaultProps = { | ||
illustration: `${CONST.CLOUDFRONT_URL}/images/animations/animation__fireworks.gif`, | ||
heading: '', | ||
description: '', | ||
buttonText: '', | ||
onButtonPress: () => {}, | ||
shouldShowButton: false, | ||
}; | ||
|
||
const ConfirmationPage = props => ( | ||
<> | ||
<View style={[styles.screenCenteredContainer, styles.alignItemsCenter]}> | ||
<Image | ||
source={{uri: props.illustration}} | ||
style={styles.confirmationAnimation} | ||
/> | ||
<Text | ||
style={[ | ||
styles.textStrong, | ||
styles.textLarge, | ||
styles.mv2, | ||
]} | ||
> | ||
{props.heading} | ||
</Text> | ||
<Text style={styles.textAlignCenter}> | ||
{props.description} | ||
</Text> | ||
</View> | ||
{props.shouldShowButton && ( | ||
<FixedFooter> | ||
<Button | ||
success | ||
text={props.buttonText} | ||
style={styles.mt6} | ||
pressOnEnter | ||
onPress={props.onButtonPress} | ||
/> | ||
</FixedFooter> | ||
)} | ||
</> | ||
); | ||
|
||
ConfirmationPage.propTypes = propTypes; | ||
ConfirmationPage.defaultProps = defaultProps; | ||
ConfirmationPage.displayName = 'ConfirmationPage'; | ||
|
||
export default ConfirmationPage; |
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 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 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
Oops, something went wrong.