- Add React Query provider and client - Create reusable UI components (Loading, Error, Empty) - Implement custom hooks with fallback data - Integrate hooks into Resources and Community screens - Add pull-to-refresh support - Configure EAS Build profiles and environment variables
52 lines
1.3 KiB
TypeScript
52 lines
1.3 KiB
TypeScript
import { View, Text, StyleSheet, TouchableOpacity } from 'react-native';
|
|
|
|
interface ErrorStateProps {
|
|
message?: string;
|
|
onRetry?: () => void;
|
|
}
|
|
|
|
export function ErrorState({ message = 'Something went wrong', onRetry }: ErrorStateProps) {
|
|
return (
|
|
<View style={styles.container}>
|
|
<Text style={styles.title}>Oops!</Text>
|
|
<Text style={styles.message}>{message}</Text>
|
|
{onRetry && (
|
|
<TouchableOpacity style={styles.button} onPress={onRetry}>
|
|
<Text style={styles.buttonText}>Try Again</Text>
|
|
</TouchableOpacity>
|
|
)}
|
|
</View>
|
|
);
|
|
}
|
|
|
|
const styles = StyleSheet.create({
|
|
container: {
|
|
flex: 1,
|
|
justifyContent: 'center',
|
|
alignItems: 'center',
|
|
padding: 24,
|
|
},
|
|
title: {
|
|
fontSize: 20,
|
|
fontWeight: 'bold',
|
|
color: '#333333',
|
|
marginBottom: 8,
|
|
},
|
|
message: {
|
|
fontSize: 16,
|
|
color: '#666666',
|
|
textAlign: 'center',
|
|
marginBottom: 24,
|
|
},
|
|
button: {
|
|
backgroundColor: '#007AFF',
|
|
paddingHorizontal: 24,
|
|
paddingVertical: 12,
|
|
borderRadius: 8,
|
|
},
|
|
buttonText: {
|
|
color: '#FFFFFF',
|
|
fontSize: 16,
|
|
fontWeight: '600',
|
|
},
|
|
});
|