Commit 40431b8d by tungnq

TODO: Đã fix xong giao diện android

parent 1d341776
...@@ -23,7 +23,7 @@ const Header = props => { ...@@ -23,7 +23,7 @@ const Header = props => {
return ( return (
<SafeAreaView style={styles.safeArea}> <SafeAreaView style={styles.safeArea}>
<StatusBar barStyle="light-content" backgroundColor={R.colors.blue500} /> <StatusBar translucent={false} barStyle="light-content" backgroundColor={R.colors.blue500} />
<View style={styles.headerContainer}> <View style={styles.headerContainer}>
{isSearch && ( {isSearch && (
...@@ -57,7 +57,7 @@ const styles = StyleSheet.create({ ...@@ -57,7 +57,7 @@ const styles = StyleSheet.create({
backgroundColor: R.colors.blue500, backgroundColor: R.colors.blue500,
}, },
headerContainer: { headerContainer: {
height: HEIGHT(30), height: HEIGHT(40),
width: '100%', width: '100%',
flexDirection: 'row', flexDirection: 'row',
alignItems: 'center', alignItems: 'center',
......
...@@ -33,20 +33,16 @@ const HomeView = (props) => { ...@@ -33,20 +33,16 @@ const HomeView = (props) => {
onSearchChange, onSearchChange,
} = props; } = props;
// OPTIMIZE: Move icon reference outside render để tránh re-create
const ArrowRightIcon = R.images.icArrowRight; const ArrowRightIcon = R.images.icArrowRight;
const navigate = useNavigation(); const navigate = useNavigation();
// PERFORMANCE: Memoized render function
const renderMenuItem = React.useCallback(({ item }) => { const renderMenuItem = React.useCallback(({ item }) => {
return <ItemGrid item={item} onPress={() => onMenuItemPress(item)} />; return <ItemGrid item={item} onPress={() => onMenuItemPress(item)} />;
}, [onMenuItemPress]); }, [onMenuItemPress]);
// UI/UX: Profile card component với null safety
const renderProfileCard = () => ( const renderProfileCard = () => (
<View style={styles.profile_card}> <View style={styles.profile_card}>
<View style={styles.profile_left}> <View style={styles.profile_left}>
{/* FEATURE: Avatar với fallback */}
<View style={styles.avatar}> <View style={styles.avatar}>
{userProfile?.avatar ? ( {userProfile?.avatar ? (
<Image <Image
...@@ -63,7 +59,6 @@ const HomeView = (props) => { ...@@ -63,7 +59,6 @@ const HomeView = (props) => {
)} )}
</View> </View>
{/* FEATURE: User information với null safety */}
<View style={styles.information}> <View style={styles.information}>
<Text <Text
style={styles.text_card_info} style={styles.text_card_info}
...@@ -82,7 +77,6 @@ const HomeView = (props) => { ...@@ -82,7 +77,6 @@ const HomeView = (props) => {
</View> </View>
</View> </View>
{/* FEATURE: Profile button với better UX */}
<TouchableOpacity <TouchableOpacity
style={styles.profile_btn} style={styles.profile_btn}
onPress={() => navigate.navigate(SCREENNAME.PROFILE)} onPress={() => navigate.navigate(SCREENNAME.PROFILE)}
...@@ -99,7 +93,6 @@ const HomeView = (props) => { ...@@ -99,7 +93,6 @@ const HomeView = (props) => {
</View> </View>
); );
// FUNCTIONALITY: Render menu section với reusable logic
const renderMenuSection = (title, data) => ( const renderMenuSection = (title, data) => (
<View style={styles.menu_container}> <View style={styles.menu_container}>
<Text style={styles.menu_title}>{title}</Text> <Text style={styles.menu_title}>{title}</Text>
...@@ -110,34 +103,28 @@ const HomeView = (props) => { ...@@ -110,34 +103,28 @@ const HomeView = (props) => {
keyExtractor={(item) => item.id.toString()} keyExtractor={(item) => item.id.toString()}
scrollEnabled={false} scrollEnabled={false}
columnWrapperStyle={styles.row} columnWrapperStyle={styles.row}
removeClippedSubviews={true} // PERFORMANCE: Memory optimization removeClippedSubviews={true}
maxToRenderPerBatch={9} // PERFORMANCE: Render batch size maxToRenderPerBatch={9}
windowSize={10} // PERFORMANCE: Window size optimization windowSize={10}
/> />
</View> </View>
); );
return ( return (
<> <SafeAreaView style={styles.container_body}>
{/* FIXME: StatusBar configuration để loại bỏ white space */}
<StatusBar <StatusBar
barStyle="light-content" // Text trắng trên dark background barStyle="light-content"
backgroundColor="transparent" // Background trong suốt translucent={false}
translucent={true} // Cho phép content extend lên status bar
/> />
<TouchableWithoutFeedback onPress={Keyboard.dismiss} accessible={false}> <TouchableWithoutFeedback onPress={Keyboard.dismiss} accessible={false}>
{/* FIXME: Dùng View với manual padding thay SafeAreaView */}
<View style={[ <View style={[
{ flex: 1 }, { flex: 1 },
{ paddingTop: Platform.OS === 'ios' ? 0 : StatusBar.currentHeight }
]}> ]}>
<View style={styles.container_body}> <View style={styles.container_body}>
<ImageBackground <ImageBackground
source={R.images.igBackgroundSlider} source={R.images.igBackgroundSlider}
style={[styles.background_header, { style={[styles.background_header, {
// FIXME: Extend background để cover status bar area
paddingTop: Platform.OS === 'ios' ? 50 : (StatusBar.currentHeight || 0) + 10,
}]} }]}
> >
<HeaderCus <HeaderCus
...@@ -156,10 +143,9 @@ const HomeView = (props) => { ...@@ -156,10 +143,9 @@ const HomeView = (props) => {
<ScrollView <ScrollView
showsVerticalScrollIndicator={false} showsVerticalScrollIndicator={false}
style={styles.scroll} style={styles.scroll}
bounces={false} // OPTIMIZE: Tắt bounce trên iOS bounces={false}
overScrollMode="never" // OPTIMIZE: Tắt over scroll trên Android overScrollMode="never"
> >
{/* FUNCTIONALITY: Render các menu sections */}
{renderMenuSection("Học tập", menuDataStudy)} {renderMenuSection("Học tập", menuDataStudy)}
{renderMenuSection("Cá nhân", menuDataIndividual)} {renderMenuSection("Cá nhân", menuDataIndividual)}
{renderMenuSection("Dịch vụ trực tuyến", menuDataOnlineSer)} {renderMenuSection("Dịch vụ trực tuyến", menuDataOnlineSer)}
...@@ -167,7 +153,7 @@ const HomeView = (props) => { ...@@ -167,7 +153,7 @@ const HomeView = (props) => {
</View> </View>
</View> </View>
</TouchableWithoutFeedback> </TouchableWithoutFeedback>
</> </SafeAreaView>
); );
}; };
......
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