Pertemuan ke 9: 2025-06-05

This commit is contained in:
Dita Aji Pratama 2025-06-05 10:16:42 +07:00
parent 95670084f7
commit c91d7c32b4
3 changed files with 84 additions and 10 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 1005 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

View File

@ -1,28 +1,102 @@
import { StyleSheet, Text, View } from 'react-native'; import { StyleSheet, Text, View, Image, TouchableOpacity, FlatList } from 'react-native';
import Container from '../components/Container'; import Container from '../components/Container';
const ScreenHome = ({ navigation }) => { const ScreenHome = ({ navigation }) => {
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>
);
return ( return (
<Container> <Container>
<View style={styles.header}> <View style={styles.header}>
<Text>Ini Header</Text> <Image
</View> source={require('../assets/illustration/66139.jpg')}
<View style={styles.main}> style={styles.headerImage}
<Text>Ini Main Content</Text> />
</View> </View>
<Text style={styles.title}>Check Care</Text>
<FlatList
data={menuItems}
numColumns={3}
renderItem={renderItem}
keyExtractor={(item) => item.key}
contentContainerStyle={styles.menuGrid}
/>
</Container> </Container>
); );
} }
const styles = StyleSheet.create({ const styles = StyleSheet.create({
header: { header: {
flex:1, flex: 1,
backgroundColor:"#FFDDDD" backgroundColor: "#FFDDDD"
},
headerImage: {
width: '100%',
height: '100%',
resizeMode: 'cover',
position: 'absolute',
},
title: {
fontSize: 36,
textAlign: 'center',
fontWeight: 'bold',
}, },
main: { main: {
flex:3, flex: 3,
backgroundColor:"#DDFFDD" 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',
},
}); });
export default ScreenHome; export default ScreenHome;