@@ -13,15 +13,53 @@ const hitslopObj = {
1313} ;
1414
1515const ModernHeader = props => {
16- const { left, right, text, textStyle } = props ;
16+ const {
17+ left,
18+ right,
19+ text,
20+ textStyle,
21+ leftIconName,
22+ leftIconType,
23+ leftIconSize,
24+ leftIconColor,
25+ rightIconName,
26+ rightIconType,
27+ rightIconSize,
28+ rightIconColor,
29+ leftIconComponent,
30+ rightIconComponent,
31+ leftIconOnPress,
32+ rightIconOnPress
33+ } = props ;
1734 return (
1835 < View style = { styles . container } >
19- < TouchableOpacity style = { leftCompStyle ( left ) } hitSlop = { hitslopObj } >
20- < Icon name = "ios-arrow-back" type = "Ionicons" size = { 25 } color = "#bbbabe" />
36+ < TouchableOpacity
37+ style = { leftCompStyle ( left ) }
38+ hitSlop = { hitslopObj }
39+ onPress = { leftIconOnPress }
40+ >
41+ { leftIconComponent || (
42+ < Icon
43+ name = { leftIconName }
44+ type = { leftIconType }
45+ size = { leftIconSize }
46+ color = { leftIconColor }
47+ />
48+ ) }
2149 </ TouchableOpacity >
2250 < Text style = { textStyle } > { text } </ Text >
23- < TouchableOpacity style = { rightCompStyle ( right ) } >
24- < Icon name = "heart" type = "Entypo" size = { 25 } color = "#23c4c1" />
51+ < TouchableOpacity
52+ style = { rightCompStyle ( right ) }
53+ onPress = { rightIconOnPress }
54+ >
55+ { rightIconComponent || (
56+ < Icon
57+ name = { rightIconName }
58+ type = { rightIconType }
59+ size = { rightIconSize }
60+ color = { rightIconColor }
61+ />
62+ ) }
2563 </ TouchableOpacity >
2664 </ View >
2765 ) ;
@@ -30,14 +68,30 @@ const ModernHeader = props => {
3068ModernHeader . propTypes = {
3169 left : PropTypes . number ,
3270 right : PropTypes . number ,
33- text : PropTypes . string
71+ text : PropTypes . string ,
72+ leftIconName : PropTypes . string ,
73+ leftIconType : PropTypes . string ,
74+ leftIconSize : PropTypes . string ,
75+ leftIconColor : PropTypes . string ,
76+ rightIconName : PropTypes . string ,
77+ rightIconType : PropTypes . string ,
78+ rightIconSize : PropTypes . string ,
79+ rightIconColor : PropTypes . string
3480} ;
3581
3682ModernHeader . defaultProps = {
3783 left : 16 ,
3884 right : 16 ,
3985 text : "Header Title" ,
40- textStyle : styles . textStyle
86+ textStyle : styles . textStyle ,
87+ leftIconName : "ios-arrow-back" ,
88+ leftIconType : "Ionicons" ,
89+ leftIconSize : 25 ,
90+ leftIconColor : "#bbbabe" ,
91+ rightIconName : "heart" ,
92+ rightIconType : "Entypo" ,
93+ rightIconSize : 25 ,
94+ rightIconColor : "#23c4c1"
4195} ;
4296
4397export default ModernHeader ;
0 commit comments