From 95670084f7ddd0f571e7cb65ea22e4a869d78d72 Mon Sep 17 00:00:00 2001 From: Dita Aji Pratama Date: Thu, 15 May 2025 10:54:27 +0700 Subject: [PATCH] Menerapkan Container sebagai komponen dan menerapkan flex pada Container --- components/Container.js | 15 +++++++++++++++ screens/ScreenHome.js | 26 ++++++++++++++++---------- 2 files changed, 31 insertions(+), 10 deletions(-) create mode 100644 components/Container.js diff --git a/components/Container.js b/components/Container.js new file mode 100644 index 0000000..9adc3e2 --- /dev/null +++ b/components/Container.js @@ -0,0 +1,15 @@ +import { View, StyleSheet } from 'react-native'; + +const Container = ({ children, style }) => { + return {children}; +}; + +const styles = StyleSheet.create({ + container: { + flex:1, + flexDirection: 'column', + padding: 20, + }, +}); + +export default Container; diff --git a/screens/ScreenHome.js b/screens/ScreenHome.js index 90e57ba..e2cec15 100644 --- a/screens/ScreenHome.js +++ b/screens/ScreenHome.js @@ -1,22 +1,28 @@ -import { StatusBar } from 'expo-status-bar'; import { StyleSheet, Text, View } from 'react-native'; +import Container from '../components/Container'; const ScreenHome = ({ navigation }) => { return ( - - Ini halaman Home - - + + + Ini Header + + + Ini Main Content + + ); } const styles = StyleSheet.create({ - container: { - flex: 1, - backgroundColor: '#fff', - alignItems: 'center', - justifyContent: 'center', + header: { + flex:1, + backgroundColor:"#FFDDDD" }, + main: { + flex:3, + backgroundColor:"#DDFFDD" + } }); export default ScreenHome; \ No newline at end of file