Commit 1a35caa5 by tungnq

TODO: Cập nhật kiểu dáng cho tiêu đề và các mục, cải thiện bố cục và điều chỉnh…

TODO: Cập nhật kiểu dáng cho tiêu đề và các mục, cải thiện bố cục và điều chỉnh cỡ chữ cho màn hình home
parent 40431b8d
18.20.7
\ No newline at end of file
...@@ -14,7 +14,7 @@ const customHeader = (props) => { ...@@ -14,7 +14,7 @@ const customHeader = (props) => {
const SearchIcon = R.images.icSearch; const SearchIcon = R.images.icSearch;
return ( return (
<View style={styles.container}> <View style={[styles.container ,{justifyContent: 'center',marginTop:20}]}>
<Image <Image
source={pathLogo} source={pathLogo}
style={{ width: width, height: height }} style={{ width: width, height: height }}
...@@ -72,8 +72,8 @@ const styles = StyleSheet.create({ ...@@ -72,8 +72,8 @@ const styles = StyleSheet.create({
input: { input: {
fontSize: R.fontsize.fontsSize12, fontSize: R.fontsize.fontsSize12,
color: R.colors.white, color: R.colors.white,
minHeight: 40, margin:0,
flex: 1, padding:0,
fontFamily: R.fonts.InterRegular, fontFamily: R.fonts.InterRegular,
fontWeight: '400', fontWeight: '400',
}, },
......
...@@ -38,7 +38,7 @@ const styles = StyleSheet.create({ ...@@ -38,7 +38,7 @@ const styles = StyleSheet.create({
backgroundColor:R.colors.white, backgroundColor:R.colors.white,
}, },
menu_text: { menu_text: {
fontSize: R.fontsize.fontsSize10, fontSize: R.fontsize.fontsSize12,
fontWeight: "600", fontWeight: "600",
color: R.colors.black, color: R.colors.black,
fontFamily: R.fonts.InterMedium, fontFamily: R.fonts.InterMedium,
......
import React from "react"; import React from 'react';
import { import {
View, View,
Text, Text,
...@@ -12,16 +12,16 @@ import { ...@@ -12,16 +12,16 @@ import {
Image, Image,
StatusBar, // FEATURE: Import StatusBar để control status bar StatusBar, // FEATURE: Import StatusBar để control status bar
Platform, // FEATURE: Check platform iOS/Android Platform, // FEATURE: Check platform iOS/Android
} 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';
import I18n from "../../helper/i18/i18n"; import I18n from '../../helper/i18/i18n';
import ItemGrid from "./item"; import ItemGrid from './item';
import styles from "./style"; import styles from './style';
import { useNavigation } from "@react-navigation/native"; import {useNavigation} from '@react-navigation/native';
import * as SCREENNAME from "../../routers/ScreenNames"; import * as SCREENNAME from '../../routers/ScreenNames';
const HomeView = (props) => { const HomeView = props => {
const { const {
menuDataStudy, menuDataStudy,
menuDataIndividual, menuDataIndividual,
...@@ -36,9 +36,12 @@ const HomeView = (props) => { ...@@ -36,9 +36,12 @@ const HomeView = (props) => {
const ArrowRightIcon = R.images.icArrowRight; const ArrowRightIcon = R.images.icArrowRight;
const navigate = useNavigation(); const navigate = useNavigation();
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],
);
const renderProfileCard = () => ( const renderProfileCard = () => (
<View style={styles.profile_card}> <View style={styles.profile_card}>
...@@ -46,14 +49,14 @@ const HomeView = (props) => { ...@@ -46,14 +49,14 @@ const HomeView = (props) => {
<View style={styles.avatar}> <View style={styles.avatar}>
{userProfile?.avatar ? ( {userProfile?.avatar ? (
<Image <Image
source={{ uri: userProfile.avatar }} source={{uri: userProfile.avatar}}
style={styles.avatar_image} style={styles.avatar_image}
resizeMode="cover" resizeMode="cover"
/> />
) : ( ) : (
<View style={styles.avatar_placeholder}> <View style={styles.avatar_placeholder}>
<Text style={styles.avatar_text}> <Text style={styles.avatar_text}>
{userProfile?.name?.charAt(0) || "U"} {userProfile?.name?.charAt(0) || 'U'}
</Text> </Text>
</View> </View>
)} )}
...@@ -63,16 +66,14 @@ const HomeView = (props) => { ...@@ -63,16 +66,14 @@ const HomeView = (props) => {
<Text <Text
style={styles.text_card_info} style={styles.text_card_info}
numberOfLines={1} numberOfLines={1}
ellipsizeMode="tail" ellipsizeMode="tail">
> {userProfile?.name || 'Không có tên'}
{userProfile?.name || "Không có tên"}
</Text> </Text>
<Text <Text
style={styles.text_card_info} style={styles.text_card_info}
numberOfLines={1} numberOfLines={1}
ellipsizeMode="tail" ellipsizeMode="tail">
> {userProfile?.phone || 'Không có SĐT'}
{userProfile?.phone || "Không có SĐT"}
</Text> </Text>
</View> </View>
</View> </View>
...@@ -80,8 +81,7 @@ const HomeView = (props) => { ...@@ -80,8 +81,7 @@ const HomeView = (props) => {
<TouchableOpacity <TouchableOpacity
style={styles.profile_btn} style={styles.profile_btn}
onPress={() => navigate.navigate(SCREENNAME.PROFILE)} onPress={() => navigate.navigate(SCREENNAME.PROFILE)}
activeOpacity={0.7} activeOpacity={0.7}>
>
<Text style={styles.btn_text}>H s cá nhân</Text> <Text style={styles.btn_text}>H s cá nhân</Text>
<ArrowRightIcon <ArrowRightIcon
width={5} width={5}
...@@ -100,7 +100,7 @@ const HomeView = (props) => { ...@@ -100,7 +100,7 @@ const HomeView = (props) => {
data={data} data={data}
renderItem={renderMenuItem} renderItem={renderMenuItem}
numColumns={3} numColumns={3}
keyExtractor={(item) => item.id.toString()} keyExtractor={item => item.id.toString()}
scrollEnabled={false} scrollEnabled={false}
columnWrapperStyle={styles.row} columnWrapperStyle={styles.row}
removeClippedSubviews={true} removeClippedSubviews={true}
...@@ -110,30 +110,20 @@ const HomeView = (props) => { ...@@ -110,30 +110,20 @@ const HomeView = (props) => {
</View> </View>
); );
const renderBody = () => {
return ( return (
<SafeAreaView style={styles.container_body}> <View style={[{flex: 1}]}>
<StatusBar
barStyle="light-content"
translucent={false}
/>
<TouchableWithoutFeedback onPress={Keyboard.dismiss} accessible={false}>
<View style={[
{ flex: 1 },
]}>
<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]}>
}]}
>
<HeaderCus <HeaderCus
pathLogo={R.images.igLogo} pathLogo={R.images.igLogo}
width={75} width={75}
height={36} height={36}
textInput={R.colors.white} textInput={R.colors.white}
backgroundInput={R.colors.backgroundInputSearch} backgroundInput={R.colors.backgroundInputSearch}
textLabel={I18n.t("Search")} textLabel={I18n.t('Search')}
textColorLabel={R.colors.white} textColorLabel={R.colors.white}
/> />
...@@ -144,14 +134,22 @@ const HomeView = (props) => { ...@@ -144,14 +134,22 @@ const HomeView = (props) => {
showsVerticalScrollIndicator={false} showsVerticalScrollIndicator={false}
style={styles.scroll} style={styles.scroll}
bounces={false} bounces={false}
overScrollMode="never" overScrollMode="never">
> {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)}
</ScrollView> </ScrollView>
</View> </View>
</View> </View>
);
};
return (
<SafeAreaView style={styles.container_body}>
<StatusBar barStyle="light-content" translucent={false} />
<TouchableWithoutFeedback onPress={Keyboard.dismiss} accessible={false}>
{renderBody()}
</TouchableWithoutFeedback> </TouchableWithoutFeedback>
</SafeAreaView> </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