Commit 322e9ca4 by tungnq

TODO:Đã fix màn hình home

parent 2982ac00
...@@ -25,10 +25,11 @@ const Header = props => { ...@@ -25,10 +25,11 @@ const Header = props => {
const {title, isBack} = props; const {title, isBack} = props;
const navigate = useNavigation(); const navigate = useNavigation();
return ( return (
<SafeAreaView> <SafeAreaView style={styles.safeArea}>
<StatusBar <StatusBar
barStyle="light-content" barStyle="light-content"
backgroundColor={R.colors.blue500} backgroundColor="transparent"
translucent={true}
/> />
<View style={styles.headerContainer}> <View style={styles.headerContainer}>
<Text numberOfLines={1} style={styles.txtTitle}> <Text numberOfLines={1} style={styles.txtTitle}>
...@@ -49,6 +50,9 @@ const Header = props => { ...@@ -49,6 +50,9 @@ const Header = props => {
export default Header; export default Header;
const styles = StyleSheet.create({ const styles = StyleSheet.create({
safeArea:{
backgroundColor:R.colors.blue,
},
headerContainer: { headerContainer: {
height: HEIGHT(45), height: HEIGHT(45),
width: '100%', width: '100%',
......
...@@ -12,6 +12,8 @@ const HeaderHome = (props) => { ...@@ -12,6 +12,8 @@ const HeaderHome = (props) => {
<SafeAreaView style={styles.containerBoxHeader}> <SafeAreaView style={styles.containerBoxHeader}>
<StatusBar <StatusBar
barStyle="light-content" barStyle="light-content"
backgroundColor="transparent"
translucent={true}
/> />
<View style={styles.boxLogo}> <View style={styles.boxLogo}>
<Image <Image
......
...@@ -10,8 +10,8 @@ import { ...@@ -10,8 +10,8 @@ import {
Keyboard, Keyboard,
SafeAreaView, SafeAreaView,
Image, Image,
StatusBar, // FEATURE: Thêm StatusBar để control status bar StatusBar,
Platform, // FEATURE: Check platform để xử lý khác biệt iOS/Android Platform,
} from "react-native"; } from "react-native";
import HeaderCus from "../home/header"; import HeaderCus from "../home/header";
import R from "../../assets/R"; import R from "../../assets/R";
...@@ -33,17 +33,14 @@ const HomeView = (props) => { ...@@ -33,17 +33,14 @@ const HomeView = (props) => {
} = props; } = props;
const navigate = useNavigation(); const navigate = useNavigation();
// FUNCTIONALITY: Render menu item với tối ưu performance
const renderMenuItem = ({ item }) => { const renderMenuItem = ({ item }) => {
return <ItemGrid item={item} onPress={() => onMenuItemPress(item)} />; return <ItemGrid item={item} onPress={() => onMenuItemPress(item)} />;
}; };
// UI/UX: Card thông tin user với layout tối ưu
const cardItemInfo = () => { const cardItemInfo = () => {
return ( return (
<View style={styles.profileCard}> <View style={styles.profileCard}>
<View style={styles.profile_left}> <View style={styles.profile_left}>
{/* FEATURE: Avatar với fallback placeholder */}
<View style={styles.avatar}> <View style={styles.avatar}>
{userProfile?.avatar ? ( {userProfile?.avatar ? (
<Image <Image
...@@ -60,7 +57,6 @@ const HomeView = (props) => { ...@@ -60,7 +57,6 @@ const HomeView = (props) => {
)} )}
</View> </View>
{/* FEATURE: Thông tin user với null safety */}
<View style={styles.information}> <View style={styles.information}>
<Text <Text
style={styles.text_card_info} style={styles.text_card_info}
...@@ -79,7 +75,6 @@ const HomeView = (props) => { ...@@ -79,7 +75,6 @@ const HomeView = (props) => {
</View> </View>
</View> </View>
{/* FEATURE: Button navigate tới profile */}
<TouchableOpacity <TouchableOpacity
style={styles.profile_btn} style={styles.profile_btn}
onPress={() => navigate.navigate(SCREENNAME.PROFILE)} onPress={() => navigate.navigate(SCREENNAME.PROFILE)}
...@@ -89,7 +84,7 @@ const HomeView = (props) => { ...@@ -89,7 +84,7 @@ const HomeView = (props) => {
<View style={styles.iconNext}> <View style={styles.iconNext}>
<Image <Image
source={R.images.icNext} source={R.images.icNext}
style={{ width: 5, height: 10 }} // OPTIMIZE: Dùng style thay maxWidth/maxHeight style={{ width: 5, height: 10 }}
/> />
</View> </View>
</TouchableOpacity> </TouchableOpacity>
...@@ -97,7 +92,6 @@ const HomeView = (props) => { ...@@ -97,7 +92,6 @@ const HomeView = (props) => {
); );
}; };
// FUNCTIONALITY: Render menu activity với FlatList tối ưu
const renderMenuActivity = () => { const renderMenuActivity = () => {
return ( return (
<View style={styles.menu_container}> <View style={styles.menu_container}>
...@@ -110,14 +104,13 @@ const HomeView = (props) => { ...@@ -110,14 +104,13 @@ const HomeView = (props) => {
scrollEnabled={false} scrollEnabled={false}
columnWrapperStyle={styles.row} columnWrapperStyle={styles.row}
ListEmptyComponent={renderItemEmpty} ListEmptyComponent={renderItemEmpty}
removeClippedSubviews={true} // PERFORMANCE: Tối ưu memory removeClippedSubviews={true}
maxToRenderPerBatch={9} // PERFORMANCE: Render tối đa 9 items/batch maxToRenderPerBatch={9}
/> />
</View> </View>
); );
}; };
// FUNCTIONALITY: Render menu statistics
const renderMenuStatistics = () => { const renderMenuStatistics = () => {
return ( return (
<View style={styles.menu_container}> <View style={styles.menu_container}>
...@@ -137,7 +130,6 @@ const HomeView = (props) => { ...@@ -137,7 +130,6 @@ const HomeView = (props) => {
); );
}; };
// FUNCTIONALITY: Render menu notification
const renderMenuNotification = () => { const renderMenuNotification = () => {
return ( return (
<View style={styles.menu_container}> <View style={styles.menu_container}>
...@@ -157,13 +149,12 @@ const HomeView = (props) => { ...@@ -157,13 +149,12 @@ const HomeView = (props) => {
); );
}; };
// UI/UX: Empty state component
const renderItemEmpty = () => { const renderItemEmpty = () => {
return ( return (
<View style={styles.cardItemEmpty}> <View style={styles.cardItemEmpty}>
<Image <Image
source={R.images.icNoData} source={R.images.icNoData}
style={{ width: 50, height: 50 }} // OPTIMIZE: Dùng style object style={{ width: 50, height: 50 }}
/> />
<Text style={[styles.menu_text, { color: R.colors.red }]}> <Text style={[styles.menu_text, { color: R.colors.red }]}>
Không có d liu Không có d liu
...@@ -173,17 +164,8 @@ const HomeView = (props) => { ...@@ -173,17 +164,8 @@ const HomeView = (props) => {
}; };
return ( return (
<> <View style={styles.safeArea}>
{/* FIXME: StatusBar để control màu status bar và remove white space */}
<StatusBar
barStyle="light-content" // Text trắng trên status bar
backgroundColor="transparent" // Background trong suốt
translucent={true} // Cho phép content hiển thị dưới status bar
/>
<TouchableWithoutFeedback onPress={Keyboard.dismiss} accessible={false}> <TouchableWithoutFeedback onPress={Keyboard.dismiss} accessible={false}>
{/* FIXME: Dùng View thay SafeAreaView để loại bỏ white space */}
<View style={[styles.safeArea, { paddingTop: Platform.OS === 'ios' ? 0 : StatusBar.currentHeight }]}>
<View style={styles.container_body}> <View style={styles.container_body}>
<ImageBackground <ImageBackground
source={R.images.igBackground} source={R.images.igBackground}
...@@ -210,9 +192,8 @@ const HomeView = (props) => { ...@@ -210,9 +192,8 @@ const HomeView = (props) => {
{renderMenuNotification()} {renderMenuNotification()}
</ScrollView> </ScrollView>
</View> </View>
</View>
</TouchableWithoutFeedback> </TouchableWithoutFeedback>
</> </View>
); );
}; };
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment