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
|
import React from 'react';
import { View, Text, StyleSheet, useColorScheme } from 'react-native';
import { Ionicons } from '@expo/vector-icons';
import { Colors } from '../constants/Colors';
interface EmptyStateProps {
icon?: keyof typeof Ionicons.glyphMap;
title: string;
message?: string;
}
export function EmptyState({
icon = 'cube-outline',
title,
message,
}: EmptyStateProps) {
const colorScheme = useColorScheme() ?? 'light';
const colors = Colors[colorScheme];
return (
<View style={styles.container}>
<Ionicons name={icon} size={64} color={colors.secondaryText} />
<Text style={[styles.title, { color: colors.text }]}>{title}</Text>
{message && (
<Text style={[styles.message, { color: colors.secondaryText }]}>
{message}
</Text>
)}
</View>
);
}
const styles = StyleSheet.create({
container: {
flex: 1,
alignItems: 'center',
justifyContent: 'center',
paddingHorizontal: 32,
paddingVertical: 64,
},
title: {
fontSize: 18,
fontWeight: '600',
marginTop: 16,
textAlign: 'center',
},
message: {
fontSize: 14,
marginTop: 8,
textAlign: 'center',
lineHeight: 20,
},
});
|