Skip to content

Commit 8616fa1

Browse files
committed
ModernHeader: Size typo enhancements. Example is updated
1 parent f195402 commit 8616fa1

File tree

5 files changed

+55
-46
lines changed

5 files changed

+55
-46
lines changed

example/App.js

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
import React, { Fragment } from "react";
2-
import { StatusBar, SafeAreaView, TouchableOpacity } from "react-native";
2+
import {
3+
StatusBar,
4+
SafeAreaView,
5+
TouchableOpacity,
6+
Linking
7+
} from "react-native";
38
import {
49
AppleHeader,
510
ModernHeader,
@@ -12,7 +17,7 @@ const App = () => {
1217
<Fragment>
1318
<StatusBar barStyle="dark-content" />
1419
<SafeAreaView>
15-
<ClassicHeader
20+
{/* <ClassicHeader
1621
statusBarHidden
1722
headerTitle="Header"
1823
rightComponent={
@@ -23,8 +28,8 @@ const App = () => {
2328
<Icon name="github" type="AntDesign" size={30} color="purple" />
2429
</TouchableOpacity>
2530
}
26-
/>
27-
{/* <ModernHeader /> */}
31+
/> */}
32+
<ModernHeader />
2833
{/* <AppleHeader /> */}
2934
</SafeAreaView>
3035
</Fragment>

example/package-lock.json

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

example/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"lint": "eslint ."
99
},
1010
"dependencies": {
11-
"@freakycoder/react-native-header-view": "^0.4.9",
11+
"@freakycoder/react-native-header-view": "^0.4.10",
1212
"@freakycoder/react-native-helpers": "0.0.21",
1313
"react": "16.8.6",
1414
"react-native": "0.60.4",

lib/src/components/ModernHeader/ModernHeader.js

Lines changed: 41 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -35,34 +35,38 @@ const ModernHeader = props => {
3535
} = props;
3636
return (
3737
<View style={styles.container}>
38-
{!leftDisable && <TouchableOpacity
39-
style={leftCompStyle(left)}
40-
hitSlop={hitslopObj}
41-
onPress={leftIconOnPress}
42-
>
43-
{leftIconComponent || (
44-
<Icon
45-
name={leftIconName}
46-
type={leftIconType}
47-
size={leftIconSize}
48-
color={leftIconColor}
49-
/>
50-
)}
51-
</TouchableOpacity>}
38+
{!leftDisable && (
39+
<TouchableOpacity
40+
style={leftCompStyle(left)}
41+
hitSlop={hitslopObj}
42+
onPress={leftIconOnPress}
43+
>
44+
{leftIconComponent || (
45+
<Icon
46+
name={leftIconName}
47+
type={leftIconType}
48+
size={leftIconSize}
49+
color={leftIconColor}
50+
/>
51+
)}
52+
</TouchableOpacity>
53+
)}
5254
<Text style={textStyle}>{text}</Text>
53-
{!rightDisable && <TouchableOpacity
54-
style={rightCompStyle(right)}
55-
onPress={rightIconOnPress}
56-
>
57-
{rightIconComponent || (
58-
<Icon
59-
name={rightIconName}
60-
type={rightIconType}
61-
size={rightIconSize}
62-
color={rightIconColor}
63-
/>
64-
)}
65-
</TouchableOpacity>}
55+
{!rightDisable && (
56+
<TouchableOpacity
57+
style={rightCompStyle(right)}
58+
onPress={rightIconOnPress}
59+
>
60+
{rightIconComponent || (
61+
<Icon
62+
name={rightIconName}
63+
type={rightIconType}
64+
size={rightIconSize}
65+
color={rightIconColor}
66+
/>
67+
)}
68+
</TouchableOpacity>
69+
)}
6670
</View>
6771
);
6872
};
@@ -73,27 +77,27 @@ ModernHeader.propTypes = {
7377
text: PropTypes.string,
7478
leftIconName: PropTypes.string,
7579
leftIconType: PropTypes.string,
76-
leftIconSize: PropTypes.string,
7780
leftIconColor: PropTypes.string,
7881
rightIconName: PropTypes.string,
7982
rightIconType: PropTypes.string,
80-
rightIconSize: PropTypes.string,
81-
rightIconColor: PropTypes.string
83+
rightIconColor: PropTypes.string,
84+
leftIconSize: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
85+
rightIconSize: PropTypes.oneOfType([PropTypes.number, PropTypes.string])
8286
};
8387

8488
ModernHeader.defaultProps = {
8589
left: 16,
8690
right: 16,
87-
text: "Header Title",
88-
textStyle: styles.textStyle,
89-
leftIconName: "ios-arrow-back",
90-
leftIconType: "Ionicons",
9191
leftIconSize: 25,
92-
leftIconColor: "#bbbabe",
92+
rightIconSize: 25,
93+
text: "Header Title",
9394
rightIconName: "heart",
9495
rightIconType: "Entypo",
95-
rightIconSize: 25,
96-
rightIconColor: "#23c4c1"
96+
leftIconType: "Ionicons",
97+
leftIconColor: "#bbbabe",
98+
rightIconColor: "#23c4c1",
99+
textStyle: styles.textStyle,
100+
leftIconName: "ios-arrow-back"
97101
};
98102

99103
export default ModernHeader;

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@freakycoder/react-native-header-view",
3-
"version": "0.4.10",
3+
"version": "0.4.11",
44
"description": "Fully customizable Header View for React Native.",
55
"keywords": [
66
"apple",

0 commit comments

Comments
 (0)