-
Notifications
You must be signed in to change notification settings - Fork 3.1k
/
Copy pathConfirmationPage.tsx
63 lines (53 loc) · 2 KB
/
ConfirmationPage.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
import React from 'react';
import {View} from 'react-native';
import useThemeStyles from '@hooks/useThemeStyles';
import Button from './Button';
import FixedFooter from './FixedFooter';
import Lottie from './Lottie';
import LottieAnimations from './LottieAnimations';
import type DotLottieAnimation from './LottieAnimations/types';
import Text from './Text';
type ConfirmationPageProps = {
/** The asset to render */
animation?: DotLottieAnimation;
/** Heading of the confirmation page */
heading: string;
/** Description of the confirmation page */
description: string;
/** The text for the button label */
buttonText?: string;
/** A function that is called when the button is clicked on */
onButtonPress?: () => void;
/** Whether we should show a confirmation button */
shouldShowButton?: boolean;
};
function ConfirmationPage({animation = LottieAnimations.Fireworks, heading, description, buttonText = '', onButtonPress = () => {}, shouldShowButton = false}: ConfirmationPageProps) {
const styles = useThemeStyles();
return (
<>
<View style={[styles.screenCenteredContainer, styles.alignItemsCenter]}>
<Lottie
source={animation}
autoPlay
loop
style={styles.confirmationAnimation}
/>
<Text style={[styles.textHeadline, styles.textAlignCenter, styles.mv2]}>{heading}</Text>
<Text style={styles.textAlignCenter}>{description}</Text>
</View>
{shouldShowButton && (
<FixedFooter>
<Button
success
text={buttonText}
style={styles.mt6}
pressOnEnter
onPress={onButtonPress}
/>
</FixedFooter>
)}
</>
);
}
ConfirmationPage.displayName = 'ConfirmationPage';
export default ConfirmationPage;