forked from Expensify/App
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBlockingView.js
82 lines (69 loc) · 2.39 KB
/
BlockingView.js
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
import React from 'react';
import {View} from 'react-native';
import PropTypes from 'prop-types';
import styles from '../../styles/styles';
import variables from '../../styles/variables';
import Icon from '../Icon';
import Text from '../Text';
import themeColors from '../../styles/themes/default';
import TextLink from '../TextLink';
import Navigation from '../../libs/Navigation/Navigation';
import AutoEmailLink from '../AutoEmailLink';
const propTypes = {
/** Expensicon for the page */
icon: PropTypes.func.isRequired,
/** Color for the icon (should be from theme) */
iconColor: PropTypes.string,
/** Title message below the icon */
title: PropTypes.string.isRequired,
/** Subtitle message below the title */
subtitle: PropTypes.string,
/** Link message below the subtitle */
link: PropTypes.string,
/** Whether we should show a link to navigate elsewhere */
shouldShowLink: PropTypes.bool,
/** The custom icon width */
iconWidth: PropTypes.number,
/** The custom icon height */
iconHeight: PropTypes.number,
/** Function to call when pressing the navigation link */
onLinkPress: PropTypes.func,
};
const defaultProps = {
iconColor: themeColors.offline,
subtitle: '',
shouldShowLink: false,
link: 'notFound.goBackHome',
iconWidth: variables.iconSizeSuperLarge,
iconHeight: variables.iconSizeSuperLarge,
onLinkPress: () => Navigation.dismissModal(),
};
function BlockingView(props) {
return (
<View style={[styles.flex1, styles.alignItemsCenter, styles.justifyContentCenter, styles.ph10]}>
<Icon
src={props.icon}
fill={props.iconColor}
width={props.iconWidth}
height={props.iconHeight}
/>
<Text style={[styles.notFoundTextHeader]}>{props.title}</Text>
<AutoEmailLink
style={[styles.textAlignCenter]}
text={props.subtitle}
/>
{props.shouldShowLink ? (
<TextLink
onPress={props.onLinkPress}
style={[styles.link, styles.mt2]}
>
{props.link}
</TextLink>
) : null}
</View>
);
}
BlockingView.propTypes = propTypes;
BlockingView.defaultProps = defaultProps;
BlockingView.displayName = 'BlockingView';
export default BlockingView;