@teamnhz/rn-ui-toolkit 1.4.2 → 1.4.3
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,2 +1,18 @@
|
|
|
1
|
-
|
|
1
|
+
import { ImageSourcePropType, StyleProp, ViewStyle, ImageStyle, TextStyle } from "react-native";
|
|
2
|
+
type AppHeaderProps = {
|
|
3
|
+
navigation: any;
|
|
4
|
+
headerTitle?: string;
|
|
5
|
+
titleStyle?: StyleProp<TextStyle>;
|
|
6
|
+
leftImage?: ImageSourcePropType;
|
|
7
|
+
onPressLeft?: () => void;
|
|
8
|
+
leftIconStyle?: StyleProp<ImageStyle>;
|
|
9
|
+
rightImageOne?: ImageSourcePropType;
|
|
10
|
+
onPressRightOne?: () => void;
|
|
11
|
+
rightImageOneStyle?: StyleProp<ImageStyle>;
|
|
12
|
+
rightImageTwo?: ImageSourcePropType;
|
|
13
|
+
onPressRightTwo?: () => void;
|
|
14
|
+
rightImageTwoStyle?: StyleProp<ImageStyle>;
|
|
15
|
+
headerStyle?: StyleProp<ViewStyle>;
|
|
16
|
+
};
|
|
17
|
+
declare const AppHeader: (props: AppHeaderProps) => any;
|
|
2
18
|
export default AppHeader;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import { TouchableOpacity, Text, StyleSheet, ActivityIndicator, } from "react-native";
|
|
2
|
+
import { TouchableOpacity, Text, StyleSheet, ActivityIndicator, Platform, } from "react-native";
|
|
3
3
|
import LinearGradient from "react-native-linear-gradient";
|
|
4
4
|
const LinearGradientButton = ({ title, onPress, loading = false, disabled = false, colors = ["#4c669f", "#3b5998", "#192f6a"], start = { x: 0, y: 0 }, end = { x: 1, y: 1 }, containerStyle, textStyle, height = 50, borderRadius = 12, }) => {
|
|
5
5
|
const isDisabled = loading || disabled;
|
|
@@ -8,7 +8,7 @@ const LinearGradientButton = ({ title, onPress, loading = false, disabled = fals
|
|
|
8
8
|
{ opacity: isDisabled ? 0.6 : 1 },
|
|
9
9
|
containerStyle,
|
|
10
10
|
] },
|
|
11
|
-
React.createElement(LinearGradient, { colors: colors, start: start, end: end, style: [styles.button, { height, borderRadius }] }, loading ? (React.createElement(ActivityIndicator, { color: "#fff", size: "small" })) : (React.createElement(Text, { style: [styles.text, textStyle] }, title)))));
|
|
11
|
+
React.createElement(LinearGradient, { colors: colors, start: start, end: end, style: [styles.button, { height, borderRadius }] }, loading ? (React.createElement(ActivityIndicator, { color: "#fff", size: "small" })) : (React.createElement(Text, { style: [styles.text, textStyle], numberOfLines: 1 }, title)))));
|
|
12
12
|
};
|
|
13
13
|
const styles = StyleSheet.create({
|
|
14
14
|
container: {
|
|
@@ -17,13 +17,23 @@ const styles = StyleSheet.create({
|
|
|
17
17
|
button: {
|
|
18
18
|
justifyContent: "center",
|
|
19
19
|
alignItems: "center",
|
|
20
|
-
paddingHorizontal: 12,
|
|
21
20
|
},
|
|
22
21
|
text: {
|
|
23
22
|
color: "#fff",
|
|
24
23
|
fontSize: 16,
|
|
25
24
|
fontWeight: "600",
|
|
26
25
|
textAlign: "center",
|
|
26
|
+
width: "100%",
|
|
27
|
+
position: "absolute",
|
|
28
|
+
...Platform.select({
|
|
29
|
+
ios: {
|
|
30
|
+
lineHeight: 19,
|
|
31
|
+
},
|
|
32
|
+
android: {
|
|
33
|
+
textAlignVertical: "center",
|
|
34
|
+
includeFontPadding: false,
|
|
35
|
+
},
|
|
36
|
+
}),
|
|
27
37
|
},
|
|
28
38
|
});
|
|
29
39
|
export default LinearGradientButton;
|
|
@@ -1,43 +1,3 @@
|
|
|
1
|
-
// import React, { useState } from "react";
|
|
2
|
-
// import { View, Switch, StyleSheet } from "react-native";
|
|
3
|
-
// import { Colors } from "../../styles";
|
|
4
|
-
// // Switch component
|
|
5
|
-
// const SwitchUI = ({
|
|
6
|
-
// isEnabled,
|
|
7
|
-
// onValueChange,
|
|
8
|
-
// }: {
|
|
9
|
-
// isEnabled?: boolean;
|
|
10
|
-
// onValueChange?: (value: boolean) => void;
|
|
11
|
-
// }) => {
|
|
12
|
-
// const [internalState, setInternalState] = useState(isEnabled ?? false);
|
|
13
|
-
// const toggleSwitch = () => {
|
|
14
|
-
// setInternalState((prev) => !prev);
|
|
15
|
-
// onValueChange && onValueChange(!internalState);
|
|
16
|
-
// };
|
|
17
|
-
// const value = isEnabled ?? internalState;
|
|
18
|
-
// return (
|
|
19
|
-
// <View
|
|
20
|
-
// style={[
|
|
21
|
-
// styles.container,
|
|
22
|
-
// { borderColor: value ? Colors.primaryColor : Colors.disabledGrey },
|
|
23
|
-
// ]}
|
|
24
|
-
// >
|
|
25
|
-
// <Switch
|
|
26
|
-
// trackColor={{ false: Colors.textGrey, true: Colors.appThemeColor }}
|
|
27
|
-
// style={{ transform: [{ scaleX: 0.8 }, { scaleY: 0.8 }] }}
|
|
28
|
-
// thumbColor={value ? Colors.black : Colors.disabledGrey}
|
|
29
|
-
// onValueChange={toggleSwitch}
|
|
30
|
-
// value={value}
|
|
31
|
-
// />
|
|
32
|
-
// </View>
|
|
33
|
-
// );
|
|
34
|
-
// };
|
|
35
|
-
// const styles = StyleSheet.create({
|
|
36
|
-
// container: {
|
|
37
|
-
// flex: 1,
|
|
38
|
-
// },
|
|
39
|
-
// });
|
|
40
|
-
// export default SwitchUI;
|
|
41
1
|
import React, { useState } from "react";
|
|
42
2
|
import { View, Switch, StyleSheet, } from "react-native";
|
|
43
3
|
import { Colors } from "../../styles";
|
|
@@ -62,43 +22,3 @@ const styles = StyleSheet.create({
|
|
|
62
22
|
},
|
|
63
23
|
});
|
|
64
24
|
export default SwitchUI;
|
|
65
|
-
// import React, { useState } from "react";
|
|
66
|
-
// import { View, Switch, StyleSheet } from "react-native";
|
|
67
|
-
// import { Colors } from "../../styles";
|
|
68
|
-
// // Switch component
|
|
69
|
-
// const SwitchUI = ({
|
|
70
|
-
// isEnabled,
|
|
71
|
-
// onValueChange,
|
|
72
|
-
// }: {
|
|
73
|
-
// isEnabled?: boolean;
|
|
74
|
-
// onValueChange?: (value: boolean) => void;
|
|
75
|
-
// }) => {
|
|
76
|
-
// const [internalState, setInternalState] = useState(isEnabled ?? false);
|
|
77
|
-
// const toggleSwitch = () => {
|
|
78
|
-
// setInternalState((prev) => !prev);
|
|
79
|
-
// onValueChange && onValueChange(!internalState);
|
|
80
|
-
// };
|
|
81
|
-
// const value = isEnabled ?? internalState;
|
|
82
|
-
// return (
|
|
83
|
-
// <View
|
|
84
|
-
// style={[
|
|
85
|
-
// styles.container,
|
|
86
|
-
// { borderColor: value ? Colors.primaryColor : Colors.disabledGrey },
|
|
87
|
-
// ]}
|
|
88
|
-
// >
|
|
89
|
-
// <Switch
|
|
90
|
-
// trackColor={{ false: "grey", true: "green" }}
|
|
91
|
-
// style={{ transform: [{ scaleX: 0.8 }, { scaleY: 0.8 }] }}
|
|
92
|
-
// thumbColor={value ? Colors.primaryColor : Colors.disabledGrey}
|
|
93
|
-
// onValueChange={toggleSwitch}
|
|
94
|
-
// value={value}
|
|
95
|
-
// />
|
|
96
|
-
// </View>
|
|
97
|
-
// );
|
|
98
|
-
// };
|
|
99
|
-
// const styles = StyleSheet.create({
|
|
100
|
-
// container: {
|
|
101
|
-
// flex: 1,
|
|
102
|
-
// },
|
|
103
|
-
// });
|
|
104
|
-
// export default SwitchUI;
|