@rn-components-dropdown/dropdown 1.0.0

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.
Files changed (86) hide show
  1. package/dist/components/dropdown/Dropdown.d.ts +4 -0
  2. package/dist/components/dropdown/Dropdown.js +313 -0
  3. package/dist/components/dropdown/DropdownStyle.d.ts +151 -0
  4. package/dist/components/dropdown/DropdownStyle.js +148 -0
  5. package/dist/components/dropdown/components/chip/Chip.d.ts +3 -0
  6. package/dist/components/dropdown/components/chip/Chip.js +22 -0
  7. package/dist/components/dropdown/components/chip/ChipStyle.d.ts +84 -0
  8. package/dist/components/dropdown/components/chip/ChipStyle.js +63 -0
  9. package/dist/components/dropdown/components/input/TextInput.d.ts +3 -0
  10. package/dist/components/dropdown/components/input/TextInput.js +60 -0
  11. package/dist/components/dropdown/components/input/TextInputStyle.d.ts +32 -0
  12. package/dist/components/dropdown/components/input/TextInputStyle.js +33 -0
  13. package/dist/components/dropdown/hooks/useDetectDevice.d.ts +3 -0
  14. package/dist/components/dropdown/hooks/useDetectDevice.js +22 -0
  15. package/dist/components/dropdown/hooks/useDropdown.d.ts +26 -0
  16. package/dist/components/dropdown/hooks/useDropdown.js +263 -0
  17. package/dist/components/dropdown/hooks/useOrientation.d.ts +1 -0
  18. package/dist/components/dropdown/hooks/useOrientation.js +30 -0
  19. package/dist/components/dropdown/interface/ChipInterface.d.ts +8 -0
  20. package/dist/components/dropdown/interface/ChipInterface.js +2 -0
  21. package/dist/components/dropdown/interface/DropdownInterface.d.ts +71 -0
  22. package/dist/components/dropdown/interface/DropdownInterface.js +2 -0
  23. package/dist/components/dropdown/interface/InputProps.d.ts +8 -0
  24. package/dist/components/dropdown/interface/InputProps.js +2 -0
  25. package/dist/components/svgButton/SvgButton.d.ts +11 -0
  26. package/dist/components/svgButton/SvgButton.js +16 -0
  27. package/dist/components/svgButton/SvgButtonStyle.d.ts +28 -0
  28. package/dist/components/svgButton/SvgButtonStyle.js +29 -0
  29. package/dist/components/text/AppText.d.ts +12 -0
  30. package/dist/components/text/AppText.js +24 -0
  31. package/dist/components/text/AppTextStyle.d.ts +171 -0
  32. package/dist/components/text/AppTextStyle.js +27 -0
  33. package/dist/components/textInput/AppTextInput.d.ts +20 -0
  34. package/dist/components/textInput/AppTextInput.js +89 -0
  35. package/dist/components/textInput/AppTextInputStyle.d.ts +79 -0
  36. package/dist/components/textInput/AppTextInputStyle.js +61 -0
  37. package/dist/controller/dropDownController/DropdownController.d.ts +10 -0
  38. package/dist/controller/dropDownController/DropdownController.js +25 -0
  39. package/dist/controller/dropDownController/DropdownControllerStyle.d.ts +50 -0
  40. package/dist/controller/dropDownController/DropdownControllerStyle.js +48 -0
  41. package/dist/controller/textInputController/AppTextInputController.d.ts +13 -0
  42. package/dist/controller/textInputController/AppTextInputController.js +14 -0
  43. package/dist/controller/textInputController/InputControllerStyle.d.ts +31 -0
  44. package/dist/controller/textInputController/InputControllerStyle.js +29 -0
  45. package/dist/index.d.ts +5 -0
  46. package/dist/index.js +16 -0
  47. package/dist/interface/colors.interface.d.ts +20 -0
  48. package/dist/interface/colors.interface.js +2 -0
  49. package/dist/style/colors.d.ts +33 -0
  50. package/dist/style/colors.js +44 -0
  51. package/dist/style/index.d.ts +7 -0
  52. package/dist/style/index.js +29 -0
  53. package/dist/style/shadow.d.ts +161 -0
  54. package/dist/style/shadow.js +158 -0
  55. package/dist/style/spacing.d.ts +23 -0
  56. package/dist/style/spacing.js +26 -0
  57. package/package.json +33 -0
  58. package/src/components/dropdown/Dropdown.tsx +512 -0
  59. package/src/components/dropdown/DropdownStyle.ts +154 -0
  60. package/src/components/dropdown/components/chip/Chip.tsx +31 -0
  61. package/src/components/dropdown/components/chip/ChipStyle.ts +64 -0
  62. package/src/components/dropdown/components/input/TextInput.tsx +46 -0
  63. package/src/components/dropdown/components/input/TextInputStyle.ts +32 -0
  64. package/src/components/dropdown/hooks/useDetectDevice.ts +25 -0
  65. package/src/components/dropdown/hooks/useDropdown.ts +356 -0
  66. package/src/components/dropdown/hooks/useOrientation.ts +36 -0
  67. package/src/components/dropdown/interface/ChipInterface.ts +9 -0
  68. package/src/components/dropdown/interface/DropdownInterface.ts +90 -0
  69. package/src/components/dropdown/interface/InputProps.ts +9 -0
  70. package/src/components/svgButton/SvgButton.tsx +37 -0
  71. package/src/components/svgButton/SvgButtonStyle.ts +27 -0
  72. package/src/components/text/AppText.tsx +41 -0
  73. package/src/components/text/AppTextStyle.ts +40 -0
  74. package/src/components/textInput/AppTextInput.tsx +148 -0
  75. package/src/components/textInput/AppTextInputStyle.ts +72 -0
  76. package/src/controller/dropDownController/DropdownController.tsx +81 -0
  77. package/src/controller/dropDownController/DropdownControllerStyle.ts +47 -0
  78. package/src/controller/textInputController/AppTextInputController.tsx +50 -0
  79. package/src/controller/textInputController/InputControllerStyle.ts +28 -0
  80. package/src/index.ts +5 -0
  81. package/src/interface/colors.interface.ts +22 -0
  82. package/src/style/colors.ts +46 -0
  83. package/src/style/index.ts +14 -0
  84. package/src/style/shadow.ts +155 -0
  85. package/src/style/spacing.ts +23 -0
  86. package/tsconfig.json +13 -0
@@ -0,0 +1,27 @@
1
+ import { useMemo } from 'react';
2
+ import { StyleSheet } from 'react-native';
3
+ import { LIGHT_COLORS } from '../../style';
4
+
5
+ export const useSvgButtonStyle = () => {
6
+ const { ...colors } = LIGHT_COLORS;
7
+ const styles = useMemo(() => {
8
+ return StyleSheet.create({
9
+ favIcon: {
10
+ width: 50,
11
+ right: 25,
12
+ height: 50,
13
+ bottom: 25,
14
+ borderRadius: 6,
15
+ position: 'absolute',
16
+ alignItems: 'center',
17
+ justifyContent: 'center',
18
+ backgroundColor: colors.green,
19
+ },
20
+ });
21
+ }, [colors]);
22
+
23
+ return {
24
+ styles,
25
+ colors,
26
+ };
27
+ };
@@ -0,0 +1,41 @@
1
+ import React from 'react';
2
+ import { Text, TextProps } from 'react-native';
3
+ import { useAppTextStyle } from './AppTextStyle';
4
+ import { ThemeColors } from '../../interface/colors.interface';
5
+
6
+ interface props extends TextProps {
7
+ size?: number;
8
+ fontFamily?: any;
9
+ required?: boolean;
10
+ color?: keyof ThemeColors;
11
+ type?: 'error' | 'normal';
12
+ }
13
+
14
+ const AppText = ({
15
+ size,
16
+ style,
17
+ color,
18
+ children,
19
+ type = 'normal',
20
+ fontFamily = 'regular',
21
+ required,
22
+ ...props
23
+ }: props) => {
24
+ const family = fontFamily;
25
+ const styles = useAppTextStyle({
26
+ style: {
27
+ fontFamily: family,
28
+ },
29
+ size,
30
+ color,
31
+ type,
32
+ });
33
+ return (
34
+ <Text allowFontScaling={false} style={[styles.container, style]} {...props}>
35
+ {children}
36
+ {required && <Text style={styles.require}>*</Text>}
37
+ </Text>
38
+ );
39
+ };
40
+
41
+ export default AppText;
@@ -0,0 +1,40 @@
1
+ import { useMemo } from 'react';
2
+ import { LIGHT_COLORS } from '../../style';
3
+ import { StyleSheet, TextStyle } from 'react-native';
4
+ import { ThemeColors } from '../../interface/colors.interface';
5
+
6
+ interface props {
7
+ size?: number;
8
+ style?: TextStyle;
9
+ color?: keyof ThemeColors;
10
+ type?: 'error' | 'normal';
11
+ }
12
+
13
+ export const useAppTextStyle = ({
14
+ size,
15
+ style,
16
+ color,
17
+ type = 'normal',
18
+ }: props) => {
19
+ const { ...colors } = LIGHT_COLORS;
20
+
21
+ const styles = useMemo(() => {
22
+ return StyleSheet.create({
23
+ container: {
24
+ fontSize: size || 14,
25
+ color:
26
+ type === 'error'
27
+ ? colors.error
28
+ : color
29
+ ? colors[color]
30
+ : colors.primary,
31
+ ...style,
32
+ },
33
+ require: {
34
+ color: colors.error,
35
+ },
36
+ });
37
+ }, [size, colors, style, type, color]);
38
+
39
+ return styles;
40
+ };
@@ -0,0 +1,148 @@
1
+ import {
2
+ View,
3
+ TextInput,
4
+ StyleProp,
5
+ TextStyle,
6
+ ViewStyle,
7
+ TextInputProps,
8
+ } from 'react-native';
9
+ import AppText from '../text/AppText';
10
+ import SvgButton from '../svgButton/SvgButton';
11
+ import React, { useCallback, useState } from 'react';
12
+ import { useAppTextInputStyle } from './AppTextInputStyle';
13
+
14
+ export interface AppTextProps extends TextInputProps {
15
+ label?: string;
16
+ inputRef?: any;
17
+ required?: boolean;
18
+ icon?: React.JSX.Element;
19
+ error?: string | undefined;
20
+ leftIcon?: React.JSX.Element;
21
+ style?: StyleProp<ViewStyle>;
22
+ textStyle?: StyleProp<TextStyle>;
23
+ labelStyle?: StyleProp<TextStyle>;
24
+ leftIconStyle?: StyleProp<ViewStyle>;
25
+ rightIconStyle?: StyleProp<ViewStyle>;
26
+ onIconPress?: () => Promise<void> | undefined | void;
27
+ type?: 'password' | 'number' | 'email' | 'phone' | 'text';
28
+ autoCapitalize?: 'characters' | 'words' | 'sentences' | 'none';
29
+ }
30
+
31
+ const AppTextInput = ({
32
+ icon,
33
+ type,
34
+ error,
35
+ label,
36
+ style,
37
+ value,
38
+ onBlur,
39
+ onFocus,
40
+ required,
41
+ leftIcon,
42
+ inputRef,
43
+ textStyle,
44
+ onPressIn,
45
+ labelStyle,
46
+ placeholder,
47
+ onIconPress,
48
+ autoCorrect,
49
+ onChangeText,
50
+ leftIconStyle,
51
+ rightIconStyle,
52
+ textContentType,
53
+ placeholderTextColor,
54
+ ...rest
55
+ }: AppTextProps) => {
56
+ const { styles, colors } = useAppTextInputStyle({
57
+ type,
58
+ leftIcon,
59
+ editable: rest?.editable,
60
+ });
61
+ const [secureTextEntry, setSecureTextEntry] = useState<boolean>(
62
+ type === 'password',
63
+ );
64
+
65
+ const handlePasswordIcon = () => {
66
+ setSecureTextEntry(prev => !prev);
67
+ };
68
+
69
+ const getKeyboardType = () => {
70
+ switch (type) {
71
+ case 'email':
72
+ return 'email-address';
73
+ case 'number':
74
+ return 'numeric';
75
+ case 'phone':
76
+ return 'phone-pad';
77
+ default:
78
+ return 'default';
79
+ }
80
+ };
81
+
82
+ const renderIcon = useCallback(
83
+ (
84
+ rightIcon?: React.JSX.Element,
85
+ onPress?: () => void,
86
+ ) => (
87
+ <SvgButton
88
+ icon={rightIcon}
89
+ onPress={onPress}
90
+ style={[styles.rightIcon, rightIconStyle]}
91
+ />
92
+ ),
93
+ [styles, rightIconStyle],
94
+ );
95
+
96
+ return (
97
+ <>
98
+ {label ? (
99
+ <AppText style={[styles.label, labelStyle]}>
100
+ {label}
101
+ {required ? (
102
+ <AppText style={[styles.label, styles.required]}>*</AppText>
103
+ ) : null}
104
+ </AppText>
105
+ ) : null}
106
+ <View style={styles.margin}>
107
+ <View
108
+ style={[styles.container, style, error ? styles.errorWrapper : {}]}
109
+ >
110
+ {leftIcon ? (
111
+ <SvgButton
112
+ icon={leftIcon}
113
+ style={[styles.leftIcon, leftIconStyle]}
114
+ />
115
+ ) : null}
116
+ <TextInput
117
+ value={value}
118
+ ref={inputRef}
119
+ onBlur={onBlur}
120
+ onPressIn={onPressIn}
121
+ allowFontScaling={false}
122
+ placeholder={placeholder}
123
+ autoCorrect={autoCorrect}
124
+ onChangeText={onChangeText}
125
+ keyboardType={getKeyboardType()}
126
+ textContentType={textContentType}
127
+ secureTextEntry={secureTextEntry}
128
+ style={[styles.textInputStyles, textStyle]}
129
+ placeholderTextColor={placeholderTextColor || colors.gray}
130
+ onFocus={e => {
131
+ if (onFocus) {
132
+ onFocus(e);
133
+ }
134
+ }}
135
+ {...rest}
136
+ />
137
+ {type === 'password'
138
+ ? renderIcon(icon, handlePasswordIcon)
139
+ : null}
140
+ {icon && type !== 'password' ? renderIcon(icon, onIconPress) : null}
141
+ </View>
142
+ {error && <AppText style={styles.error}>{error}</AppText>}
143
+ </View>
144
+ </>
145
+ );
146
+ };
147
+
148
+ export default AppTextInput;
@@ -0,0 +1,72 @@
1
+
2
+ import { ReactNode, useMemo } from 'react';
3
+ import { PressableStateCallbackType, StyleSheet } from 'react-native';
4
+ import { DEFAULT_COLORS, LIGHT_COLORS, SHADOW, SPACING } from '../../style';
5
+
6
+ interface props {
7
+ type?: any;
8
+ editable?: boolean;
9
+ leftIcon?: ReactNode | ((state: PressableStateCallbackType) => ReactNode);
10
+ rightIcon?: ReactNode | ((state: PressableStateCallbackType) => ReactNode);
11
+ }
12
+
13
+ export const useAppTextInputStyle = ({
14
+ type,
15
+ leftIcon,
16
+ editable = true,
17
+ }: props) => {
18
+ const { ...colors } = LIGHT_COLORS;
19
+
20
+ const styles = useMemo(() => {
21
+ return StyleSheet.create({
22
+ container: {
23
+ width: '100%',
24
+ ...SHADOW.shadow1,
25
+ flexDirection: 'row',
26
+ alignItems: 'center',
27
+ opacity: !editable ? 0.5 : 1,
28
+ backgroundColor: DEFAULT_COLORS.white,
29
+ },
30
+ margin: {
31
+ marginBottom: SPACING.s10,
32
+ },
33
+ rightIcon: {
34
+ position: 'absolute',
35
+ right: SPACING.s20,
36
+ },
37
+ error: {
38
+ textAlign: 'left',
39
+ paddingTop: SPACING.s4,
40
+ alignSelf: 'flex-start',
41
+ color: colors.red,
42
+ },
43
+ label: {
44
+ color: colors.primary,
45
+ marginBottom: SPACING.s12,
46
+ alignSelf: 'flex-start',
47
+ marginTop: SPACING.s10,
48
+ },
49
+ required: {
50
+ color: colors.red,
51
+ },
52
+ errorWrapper: {
53
+ borderWidth: 0.8,
54
+ borderColor: colors.red,
55
+ },
56
+ textInputStyles: {
57
+ padding: 0,
58
+ height: 48,
59
+ width: '100%',
60
+ color: colors.primary,
61
+ paddingLeft: leftIcon ? SPACING.s45 : 16,
62
+ paddingRight: type === 'password' ? 50 : 16,
63
+ },
64
+ leftIcon: {
65
+ position: 'absolute',
66
+ left: SPACING.s14,
67
+ },
68
+ });
69
+ }, [editable, colors, leftIcon, type]);
70
+
71
+ return { styles, colors };
72
+ };
@@ -0,0 +1,81 @@
1
+ import React from 'react';
2
+ import { View } from 'react-native';
3
+ import AppText from '../../components/text/AppText';
4
+ import {
5
+ DropdownProps,
6
+ SelectionType,
7
+ } from '../../components/dropdown/interface/DropdownInterface';
8
+ import DropdownComponent from '../../components/dropdown/Dropdown';
9
+ import { useDropdownControllerStyle } from './DropdownControllerStyle';
10
+ import { Control, Controller, FieldValues, Path } from 'react-hook-form';
11
+
12
+ type DropControllerProps<S, T extends SelectionType, U extends FieldValues> = {
13
+ control: Control<U>;
14
+ controller: Path<U>;
15
+ dropProps: DropdownProps<S, T>;
16
+ };
17
+
18
+ const AppDropdownController = <
19
+ S,
20
+ T extends SelectionType,
21
+ U extends FieldValues,
22
+ >(
23
+ props: DropControllerProps<S, T, U>,
24
+ ) => {
25
+ const {
26
+ control,
27
+ controller,
28
+ dropProps: {
29
+ data,
30
+ label,
31
+ labelField,
32
+ valueField,
33
+ placeholder,
34
+ selectionType,
35
+ containerStyle,
36
+ ...rest
37
+ },
38
+ } = props;
39
+
40
+ const { styles } = useDropdownControllerStyle();
41
+
42
+ return (
43
+ <Controller
44
+ control={control}
45
+ name={controller}
46
+ render={({
47
+ fieldState: { error },
48
+ field: { onBlur, onChange, value },
49
+ }) => (
50
+ <View style={styles.mainContainer}>
51
+ <DropdownComponent
52
+ data={data}
53
+ value={value}
54
+ label={label}
55
+ onBlur={onBlur}
56
+ onChange={(selectValue: any, selectedItem: any) => {
57
+ if (selectionType === 'single') {
58
+ return onChange(selectValue);
59
+ }
60
+ return onChange(selectedItem);
61
+ }}
62
+ labelField={labelField}
63
+ valueField={valueField}
64
+ placeholder={placeholder}
65
+ selectionType={selectionType}
66
+ containerStyle={containerStyle}
67
+ labelTextStyle={styles.labelText}
68
+ itemTextStyle={styles.dropdownText}
69
+ placeholderStyle={styles.itemContainer}
70
+ selectedTextStyle={styles.selectionText}
71
+ style={[styles.dropdownContainer, error && styles.errorWrapper]}
72
+ {...rest}
73
+ />
74
+ {error && <AppText style={styles.error}>{error?.message}</AppText>}
75
+ </View>
76
+ )}
77
+ />
78
+ );
79
+ };
80
+
81
+ export default AppDropdownController;
@@ -0,0 +1,47 @@
1
+ import { useMemo } from 'react';
2
+ import { StyleSheet } from 'react-native';
3
+ import { LIGHT_COLORS, SPACING } from '../../style';
4
+
5
+ export const useDropdownControllerStyle = () => {
6
+ const { ...colors } = LIGHT_COLORS;
7
+
8
+ const styles = useMemo(() => {
9
+ return StyleSheet.create({
10
+ mainContainer: {
11
+ width: '100%',
12
+ marginBottom: SPACING?.s4,
13
+ },
14
+ dropdownContainer: {
15
+ borderWidth: 1,
16
+ borderRadius: 6,
17
+ marginBottom: SPACING.s10,
18
+ borderColor: colors.border,
19
+ paddingHorizontal: SPACING.s10,
20
+ },
21
+ labelText: {
22
+ color: colors.gray,
23
+ },
24
+ errorWrapper: {
25
+ borderWidth: 0.8,
26
+ borderColor: colors.red,
27
+ },
28
+ dropdownText: {
29
+ fontSize: 14,
30
+ color: colors.gray,
31
+ },
32
+ itemContainer: {
33
+ fontSize: 14,
34
+ color: colors.gray,
35
+ },
36
+ selectionText: {
37
+ fontSize: 14,
38
+ color: colors.gray,
39
+ },
40
+ error: {
41
+ color: colors.red,
42
+ },
43
+ });
44
+ }, [colors]);
45
+
46
+ return { styles, colors };
47
+ };
@@ -0,0 +1,50 @@
1
+ import React from 'react';
2
+ import AppTextInput, {
3
+ AppTextProps,
4
+ } from '../../components/textInput/AppTextInput';
5
+ import { useInputController } from './InputControllerStyle';
6
+ import { StyleProp, TextStyle, ViewStyle } from 'react-native';
7
+ import { Controller, Control, FieldValues, Path } from 'react-hook-form';
8
+
9
+ interface Props<T extends FieldValues> extends AppTextProps {
10
+ textStyle?: TextStyle;
11
+ controllerName: Path<T>;
12
+ containerStyle?: ViewStyle;
13
+ control: Control<T> | undefined;
14
+ labelStyle?: StyleProp<TextStyle>;
15
+ }
16
+
17
+ const AppTextControlInput = <T extends FieldValues>({
18
+ control,
19
+ textStyle,
20
+ labelStyle,
21
+ controllerName,
22
+ containerStyle,
23
+ ...rest
24
+ }: Props<T>) => {
25
+ const { styles } = useInputController();
26
+
27
+ return (
28
+ <Controller
29
+ control={control}
30
+ name={controllerName}
31
+ render={({
32
+ fieldState: { error },
33
+ field: { onChange, value, onBlur },
34
+ }) => (
35
+ <AppTextInput
36
+ value={value}
37
+ onBlur={onBlur}
38
+ error={error?.message}
39
+ onChangeText={onChange}
40
+ textStyle={[styles.inputText, textStyle]}
41
+ labelStyle={[styles.labelText, labelStyle]}
42
+ style={[styles.inputControlContainer, containerStyle]}
43
+ {...rest}
44
+ />
45
+ )}
46
+ />
47
+ );
48
+ };
49
+
50
+ export default AppTextControlInput;
@@ -0,0 +1,28 @@
1
+ import { useMemo } from 'react';
2
+ import { StyleSheet } from 'react-native';
3
+ import { LIGHT_COLORS, SPACING } from '../../style';
4
+
5
+ export const useInputController = () => {
6
+ const { ...colors } = LIGHT_COLORS;
7
+
8
+ const styles = useMemo(() => {
9
+ return StyleSheet.create({
10
+ labelText: {
11
+ color: colors.gray,
12
+ },
13
+ inputControlContainer: {
14
+ height: 48,
15
+ borderWidth: 1,
16
+ borderRadius: 6,
17
+ alignItems: 'center',
18
+ marginVertical: SPACING.s2,
19
+ borderColor: colors.border,
20
+ },
21
+ inputText: {
22
+ color: colors.black,
23
+ },
24
+ });
25
+ }, [colors]);
26
+
27
+ return { styles, colors };
28
+ };
package/src/index.ts ADDED
@@ -0,0 +1,5 @@
1
+ export { default as AppText } from './components/text/AppText';
2
+ export { default as Dropdown } from './components/dropdown/Dropdown';
3
+ export { default as TextInput } from './components/textInput/AppTextInput';
4
+ export { default as DropdownController }from './controller/dropDownController/DropdownController';
5
+ export { default as TextInputController } from './controller/textInputController/AppTextInputController';
@@ -0,0 +1,22 @@
1
+ export type ThemeColors = {
2
+ red: string;
3
+ blue: string;
4
+ gray: string;
5
+ white: string;
6
+ error: string;
7
+ black: string;
8
+ green: string;
9
+ border: string;
10
+ primary: string;
11
+ lightGray: string;
12
+ grayishBlue: string;
13
+ };
14
+
15
+ export type Theme = {
16
+ mode: string;
17
+ colors: ThemeColors;
18
+ };
19
+
20
+ export interface ThemeInterface {
21
+ [index: string]: Theme;
22
+ }
@@ -0,0 +1,46 @@
1
+ import { ThemeInterface } from "../interface/colors.interface";
2
+
3
+ export const LIGHT_COLORS = {
4
+ blue: '#0000ff',
5
+ gray: '#5c5b5b',
6
+ error: '#dc3545',
7
+ green: '#2EB85C',
8
+ white: '#FFFFFF',
9
+ black: '#000000',
10
+ primary: '#3683BC',
11
+ lightGray: '#e0e0e0',
12
+ grayishBlue: '#C5C6C7',
13
+ red: 'rgba(205, 46, 49, 1)',
14
+ border: 'rgba(224, 224, 224, 1)',
15
+ };
16
+
17
+ export const DARK_COLORS = {
18
+ blue: '#0000ff',
19
+ gray: '#5c5b5b',
20
+ error: '#dc3545',
21
+ green: '#2EB85C',
22
+ white: '#FFFFFF',
23
+ black: '#000000',
24
+ primary: '#3683BC',
25
+ lightGray: '#e0e0e0',
26
+ grayishBlue: '#C5C6C7',
27
+ red: 'rgba(205, 46, 49, 1)',
28
+ border: 'rgba(224, 224, 224, 1)',
29
+ };
30
+
31
+ export const THEMES: ThemeInterface = {
32
+ light: {
33
+ mode: 'light',
34
+ colors: LIGHT_COLORS,
35
+ },
36
+ dark: {
37
+ mode: 'dark',
38
+ colors: DARK_COLORS,
39
+ },
40
+ };
41
+
42
+ export const DEFAULT_COLORS = {
43
+ blue: '#3683BC',
44
+ white: '#FFFFFF',
45
+ blackOpacity: 'rgba(0, 0, 0, 0.5)',
46
+ };
@@ -0,0 +1,14 @@
1
+ export * from './colors';
2
+ export * from './spacing';
3
+ export * from './shadow';
4
+ import { Dimensions, Platform } from 'react-native';
5
+
6
+ export const addAlphaToHex = (color: string, opacity: number) => {
7
+ const _opacity = Math.round(Math.min(Math.max(opacity || 1, 0), 1) * 255);
8
+ return color + _opacity.toString(16).toUpperCase();
9
+ };
10
+
11
+ export const SCREEN_WIDTH = Dimensions.get('window').width;
12
+ export const SCREEN_HEIGHT = Dimensions.get('window').height;
13
+ export const MIN_DEVICE_WIDTH = Platform.OS === 'ios' ? 390 : 360;
14
+