ErrorView.tsx
1.2 KB
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
import React from 'react';
import { SafeAreaView, Text, StyleSheet } from 'react-native';
import MaterialCommunityIcons from 'react-native-vector-icons/MaterialCommunityIcons';
import {
DynamicStyleSheet,
useDynamicStyleSheet,
useDynamicValue,
} from 'react-native-dark-mode';
import { colorPreset } from '../../design';
const dynamicStyles = new DynamicStyleSheet({
background: {
backgroundColor: colorPreset.backgroundColor.secondary,
...StyleSheet.absoluteFillObject,
alignItems: 'center',
justifyContent: 'center',
padding: 20,
},
errorCode: {
color: colorPreset.labelColor.primary,
},
description: {
color: colorPreset.labelColor.primary,
},
});
export default function ErrorView({
code,
description,
}: {
code: number;
description: string;
}) {
const styles = useDynamicStyleSheet(dynamicStyles);
const redColor = useDynamicValue(colorPreset.rainbow.red);
return (
<SafeAreaView style={styles.background}>
<MaterialCommunityIcons
name={'close-circle'}
size={60}
color={redColor}
/>
<Text style={styles.errorCode}>{code}</Text>
<Text style={styles.description}>{description}</Text>
</SafeAreaView>
);
}