checkcare/screens/ScreenHome.js

102 lines
2.4 KiB
JavaScript
Raw Normal View History

2025-06-05 10:16:42 +07:00
import { StyleSheet, Text, View, Image, TouchableOpacity, FlatList } from 'react-native';
import Container from '../components/Container';
2025-05-15 10:27:59 +07:00
const ScreenHome = ({ navigation }) => {
2025-06-05 10:16:42 +07:00
const menuItems = [
{
key: '1',
title: 'Apa aja',
icon: require('../assets/illustration/cheeky.png'),
screen: 'Contoh',
},
{
key: '2',
title: 'Boleh',
icon: require('../assets/illustration/cheeky.png'),
screen: 'Contoh',
},
{
key: '3',
title: 'Boleh',
icon: require('../assets/illustration/cheeky.png'),
screen: 'Contoh',
}
];
const renderItem = ({ item }) => (
<TouchableOpacity
style={styles.menuItem}
onPress={() => navigation.navigate(item.screen)}
>
<Image source={item.icon} style={styles.menuIcon} />
<Text style={styles.menuTitle}>{item.title}</Text>
</TouchableOpacity>
);
2025-05-15 10:27:59 +07:00
return (
<Container>
2025-06-05 10:16:42 +07:00
<View style={styles.header}>
2025-06-05 10:16:42 +07:00
<Image
source={require('../assets/illustration/66139.jpg')}
style={styles.headerImage}
/>
</View>
2025-06-05 10:16:42 +07:00
2025-06-05 10:35:02 +07:00
<Text style={styles.title}>Check Care Apps</Text>
2025-06-05 10:16:42 +07:00
<FlatList
data={menuItems}
numColumns={3}
renderItem={renderItem}
keyExtractor={(item) => item.key}
contentContainerStyle={styles.menuGrid}
/>
</Container>
2025-05-15 10:27:59 +07:00
);
}
const styles = StyleSheet.create({
header: {
2025-06-05 10:16:42 +07:00
flex: 1,
backgroundColor: "#FFDDDD"
},
headerImage: {
width: '100%',
height: '100%',
resizeMode: 'cover',
position: 'absolute',
},
title: {
fontSize: 36,
textAlign: 'center',
fontWeight: 'bold',
2025-05-15 10:27:59 +07:00
},
main: {
2025-06-05 10:16:42 +07:00
flex: 3,
backgroundColor: "#DDFFDD"
},
menuGrid: {
marginTop: 20,
justifyContent: 'center',
},
menuItem: {
flex: 1,
margin: 10,
alignItems: 'center',
},
menuIcon: {
width: 50,
height: 50,
marginBottom: 8,
},
menuTitle: {
fontSize: 14,
textAlign: 'center',
},
2025-05-15 10:27:59 +07:00
});
export default ScreenHome;