@teamnhz/rn-ui-toolkit 1.4.3 → 1.4.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.
- package/dist/assets/images/downArrow.png +0 -0
- package/dist/components/AppHeader/index.js +36 -38
- package/dist/components/Buttons/index.d.ts +10 -3
- package/dist/components/Buttons/index.js +34 -101
- package/dist/components/Input/index.d.ts +2 -0
- package/dist/components/Input/index.js +22 -11
- package/dist/components/KeyboardScroll/index.d.ts +10 -1
- package/dist/components/KeyboardScroll/index.js +9 -73
- package/dist/components/LinearGradientButton/index.d.ts +10 -3
- package/dist/components/LinearGradientButton/index.js +47 -23
- package/dist/components/index.d.ts +4 -0
- package/dist/components/index.js +4 -0
- package/dist/styles/appConfig.d.ts +4 -0
- package/dist/styles/appConfig.js +94 -0
- package/dist/styles/colors.js +47 -0
- package/dist/styles/images.d.ts +1 -0
- package/dist/styles/images.js +3 -1
- package/dist/styles/index.js +1 -0
- package/dist/styles/typography.d.ts +57 -36
- package/dist/styles/typography.js +430 -104
- package/dist/utils/permissions.d.ts +2 -0
- package/dist/utils/permissions.js +8 -10
- package/package.json +1 -1
|
Binary file
|
|
@@ -1,41 +1,22 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import { View, TouchableOpacity, StyleSheet,
|
|
2
|
+
import { View, TouchableOpacity, StyleSheet, } from "react-native";
|
|
3
3
|
import { Colors } from "../../styles";
|
|
4
4
|
import { Image, T } from "../index";
|
|
5
|
-
|
|
6
|
-
if (Platform.OS === "android") {
|
|
7
|
-
return StatusBar.currentHeight || 0;
|
|
8
|
-
}
|
|
9
|
-
return 20; // iOS safe area fallback
|
|
10
|
-
};
|
|
5
|
+
import { SafeAreaView } from "react-native-safe-area-context";
|
|
11
6
|
const AppHeader = (props) => {
|
|
12
7
|
const { navigation, headerTitle, titleStyle, leftImage, onPressLeft, leftIconStyle, rightImageOne, onPressRightOne, rightImageOneStyle, rightImageTwo, onPressRightTwo, rightImageTwoStyle, headerStyle, } = props;
|
|
13
|
-
const safeTop = getSafeAreaTop();
|
|
14
8
|
navigation.setOptions({
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
headerStyle: [
|
|
27
|
-
styles.headerBase,
|
|
28
|
-
{ paddingTop: safeTop },
|
|
29
|
-
headerStyle,
|
|
30
|
-
],
|
|
31
|
-
headerLeft: () => leftImage ? (React.createElement(TouchableOpacity, { onPress: onPressLeft, activeOpacity: 0.8 },
|
|
32
|
-
React.createElement(Image, { source: leftImage, resizeMode: "contain", style: [styles.icon, leftIconStyle] }))) : null,
|
|
33
|
-
headerTitle: () => headerTitle ? (React.createElement(T, { title: headerTitle, style: [styles.headerTitleText, titleStyle] })) : null,
|
|
34
|
-
headerRight: () => (React.createElement(View, { style: styles.headerRightWrapper },
|
|
35
|
-
rightImageOne ? (React.createElement(TouchableOpacity, { onPress: onPressRightOne, activeOpacity: 0.8 },
|
|
36
|
-
React.createElement(Image, { source: rightImageOne, resizeMode: "contain", style: [styles.icon, rightImageOneStyle] }))) : null,
|
|
37
|
-
rightImageTwo ? (React.createElement(TouchableOpacity, { onPress: onPressRightTwo, activeOpacity: 0.8 },
|
|
38
|
-
React.createElement(Image, { source: rightImageTwo, resizeMode: "contain", style: [styles.icon, rightImageTwoStyle] }))) : null)),
|
|
9
|
+
header: () => (React.createElement(SafeAreaView, { edges: ["top"], style: [styles.headerBase, headerStyle] },
|
|
10
|
+
React.createElement(View, { style: styles.headerContainer },
|
|
11
|
+
React.createElement(View, { style: styles.leftWrapper }, leftImage ? (React.createElement(TouchableOpacity, { onPress: onPressLeft, activeOpacity: 0.8 },
|
|
12
|
+
React.createElement(Image, { source: leftImage, resizeMode: "contain", style: [styles.icon, leftIconStyle] }))) : (React.createElement(View, { style: { width: 28 } }) // placeholder to keep center aligned
|
|
13
|
+
)),
|
|
14
|
+
React.createElement(View, { style: styles.titleWrapper }, headerTitle ? (React.createElement(T, { title: headerTitle, style: [styles.headerTitleText, titleStyle] })) : null),
|
|
15
|
+
React.createElement(View, { style: styles.rightWrapper },
|
|
16
|
+
rightImageOne ? (React.createElement(TouchableOpacity, { onPress: onPressRightOne, activeOpacity: 0.8 },
|
|
17
|
+
React.createElement(Image, { source: rightImageOne, resizeMode: "contain", style: [styles.icon, rightImageOneStyle] }))) : null,
|
|
18
|
+
rightImageTwo ? (React.createElement(TouchableOpacity, { onPress: onPressRightTwo, activeOpacity: 0.8 },
|
|
19
|
+
React.createElement(Image, { source: rightImageTwo, resizeMode: "contain", style: [styles.icon, rightImageTwoStyle] }))) : null)))),
|
|
39
20
|
});
|
|
40
21
|
return null;
|
|
41
22
|
};
|
|
@@ -45,18 +26,35 @@ const styles = StyleSheet.create({
|
|
|
45
26
|
backgroundColor: Colors.white,
|
|
46
27
|
borderBottomWidth: 1,
|
|
47
28
|
borderBottomColor: Colors.lightGrey,
|
|
48
|
-
height: Platform.OS === "ios" ? 90 : 70,
|
|
49
|
-
justifyContent: "center",
|
|
50
29
|
},
|
|
51
|
-
|
|
52
|
-
height:
|
|
53
|
-
|
|
30
|
+
headerContainer: {
|
|
31
|
+
// height: Platform.OS === "ios" ? 60 : 60, // equal height on both
|
|
32
|
+
height: 60, // equal height on both
|
|
33
|
+
flexDirection: "row",
|
|
34
|
+
alignItems: "center",
|
|
35
|
+
justifyContent: "space-between",
|
|
36
|
+
paddingHorizontal: 12,
|
|
54
37
|
},
|
|
55
|
-
|
|
38
|
+
leftWrapper: {
|
|
39
|
+
width: 60,
|
|
40
|
+
justifyContent: "center",
|
|
41
|
+
alignItems: "flex-start",
|
|
42
|
+
},
|
|
43
|
+
rightWrapper: {
|
|
44
|
+
width: 60,
|
|
56
45
|
flexDirection: "row",
|
|
46
|
+
justifyContent: "flex-end",
|
|
57
47
|
alignItems: "center",
|
|
58
48
|
gap: 12,
|
|
59
49
|
},
|
|
50
|
+
titleWrapper: {
|
|
51
|
+
flex: 1,
|
|
52
|
+
alignItems: "center",
|
|
53
|
+
},
|
|
54
|
+
icon: {
|
|
55
|
+
height: 28,
|
|
56
|
+
width: 28,
|
|
57
|
+
},
|
|
60
58
|
headerTitleText: {
|
|
61
59
|
color: Colors.black,
|
|
62
60
|
textAlign: "center",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import { ViewStyle,
|
|
2
|
+
import { TextStyle, ViewStyle, ImageSourcePropType, ImageStyle } from "react-native";
|
|
3
3
|
type ButtonDataProps = {
|
|
4
|
-
title
|
|
4
|
+
title?: string;
|
|
5
5
|
buttonStyle?: ViewStyle;
|
|
6
6
|
intlType?: string;
|
|
7
7
|
outline?: boolean;
|
|
@@ -9,6 +9,13 @@ type ButtonDataProps = {
|
|
|
9
9
|
loading?: boolean;
|
|
10
10
|
onPress?: () => void;
|
|
11
11
|
disabled?: boolean;
|
|
12
|
+
icon?: ImageSourcePropType | null;
|
|
13
|
+
leftIcon?: ImageSourcePropType | null;
|
|
14
|
+
rightIcon?: ImageSourcePropType | null;
|
|
15
|
+
leftIconStyle?: ImageStyle;
|
|
16
|
+
rightIconStyle?: ImageStyle;
|
|
17
|
+
iconStyle?: ImageStyle;
|
|
18
|
+
iconContainerStyle?: ViewStyle;
|
|
12
19
|
};
|
|
13
|
-
declare const Button: ({ outline, buttonStyle, title, intlType, titleStyle, loading, onPress, disabled, }: ButtonDataProps) => React.JSX.Element;
|
|
20
|
+
declare const Button: ({ outline, buttonStyle, title, intlType, titleStyle, loading, onPress, disabled, icon, leftIcon, rightIcon, leftIconStyle, rightIconStyle, iconStyle, }: ButtonDataProps) => React.JSX.Element;
|
|
14
21
|
export default Button;
|
|
@@ -1,137 +1,70 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import { StyleSheet,
|
|
2
|
+
import { StyleSheet, TouchableOpacity, ActivityIndicator, Image, View, } from "react-native";
|
|
3
3
|
import { useTranslation } from "react-i18next";
|
|
4
4
|
import { Colors, Typography, Scale } from "../../styles";
|
|
5
|
-
|
|
6
|
-
const Button = ({ outline, buttonStyle, title, intlType, titleStyle, loading, onPress, disabled, }) => {
|
|
5
|
+
import T from "../T";
|
|
6
|
+
const Button = ({ outline, buttonStyle, title, intlType, titleStyle, loading, onPress, disabled, icon = null, leftIcon = null, rightIcon = null, leftIconStyle, rightIconStyle, iconStyle, }) => {
|
|
7
7
|
const { t } = useTranslation();
|
|
8
|
+
const isValidTitle = title && title.trim().length > 0;
|
|
9
|
+
const hasLeft = !!leftIcon;
|
|
10
|
+
const hasRight = !!rightIcon;
|
|
11
|
+
const hasIcon = !!icon;
|
|
8
12
|
const dynamicTranslation = (text) => intlType ? t(text, { ns: intlType }) : t(text);
|
|
9
13
|
return (React.createElement(TouchableOpacity, { style: [
|
|
10
14
|
styles.button,
|
|
11
15
|
outline && styles.outlineButton,
|
|
12
16
|
buttonStyle,
|
|
13
17
|
(disabled || loading) && styles.disabledButton,
|
|
14
|
-
], onPress: onPress, disabled: disabled || loading, activeOpacity: 0.7 }, loading ? (React.createElement(ActivityIndicator, { color: outline ? Colors.primaryColor : "#fff" })) : (React.createElement(
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
18
|
+
], onPress: onPress, disabled: disabled || loading, activeOpacity: 0.7 }, loading ? (React.createElement(ActivityIndicator, { color: outline ? Colors.primaryColor : "#fff" })) : (React.createElement(View, { style: styles.innerContainer },
|
|
19
|
+
hasIcon && (React.createElement(Image, { source: icon, style: [styles.icon, iconStyle], resizeMode: "contain" })),
|
|
20
|
+
hasLeft && (React.createElement(Image, { source: leftIcon, style: [styles.icon, leftIconStyle], resizeMode: "contain" })),
|
|
21
|
+
isValidTitle && (React.createElement(T, { style: [
|
|
22
|
+
styles.defaultTitleStyle,
|
|
23
|
+
outline && styles.outlineTitleStyle,
|
|
24
|
+
titleStyle,
|
|
25
|
+
], numberOfLines: 1 }, dynamicTranslation(title))),
|
|
26
|
+
hasRight && (React.createElement(Image, { source: rightIcon, style: [styles.icon, rightIconStyle], resizeMode: "contain" }))))));
|
|
19
27
|
};
|
|
20
28
|
export default Button;
|
|
21
29
|
const styles = StyleSheet.create({
|
|
22
30
|
button: {
|
|
23
|
-
width:
|
|
31
|
+
width: "100%",
|
|
24
32
|
alignSelf: "center",
|
|
25
33
|
borderRadius: 5,
|
|
26
34
|
backgroundColor: Colors.primaryColor,
|
|
27
35
|
height: Scale.moderateScale(50),
|
|
28
36
|
alignItems: "center",
|
|
29
37
|
justifyContent: "center",
|
|
38
|
+
paddingHorizontal: Scale.moderateScale(12),
|
|
39
|
+
},
|
|
40
|
+
innerContainer: {
|
|
41
|
+
flexDirection: "row",
|
|
42
|
+
alignItems: "center",
|
|
43
|
+
justifyContent: "center", // KEY FIX
|
|
44
|
+
flexShrink: 1,
|
|
45
|
+
flexGrow: 0,
|
|
46
|
+
gap: Scale.moderateScale(8),
|
|
30
47
|
},
|
|
31
48
|
outlineButton: {
|
|
32
49
|
backgroundColor: "transparent",
|
|
33
50
|
borderWidth: 1,
|
|
34
51
|
borderColor: Colors.primaryColor,
|
|
35
52
|
},
|
|
36
|
-
outlineTitleStyle: { color: Colors.primaryColor },
|
|
37
53
|
defaultTitleStyle: {
|
|
38
54
|
...Typography.style.standardU(),
|
|
39
55
|
textTransform: "capitalize",
|
|
40
56
|
color: Colors.white,
|
|
57
|
+
flexShrink: 1,
|
|
58
|
+
textAlign: "center",
|
|
41
59
|
},
|
|
60
|
+
outlineTitleStyle: { color: Colors.primaryColor },
|
|
42
61
|
disabledButton: {
|
|
43
62
|
opacity: 0.6,
|
|
44
63
|
backgroundColor: Colors.disabledGrey,
|
|
45
64
|
},
|
|
65
|
+
icon: {
|
|
66
|
+
width: Scale.moderateScale(20),
|
|
67
|
+
height: Scale.moderateScale(20),
|
|
68
|
+
flexShrink: 0,
|
|
69
|
+
},
|
|
46
70
|
});
|
|
47
|
-
// import React from "react";
|
|
48
|
-
// import {
|
|
49
|
-
// StyleSheet,
|
|
50
|
-
// Text,
|
|
51
|
-
// TouchableOpacity,
|
|
52
|
-
// ActivityIndicator,
|
|
53
|
-
// ViewStyle,
|
|
54
|
-
// TextStyle,
|
|
55
|
-
// Dimensions,
|
|
56
|
-
// } from "react-native";
|
|
57
|
-
// import { useTranslation } from "react-i18next";
|
|
58
|
-
// import { Colors, Typography, Scale } from "../../styles";
|
|
59
|
-
// const { width } = Dimensions.get("window");
|
|
60
|
-
// type ButtonDataProps = {
|
|
61
|
-
// title: string;
|
|
62
|
-
// buttonStyle?: ViewStyle;
|
|
63
|
-
// intlType?: string; // namespace
|
|
64
|
-
// outline?: boolean;
|
|
65
|
-
// titleStyle?: TextStyle;
|
|
66
|
-
// loading?: boolean;
|
|
67
|
-
// onPress?: () => void;
|
|
68
|
-
// disabled?: boolean;
|
|
69
|
-
// };
|
|
70
|
-
// const Button = ({
|
|
71
|
-
// outline,
|
|
72
|
-
// buttonStyle,
|
|
73
|
-
// title,
|
|
74
|
-
// intlType,
|
|
75
|
-
// titleStyle,
|
|
76
|
-
// loading,
|
|
77
|
-
// onPress,
|
|
78
|
-
// disabled,
|
|
79
|
-
// }: ButtonDataProps) => {
|
|
80
|
-
// const { t } = useTranslation();
|
|
81
|
-
// const dynamicTranslation = (text: string) =>
|
|
82
|
-
// intlType ? t(text, { ns: intlType }) : t(text);
|
|
83
|
-
// return (
|
|
84
|
-
// <TouchableOpacity
|
|
85
|
-
// style={[
|
|
86
|
-
// styles.button,
|
|
87
|
-
// outline && styles.outlineButton,
|
|
88
|
-
// buttonStyle,
|
|
89
|
-
// (disabled || loading) && styles.disabledButton,
|
|
90
|
-
// ]}
|
|
91
|
-
// onPress={onPress}
|
|
92
|
-
// disabled={disabled || loading}
|
|
93
|
-
// activeOpacity={0.7}
|
|
94
|
-
// >
|
|
95
|
-
// {loading ? (
|
|
96
|
-
// <ActivityIndicator color={outline ? Colors.primaryColor : "#fff"} />
|
|
97
|
-
// ) : (
|
|
98
|
-
// <Text
|
|
99
|
-
// style={[
|
|
100
|
-
// styles.defaultTitleStyle,
|
|
101
|
-
// outline && styles.outlineTitleStyle,
|
|
102
|
-
// titleStyle,
|
|
103
|
-
// ]}
|
|
104
|
-
// >
|
|
105
|
-
// {dynamicTranslation(title)}
|
|
106
|
-
// </Text>
|
|
107
|
-
// )}
|
|
108
|
-
// </TouchableOpacity>
|
|
109
|
-
// );
|
|
110
|
-
// };
|
|
111
|
-
// export default Button;
|
|
112
|
-
// const styles = StyleSheet.create({
|
|
113
|
-
// button: {
|
|
114
|
-
// width: width,
|
|
115
|
-
// alignSelf: "center",
|
|
116
|
-
// borderRadius: 5,
|
|
117
|
-
// backgroundColor: Colors.primaryColor,
|
|
118
|
-
// height: Scale.moderateScale(50),
|
|
119
|
-
// alignItems: "center",
|
|
120
|
-
// justifyContent: "center",
|
|
121
|
-
// },
|
|
122
|
-
// outlineButton: {
|
|
123
|
-
// backgroundColor: "transparent",
|
|
124
|
-
// borderWidth: 1,
|
|
125
|
-
// borderColor: Colors.primaryColor,
|
|
126
|
-
// },
|
|
127
|
-
// outlineTitleStyle: { color: Colors.primaryColor },
|
|
128
|
-
// defaultTitleStyle: {
|
|
129
|
-
// ...Typography.style.standardU(),
|
|
130
|
-
// textTransform: "capitalize",
|
|
131
|
-
// color: Colors.white,
|
|
132
|
-
// },
|
|
133
|
-
// disabledButton: {
|
|
134
|
-
// opacity: 0.6,
|
|
135
|
-
// backgroundColor: Colors.disabledGrey,
|
|
136
|
-
// },
|
|
137
|
-
// });
|
|
@@ -36,6 +36,8 @@ interface InputProps extends TextInputProps {
|
|
|
36
36
|
countryCodeWrapperStyle?: object;
|
|
37
37
|
countryCodeTextStyle?: object;
|
|
38
38
|
isError?: boolean;
|
|
39
|
+
downArrowIcon?: ImageSourcePropType;
|
|
40
|
+
downArrowStyle?: object;
|
|
39
41
|
}
|
|
40
42
|
declare const Input: React.FC<InputProps>;
|
|
41
43
|
export default Input;
|
|
@@ -4,7 +4,7 @@ import { useTranslation } from "react-i18next";
|
|
|
4
4
|
import { Colors, Typography, Scale, Images } from "../../styles";
|
|
5
5
|
import { defaultRegex } from "../../utils/regex";
|
|
6
6
|
import { messages } from "../../constants/messages";
|
|
7
|
-
const Input = ({ intlType, textKey, placeholder, inputPlaceholderTextColor, leftIcon, rightIcon, onLeftIconPress, onRightIconPress, style, containerStyle, inputStyle, errorTextStyle, leftIconStyle, rightIconStyle, leftIconWrapperStyle, rightIconWrapperStyle, type = "text", editable = true, error, value = "", customRegex, customErrorMessage, onChangeText, onValidation, onBlur: restOnBlur, onFocus: restOnFocus, multiline = false, maxLength, returnKeyType, countryCode, onPressCountryCode, countryCodeTextStyle, countryCodeWrapperStyle, isError = true, ...rest }) => {
|
|
7
|
+
const Input = ({ intlType, textKey, placeholder, inputPlaceholderTextColor, leftIcon, rightIcon, onLeftIconPress, onRightIconPress, style, containerStyle, inputStyle, errorTextStyle, leftIconStyle, rightIconStyle, leftIconWrapperStyle, rightIconWrapperStyle, type = "text", editable = true, error, value = "", customRegex, customErrorMessage, onChangeText, onValidation, onBlur: restOnBlur, onFocus: restOnFocus, multiline = false, maxLength, returnKeyType, countryCode, onPressCountryCode, countryCodeTextStyle, countryCodeWrapperStyle, isError = true, downArrowIcon, downArrowStyle, ...rest }) => {
|
|
8
8
|
const { t } = useTranslation();
|
|
9
9
|
const [secureText, setSecureText] = useState(type === "password");
|
|
10
10
|
const [internalError, setInternalError] = useState(null);
|
|
@@ -85,7 +85,10 @@ const Input = ({ intlType, textKey, placeholder, inputPlaceholderTextColor, left
|
|
|
85
85
|
leftIcon && (React.createElement(TouchableOpacity, { onPress: onLeftIconPress, disabled: !onLeftIconPress, style: [styles.iconWrapper, leftIconWrapperStyle] },
|
|
86
86
|
React.createElement(Image, { source: leftIcon, style: [styles.icon, leftIconStyle], resizeMode: "contain" }))),
|
|
87
87
|
countryCode && (React.createElement(TouchableOpacity, { onPress: onPressCountryCode, disabled: !onPressCountryCode, style: [styles.countryCodeWrapper, countryCodeWrapperStyle] },
|
|
88
|
-
React.createElement(
|
|
88
|
+
React.createElement(View, { style: styles.rowCenter },
|
|
89
|
+
React.createElement(Image, { source: downArrowIcon || Images.down_arrow // <-- Your default arrow
|
|
90
|
+
, style: [styles.downArrow, downArrowStyle], tintColor: Colors.black }),
|
|
91
|
+
React.createElement(Text, { style: [styles.countryCodeText, countryCodeTextStyle] }, countryCode)))),
|
|
89
92
|
React.createElement(TextInput, { style: [
|
|
90
93
|
styles.input,
|
|
91
94
|
!editable && styles.disabledText,
|
|
@@ -143,7 +146,7 @@ const styles = StyleSheet.create({
|
|
|
143
146
|
borderColor: Colors.borderGrey,
|
|
144
147
|
},
|
|
145
148
|
disabledText: {
|
|
146
|
-
color: Colors.
|
|
149
|
+
color: Colors.lightGrey,
|
|
147
150
|
},
|
|
148
151
|
errorBorder: {
|
|
149
152
|
borderColor: Colors.dangerRed,
|
|
@@ -153,17 +156,25 @@ const styles = StyleSheet.create({
|
|
|
153
156
|
fontSize: Scale.moderateScale(12),
|
|
154
157
|
marginTop: 3,
|
|
155
158
|
},
|
|
159
|
+
rowCenter: {
|
|
160
|
+
flexDirection: "row",
|
|
161
|
+
alignItems: "center",
|
|
162
|
+
},
|
|
163
|
+
downArrow: {
|
|
164
|
+
width: 15,
|
|
165
|
+
height: 15,
|
|
166
|
+
resizeMode: "contain",
|
|
167
|
+
marginRight: 5,
|
|
168
|
+
},
|
|
156
169
|
countryCodeWrapper: {
|
|
157
|
-
|
|
158
|
-
|
|
170
|
+
paddingRight: 10,
|
|
171
|
+
paddingVertical: 8,
|
|
172
|
+
borderRadius: 8,
|
|
173
|
+
flexDirection: "row",
|
|
159
174
|
alignItems: "center",
|
|
160
|
-
borderRightWidth: 1,
|
|
161
|
-
borderRightColor: Colors.borderGrey,
|
|
162
|
-
marginRight: Scale.moderateScale(6),
|
|
163
175
|
},
|
|
164
176
|
countryCodeText: {
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
color: Colors.textColor,
|
|
177
|
+
fontSize: 16,
|
|
178
|
+
color: "#333",
|
|
168
179
|
},
|
|
169
180
|
});
|
|
@@ -1,3 +1,12 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
|
|
2
|
+
import { ScrollViewProps } from "react-native";
|
|
3
|
+
import type { KeyboardAwareProps } from "react-native-keyboard-aware-scroll-view";
|
|
4
|
+
type KeyboardScrollProps = KeyboardAwareProps & ScrollViewProps;
|
|
5
|
+
/**
|
|
6
|
+
* FULLY EXTENDED COMPONENT
|
|
7
|
+
* - Supports ALL props of KeyboardAwareScrollView
|
|
8
|
+
* - No conflict props
|
|
9
|
+
* - Clean + reusable wrapper
|
|
10
|
+
*/
|
|
11
|
+
declare const KeyboardScroll: ({ children, ...restProps }: KeyboardScrollProps) => React.JSX.Element;
|
|
3
12
|
export default KeyboardScroll;
|
|
@@ -1,76 +1,12 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import { KeyboardAwareScrollView } from "react-native-keyboard-aware-scroll-view";
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
import { KeyboardAwareScrollView, } from "react-native-keyboard-aware-scroll-view";
|
|
3
|
+
/**
|
|
4
|
+
* FULLY EXTENDED COMPONENT
|
|
5
|
+
* - Supports ALL props of KeyboardAwareScrollView
|
|
6
|
+
* - No conflict props
|
|
7
|
+
* - Clean + reusable wrapper
|
|
8
|
+
*/
|
|
9
|
+
const KeyboardScroll = ({ children, ...restProps }) => {
|
|
10
|
+
return (React.createElement(KeyboardAwareScrollView, { showsVerticalScrollIndicator: false, keyboardShouldPersistTaps: "handled", bounces: false, ...restProps }, children));
|
|
5
11
|
};
|
|
6
12
|
export default KeyboardScroll;
|
|
7
|
-
// import React from "react";
|
|
8
|
-
// import { KeyboardAwareScrollView } from "react-native-keyboard-aware-scroll-view";
|
|
9
|
-
// const KeyboardScroll = (props: any) => {
|
|
10
|
-
// return (
|
|
11
|
-
// <KeyboardAwareScrollView
|
|
12
|
-
// showsVerticalScrollIndicator={false}
|
|
13
|
-
// keyboardShouldPersistTaps={"handled"}
|
|
14
|
-
// bounces={false}
|
|
15
|
-
// enableAutomaticScroll={true}
|
|
16
|
-
// {...props}
|
|
17
|
-
// ></KeyboardAwareScrollView>
|
|
18
|
-
// );
|
|
19
|
-
// };
|
|
20
|
-
// export default KeyboardScroll;
|
|
21
|
-
/////////////////////////////////////////////////////////////////////
|
|
22
|
-
// import React, { ReactNode } from 'react';
|
|
23
|
-
// import { StyleSheet, ViewStyle, Platform } from 'react-native';
|
|
24
|
-
// import { Edges, SafeAreaView } from 'react-native-safe-area-context';
|
|
25
|
-
// import { Colors, Scale } from '../../styles';
|
|
26
|
-
// import { ScrollView } from 'react-native';
|
|
27
|
-
// type ScrolledContainerProps = {
|
|
28
|
-
// children: ReactNode;
|
|
29
|
-
// containerStyle?: ViewStyle;
|
|
30
|
-
// safeEdgesTop?: boolean;
|
|
31
|
-
// safeEdgesBottom?: boolean;
|
|
32
|
-
// addPaddingTop?: boolean;
|
|
33
|
-
// scrollEnabled?: boolean; // in case you want to toggle scroll
|
|
34
|
-
// keyboardShouldPersistTaps?: 'always' | 'handled' | 'never';
|
|
35
|
-
// };
|
|
36
|
-
// const ScrolledContainer = ({
|
|
37
|
-
// containerStyle,
|
|
38
|
-
// children,
|
|
39
|
-
// safeEdgesTop,
|
|
40
|
-
// safeEdgesBottom,
|
|
41
|
-
// addPaddingTop,
|
|
42
|
-
// scrollEnabled = true,
|
|
43
|
-
// keyboardShouldPersistTaps = 'handled',
|
|
44
|
-
// }: ScrolledContainerProps) => {
|
|
45
|
-
// const edges: any = ['left', 'right'];
|
|
46
|
-
// if (safeEdgesTop) edges.push('top');
|
|
47
|
-
// if (safeEdgesBottom) edges.push('bottom');
|
|
48
|
-
// return (
|
|
49
|
-
// <SafeAreaView edges={edges} style={styles.globalSafeAreaStyle}>
|
|
50
|
-
// <ScrollView
|
|
51
|
-
// contentContainerStyle={[
|
|
52
|
-
// styles.screen,
|
|
53
|
-
// addPaddingTop && { paddingTop: Scale?.moderateScale(50) },
|
|
54
|
-
// containerStyle,
|
|
55
|
-
// ]}
|
|
56
|
-
// showsVerticalScrollIndicator={false}
|
|
57
|
-
// scrollEnabled={scrollEnabled}
|
|
58
|
-
// keyboardShouldPersistTaps={keyboardShouldPersistTaps}
|
|
59
|
-
// >
|
|
60
|
-
// {children}
|
|
61
|
-
// </ScrollView>
|
|
62
|
-
// </SafeAreaView>
|
|
63
|
-
// );
|
|
64
|
-
// };
|
|
65
|
-
// export default ScrolledContainer;
|
|
66
|
-
// const styles = StyleSheet.create({
|
|
67
|
-
// globalSafeAreaStyle: {
|
|
68
|
-
// flex: 1,
|
|
69
|
-
// backgroundColor: Colors.background,
|
|
70
|
-
// paddingBottom: Platform.OS === 'android' ? Scale?.moderateScale(10) : 0,
|
|
71
|
-
// },
|
|
72
|
-
// screen: {
|
|
73
|
-
// flexGrow: 1, // makes ScrollView expand & scroll
|
|
74
|
-
// paddingTop: Scale?.moderateScale(20),
|
|
75
|
-
// },
|
|
76
|
-
// });
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import { ViewStyle,
|
|
2
|
+
import { TextStyle, ViewStyle, ImageSourcePropType, ImageStyle } from "react-native";
|
|
3
3
|
interface LinearGradientButtonProps {
|
|
4
|
-
title
|
|
4
|
+
title?: string;
|
|
5
5
|
onPress: () => void;
|
|
6
6
|
loading?: boolean;
|
|
7
7
|
disabled?: boolean;
|
|
@@ -15,9 +15,16 @@ interface LinearGradientButtonProps {
|
|
|
15
15
|
y: number;
|
|
16
16
|
};
|
|
17
17
|
containerStyle?: ViewStyle;
|
|
18
|
-
|
|
18
|
+
titleStyle?: TextStyle;
|
|
19
19
|
height?: number;
|
|
20
20
|
borderRadius?: number;
|
|
21
|
+
leftIcon?: ImageSourcePropType | null;
|
|
22
|
+
rightIcon?: ImageSourcePropType | null;
|
|
23
|
+
icon?: ImageSourcePropType | null;
|
|
24
|
+
leftIconStyle?: ImageStyle;
|
|
25
|
+
rightIconStyle?: ImageStyle;
|
|
26
|
+
iconStyle?: ImageStyle;
|
|
27
|
+
iconContainerStyle?: ViewStyle;
|
|
21
28
|
}
|
|
22
29
|
declare const LinearGradientButton: React.FC<LinearGradientButtonProps>;
|
|
23
30
|
export default LinearGradientButton;
|
|
@@ -1,39 +1,63 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import { TouchableOpacity,
|
|
2
|
+
import { TouchableOpacity, ActivityIndicator, Image, View, StyleSheet, } from "react-native";
|
|
3
3
|
import LinearGradient from "react-native-linear-gradient";
|
|
4
|
-
|
|
4
|
+
import { Colors, Typography, Scale } from "../../styles";
|
|
5
|
+
import T from "../T";
|
|
6
|
+
const LinearGradientButton = ({ title, onPress, loading = false, disabled = false, colors = ["#4c669f", "#3b5998", "#192f6a"], start = { x: 0, y: 0 }, end = { x: 1, y: 1 }, containerStyle, titleStyle, height = Scale.moderateScale(50), borderRadius = 5, leftIcon, rightIcon, icon, leftIconStyle, rightIconStyle, iconStyle, iconContainerStyle, }) => {
|
|
5
7
|
const isDisabled = loading || disabled;
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
8
|
+
const isValidTitle = typeof title === "string" && title.trim().length > 0;
|
|
9
|
+
const hasLeft = !!leftIcon;
|
|
10
|
+
const hasRight = !!rightIcon;
|
|
11
|
+
const hasIcon = !!icon;
|
|
12
|
+
return (React.createElement(TouchableOpacity, { activeOpacity: 0.7, onPress: onPress, disabled: isDisabled, style: [
|
|
13
|
+
styles.touchableContainer,
|
|
9
14
|
containerStyle,
|
|
15
|
+
{ opacity: isDisabled ? 0.6 : 1 },
|
|
10
16
|
] },
|
|
11
|
-
React.createElement(LinearGradient, { colors: colors, start: start, end: end, style: [styles.button, { height, borderRadius }] }, loading ? (React.createElement(ActivityIndicator, { color: "#fff"
|
|
17
|
+
React.createElement(LinearGradient, { colors: colors, start: start, end: end, style: [styles.button, { height, borderRadius }] }, loading ? (React.createElement(ActivityIndicator, { color: "#fff" })) : (React.createElement(View, { style: [styles.innerContainer, iconContainerStyle] },
|
|
18
|
+
React.createElement(View, { style: styles.contentRow },
|
|
19
|
+
hasLeft && (React.createElement(Image, { source: leftIcon, style: [styles.icon, leftIconStyle], resizeMode: "contain" })),
|
|
20
|
+
hasIcon && (React.createElement(Image, { source: icon, style: [styles.iconCenter, iconStyle], resizeMode: "contain" })),
|
|
21
|
+
isValidTitle && (React.createElement(T, { style: [styles.defaultTitleStyle, titleStyle], numberOfLines: 1 }, title)),
|
|
22
|
+
hasRight && (React.createElement(Image, { source: rightIcon, style: [styles.icon, rightIconStyle], resizeMode: "contain" }))))))));
|
|
12
23
|
};
|
|
13
24
|
const styles = StyleSheet.create({
|
|
14
|
-
|
|
15
|
-
alignSelf: "
|
|
25
|
+
touchableContainer: {
|
|
26
|
+
alignSelf: "center", // This centers the button when width is reduced
|
|
16
27
|
},
|
|
17
28
|
button: {
|
|
29
|
+
width: "100%",
|
|
18
30
|
justifyContent: "center",
|
|
19
31
|
alignItems: "center",
|
|
32
|
+
overflow: "hidden",
|
|
20
33
|
},
|
|
21
|
-
|
|
22
|
-
color: "#fff",
|
|
23
|
-
fontSize: 16,
|
|
24
|
-
fontWeight: "600",
|
|
25
|
-
textAlign: "center",
|
|
34
|
+
innerContainer: {
|
|
26
35
|
width: "100%",
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
36
|
+
height: "100%",
|
|
37
|
+
justifyContent: "center",
|
|
38
|
+
alignItems: "center",
|
|
39
|
+
paddingHorizontal: Scale.moderateScale(12),
|
|
40
|
+
},
|
|
41
|
+
// Flexbox row for icons + title
|
|
42
|
+
contentRow: {
|
|
43
|
+
flexDirection: "row",
|
|
44
|
+
alignItems: "center",
|
|
45
|
+
justifyContent: "center",
|
|
46
|
+
gap: Scale.moderateScale(8), // Space between icons and title
|
|
47
|
+
},
|
|
48
|
+
defaultTitleStyle: {
|
|
49
|
+
...Typography.style.standardU(),
|
|
50
|
+
textTransform: "capitalize",
|
|
51
|
+
color: Colors.white,
|
|
52
|
+
textAlign: "center",
|
|
53
|
+
},
|
|
54
|
+
icon: {
|
|
55
|
+
width: Scale.moderateScale(20),
|
|
56
|
+
height: Scale.moderateScale(20),
|
|
57
|
+
},
|
|
58
|
+
iconCenter: {
|
|
59
|
+
width: Scale.moderateScale(24),
|
|
60
|
+
height: Scale.moderateScale(24),
|
|
37
61
|
},
|
|
38
62
|
});
|
|
39
63
|
export default LinearGradientButton;
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
export { Colors as TheameColor } from "../styles";
|
|
2
|
+
export { setLanguage, setFontConfig, getFont } from '../styles/appConfig';
|
|
1
3
|
export { default as Buttons } from "./Buttons";
|
|
2
4
|
export { default as Container } from "./Container";
|
|
3
5
|
export { default as Dividers } from "./Dividers";
|
|
@@ -28,3 +30,5 @@ export { default as DocumentPicker } from "./DocumentPicker";
|
|
|
28
30
|
export { default as ImagePicker } from "./ImagePicker";
|
|
29
31
|
export { default as AppHeader } from "./AppHeader";
|
|
30
32
|
export { default as LinearGradientButton } from "./LinearGradientButton";
|
|
33
|
+
export { default as Typography } from '../styles/typography';
|
|
34
|
+
export { scale, verticalScale, moderateScale } from '../styles/scale';
|
package/dist/components/index.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
export { Colors as TheameColor } from "../styles";
|
|
2
|
+
export { setLanguage, setFontConfig, getFont } from '../styles/appConfig';
|
|
1
3
|
export { default as Buttons } from "./Buttons";
|
|
2
4
|
export { default as Container } from "./Container";
|
|
3
5
|
export { default as Dividers } from "./Dividers";
|
|
@@ -28,3 +30,5 @@ export { default as DocumentPicker } from "./DocumentPicker";
|
|
|
28
30
|
export { default as ImagePicker } from "./ImagePicker";
|
|
29
31
|
export { default as AppHeader } from "./AppHeader";
|
|
30
32
|
export { default as LinearGradientButton } from "./LinearGradientButton";
|
|
33
|
+
export { default as Typography } from '../styles/typography';
|
|
34
|
+
export { scale, verticalScale, moderateScale } from '../styles/scale';
|