Commit 078dcd66 by tungnq

TODO: Đã dựng thành công header và drawer navigaiton

parent 9948f7fa
...@@ -52,8 +52,8 @@ const DrawerNavigatorEmailView = (props) =>{ ...@@ -52,8 +52,8 @@ const DrawerNavigatorEmailView = (props) =>{
}, []); }, []);
const MenuButton = ({onPress}) =>( const MenuButton = ({onPress}) =>(
<TouchableOpacity style={styles.sizeBox} onPress={onPress}> <TouchableOpacity style={[styles.sizeBox, {marginLeft:10}]} onPress={onPress}>
<Image source={IconMenu} style={styles.iconMenu} tintColor={R.colors.white}/> <Image source={IconMenu} style={styles.iconMenu} tintColor={R.colors.gray2}/>
</TouchableOpacity> </TouchableOpacity>
) )
...@@ -62,8 +62,10 @@ const DrawerNavigatorEmailView = (props) =>{ ...@@ -62,8 +62,10 @@ const DrawerNavigatorEmailView = (props) =>{
drawerContent={(drawerProps) => <CustomDrawerMailContent {...drawerProps} />} drawerContent={(drawerProps) => <CustomDrawerMailContent {...drawerProps} />}
initialRouteName={ScreenName.EMAIL} initialRouteName={ScreenName.EMAIL}
screenOptions={({navigation, route})=>({ screenOptions={({navigation, route})=>({
headerLeft:() => (
<View style= {styles.headerLeft}> header: ()=>(
<View style={styles.headerTitleContainer}>
<View>
<HeaderBackButton <HeaderBackButton
onPress={ onPress={
() => { () => {
...@@ -76,15 +78,22 @@ const DrawerNavigatorEmailView = (props) =>{ ...@@ -76,15 +78,22 @@ const DrawerNavigatorEmailView = (props) =>{
} }
canGoBack={navigation.canGoBack()} canGoBack={navigation.canGoBack()}
/> />
<MenuButton onPress={()=>navigation.toggleDrawer()}/>
</View> </View>
), <View style={styles.headerRight}>
<MenuButton onPress={()=>navigation.toggleDrawer()}/>
headerTitle: () => ( <View
<View style={styles.headerTitleContainer}> style={styles.avatar}
<HeaderTitle navigation={navigation} route={route} /> ></View>
</View>
</View> </View>
), ),
headerStyle: {
backgroundColor: R.colors.blue,
},
})} })}
> >
<Drawer.Screen <Drawer.Screen
......
...@@ -52,7 +52,7 @@ const CustomDrawerMailContent = (props) => { ...@@ -52,7 +52,7 @@ const CustomDrawerMailContent = (props) => {
source={item.icon} source={item.icon}
style={styles.icon} style={styles.icon}
resizeMode="contain" resizeMode="contain"
tintColor={isSel ? R.colors.blue : R.colors.white} tintColor={isSel ? R.colors.white : R.colors.black}
/> />
<Text style={[ <Text style={[
styles.label, styles.label,
......
import { StyleSheet, Text, View } from 'react-native' import { StyleSheet, Text, View } from 'react-native'
import R from '../../assets/R'
const styles = StyleSheet.create({ const styles = StyleSheet.create({
sizeBox:{ sizeBox:{
...@@ -8,24 +9,27 @@ const styles = StyleSheet.create({ ...@@ -8,24 +9,27 @@ const styles = StyleSheet.create({
width:25, width:25,
height:20 height:20
}, },
iconMenu: {
width: 25,
height: 20
},
headerLeft: {
flexDirection: 'row',
alignItems: 'center'
},
headerTitleContainer:{ headerTitleContainer:{
height:56,
flexDirection:'row', flexDirection:'row',
alignItems: 'center', alignItems:'center',
justifyContent: 'center' backgroundColor:R.colors.blue,
}, },
avatar: { logoContainer:{
width: 30, paddingLeft:15,
height: 30, marginVertical:10
borderRadius: 15, },
backgroundColor: '#ccc' headerRight:{
flex:1,
flexDirection:'row',
alignItems:'center',
backgroundColor:R.colors.white,
borderRadius:105,
padding:5,
marginRight:15,
marginLeft:5,
justifyContent:'space-between',
width:'100%'
}, },
itemContainer:{ itemContainer:{
flexDirection:'row', flexDirection:'row',
...@@ -34,36 +38,39 @@ const styles = StyleSheet.create({ ...@@ -34,36 +38,39 @@ const styles = StyleSheet.create({
paddingHorizontal:15, paddingHorizontal:15,
marginVertical:5 marginVertical:5
}, },
itemSel: { itemSel:{
backgroundColor: 'rgba(0, 122, 255, 0.1)' backgroundColor:R.colors.blue,
marginHorizontal:15,
borderRadius:15,
}, },
icon: { logo:{
width: 24, width:49,
height: 24, height:40
marginRight: 10
}, },
label: { scrollView:{
fontSize: 16, flex:1,
color: '#333' backgroundColor:R.colors.white
}, },
labelSel: { headerLeft:{
color: '#007AFF', flexDirection:'row',
fontWeight: 'bold'
}, },
scrollView: { iconMenu:{
flex: 1 width:25,
height:20,
}, },
logoContainer: { avatar:{
alignItems: 'center', width:25,
paddingVertical: 20 height:25,
borderRadius:15,
backgroundColor:R.colors.black,
marginRight:5
}, },
logo:{ icon:{
width:49, width:25,
height:24 height:25,
}, },
itemSection: { label:{
flex: 1, marginLeft:8
paddingTop: 10
} }
}) })
......
...@@ -8,8 +8,8 @@ const styles = StyleSheet.create({ ...@@ -8,8 +8,8 @@ const styles = StyleSheet.create({
}, },
body:{ body:{
flex: 1, flex: 1,
backgroundColor:R.colors.white },
}
}) })
export default styles export default styles
\ No newline at end of file
import React from 'react'; import React from 'react';
import {Text, View, TouchableOpacity, StyleSheet} from 'react-native'; import {Text, View, TouchableOpacity, StyleSheet} from 'react-native';
import styles from './style'; import styles from './style';
import Header from '../../components/Header/Header';
const EmailHomeView = (props) => { const EmailHomeView = (props) => {
const { } = props; const { } = props;
return ( return (
<View <View
style={styles.container}> style={styles.container}>
<TouchableOpacity> <View>
<Text>EmailHome</Text>
</TouchableOpacity> </View>
</View> </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