@teamnhz/rn-ui-toolkit 1.0.3 → 1.0.5

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,17 @@
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>;
1
+ type AppHeaderProps = {
2
+ navigation: any;
3
+ headerTitle?: string;
4
+ titleStyle?: object;
5
+ leftImage?: any;
6
+ onPressLeft?: () => void;
7
+ leftIconStyle?: object;
8
+ rightImageOne?: any;
9
+ onPressRightOne?: () => void;
10
+ rightImageOneStyle?: object;
11
+ rightImageTwo?: any;
12
+ onPressRightTwo?: () => void;
13
+ rightImageTwoStyle?: object;
14
+ headerStyle?: object;
15
15
  };
16
- declare const AppHeader: React.FC<Props>;
16
+ declare const AppHeader: (props: AppHeaderProps) => void;
17
17
  export default AppHeader;
@@ -1,47 +1,45 @@
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, T } from "../index";
5
+ const AppHeader = (props) => {
6
+ const { navigation, headerTitle, titleStyle, leftImage, onPressLeft, leftIconStyle, rightImageOne, onPressRightOne, rightImageOneStyle, rightImageTwo, onPressRightTwo, rightImageTwoStyle, headerStyle, } = props;
7
+ navigation.setOptions({
8
+ headerLeft: () => leftImage ? (React.createElement(TouchableOpacity, { onPress: onPressLeft, activeOpacity: 0.8 },
9
+ React.createElement(Image, { source: leftImage, resizeMode: "contain", style: [styles.leftImage, leftIconStyle] }))) : null,
10
+ headerTitle: () => headerTitle ? (React.createElement(T, { title: headerTitle, style: [styles.headerTitleText, titleStyle] })) : null,
11
+ headerRight: () => (React.createElement(View, { style: styles.headerRightWrapper },
12
+ rightImageOne ? (React.createElement(TouchableOpacity, { onPress: onPressRightOne, activeOpacity: 0.8 },
13
+ React.createElement(Image, { source: rightImageOne, resizeMode: "contain", style: [
14
+ styles.rightImage,
15
+ rightImageOneStyle,
16
+ { marginRight: 10 },
17
+ ] }))) : null,
18
+ rightImageTwo ? (React.createElement(TouchableOpacity, { onPress: onPressRightTwo, activeOpacity: 0.8 },
19
+ React.createElement(Image, { source: rightImageTwo, resizeMode: "contain", style: [styles.rightImage, rightImageTwoStyle] }))) : null)),
20
+ headerStyle: [styles.headerBase, headerStyle],
21
+ });
14
22
  };
15
23
  export default AppHeader;
16
24
  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,
27
- },
28
- leftContainer: {
29
- flexDirection: "row",
30
- alignItems: "center",
31
- flexShrink: 1,
25
+ headerBase: {
26
+ height: 100,
27
+ width: "100%",
32
28
  },
33
- iconBtn: {
34
- padding: 8,
35
- marginRight: 5,
29
+ leftImage: {
30
+ height: 44,
31
+ width: 44,
36
32
  },
37
- title: {
38
- fontSize: 18,
39
- fontWeight: "600",
40
- color: "#000",
41
- marginLeft: 5,
33
+ rightImage: {
34
+ height: 44,
35
+ width: 44,
42
36
  },
43
- rightContainer: {
37
+ headerRightWrapper: {
44
38
  flexDirection: "row",
45
39
  alignItems: "center",
46
40
  },
41
+ headerTitleText: {
42
+ color: Colors.black,
43
+ textAlign: "center",
44
+ },
47
45
  });
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.5",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "files": [