@teamnhz/rn-ui-toolkit 1.0.3 → 1.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,17 +1,2 @@
1
- import React from "react";
2
- import { StyleProp, ViewStyle, TextStyle } from "react-native";
3
- type Props = {
4
- title?: string;
5
- leftIcon?: string;
6
- onLeftPress?: () => void;
7
- onDrawerPress?: () => void;
8
- children?: React.ReactNode;
9
- isDrawer?: boolean;
10
- containerStyle?: StyleProp<ViewStyle>;
11
- titleStyle?: StyleProp<TextStyle>;
12
- leftContainerStyle?: StyleProp<ViewStyle>;
13
- rightContainerStyle?: StyleProp<ViewStyle>;
14
- iconStyle?: StyleProp<ViewStyle>;
15
- };
16
- declare const AppHeader: React.FC<Props>;
1
+ declare const AppHeader: (props: any) => any;
17
2
  export default AppHeader;
@@ -1,47 +1,58 @@
1
- // src/components/AppHeader.tsx
1
+ import { View, TouchableOpacity, StyleSheet } from "react-native";
2
2
  import React from "react";
3
- import { View, Text, TouchableOpacity, StyleSheet, } from "react-native";
4
- import Icon from "react-native-vector-icons/MaterialCommunityIcons";
5
- const AppHeader = ({ title, leftIcon, onLeftPress, onDrawerPress, children, containerStyle, titleStyle, leftContainerStyle, rightContainerStyle, iconStyle, isDrawer, }) => {
6
- return (React.createElement(View, { style: [styles.container, containerStyle] },
7
- React.createElement(View, { style: [styles.leftContainer, leftContainerStyle] },
8
- isDrawer && (React.createElement(TouchableOpacity, { style: [styles.iconBtn, iconStyle], onPress: onDrawerPress },
9
- React.createElement(Icon, { name: "menu", size: 24, color: "#000" }))),
10
- leftIcon && (React.createElement(TouchableOpacity, { style: [styles.iconBtn, iconStyle], onPress: onLeftPress },
11
- React.createElement(Icon, { name: leftIcon, size: 24, color: "#000" }))),
12
- title && (React.createElement(Text, { style: [styles.title, titleStyle], numberOfLines: 1 }, title))),
13
- React.createElement(View, { style: [styles.rightContainer, rightContainerStyle] }, children)));
3
+ import { Colors } from "../../styles";
4
+ import Image from "../Image";
5
+ import T from "../T";
6
+ const AppHeader = (props) => {
7
+ return props.navigation.setOptions({
8
+ headerLeft: () => (React.createElement(TouchableOpacity, { style: {
9
+ display: props.leftImage ? "flex" : "none",
10
+ }, onPress: props.onPressLeft, activeOpacity: 0.8 },
11
+ React.createElement(Image, { source: props.leftImage, resizeMode: "contain", style: styles.left_image_style }))),
12
+ headerTitle: () => (React.createElement(T, { title: props.headerTitle, style: {
13
+ ...styles.header_title_text,
14
+ display: props.headerTitle ? "flex" : "none",
15
+ } })),
16
+ headerRight: () => (React.createElement(View, { style: styles.header_right_style },
17
+ React.createElement(TouchableOpacity, { style: {
18
+ display: props.rightImageOne ? "flex" : "none",
19
+ }, onPress: props.onPressRightOne, activeOpacity: 0.8 },
20
+ React.createElement(Image, { source: props.rightImageOne, resizeMode: "contain", style: styles.right_image_one_style })),
21
+ React.createElement(TouchableOpacity, { style: {
22
+ display: props.rightImageTwo ? "flex" : "none",
23
+ }, onPress: props.onPressRightTwo, activeOpacity: 0.8 },
24
+ React.createElement(Image, { source: props.rightImageTwo, resizeMode: "contain", style: styles.right_image_two_style })))),
25
+ headerStyle: {
26
+ height: 100,
27
+ width: "100%",
28
+ },
29
+ });
14
30
  };
15
- export default AppHeader;
16
31
  const styles = StyleSheet.create({
17
- container: {
18
- height: 56,
19
- flexDirection: "row",
20
- alignItems: "center",
21
- justifyContent: "space-between",
22
- shadowColor: "#000",
23
- shadowOpacity: 0.1,
24
- shadowOffset: { width: 0, height: 2 },
25
- shadowRadius: 4,
26
- paddingHorizontal: 8,
32
+ left_image_style: {
33
+ height: 44,
34
+ width: 44,
35
+ },
36
+ right_image_one_style: {
37
+ height: 44,
38
+ width: 44,
39
+ marginRight: 10,
27
40
  },
28
- leftContainer: {
41
+ right_image_two_style: {
42
+ height: 44,
43
+ width: 44,
44
+ },
45
+ header_right_style: {
29
46
  flexDirection: "row",
30
47
  alignItems: "center",
31
- flexShrink: 1,
32
- },
33
- iconBtn: {
34
- padding: 8,
35
- marginRight: 5,
36
48
  },
37
- title: {
38
- fontSize: 18,
39
- fontWeight: "600",
40
- color: "#000",
41
- marginLeft: 5,
49
+ header_title_text: {
50
+ color: Colors.black,
51
+ textAlign: "center",
42
52
  },
43
- rightContainer: {
44
- flexDirection: "row",
53
+ header_title_view: {
54
+ justifyContent: "center",
45
55
  alignItems: "center",
46
56
  },
47
57
  });
58
+ export default AppHeader;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@teamnhz/rn-ui-toolkit",
3
- "version": "1.0.3",
3
+ "version": "1.0.4",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "files": [