@rn-components-dropdown/dropdown 1.0.12 → 1.0.14

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 (36) hide show
  1. package/README.md +6 -7
  2. package/dist/components/dropdown/Dropdown.js +14 -8
  3. package/dist/components/dropdown/DropdownStyle.d.ts +4 -3
  4. package/dist/components/dropdown/DropdownStyle.js +5 -3
  5. package/dist/components/dropdown/component/chip/Chip.d.ts +3 -0
  6. package/dist/components/dropdown/component/chip/Chip.js +23 -0
  7. package/dist/components/dropdown/component/chip/ChipStyle.d.ts +83 -0
  8. package/dist/components/dropdown/component/chip/ChipStyle.js +62 -0
  9. package/dist/components/dropdown/component/input/TextInput.d.ts +3 -0
  10. package/dist/components/dropdown/component/input/TextInput.js +61 -0
  11. package/dist/components/dropdown/component/input/TextInputStyle.d.ts +32 -0
  12. package/dist/components/dropdown/component/input/TextInputStyle.js +33 -0
  13. package/dist/components/dropdown/hooks/useDropdown.js +4 -5
  14. package/dist/components/dropdown/interface/ChipInterface.d.ts +3 -3
  15. package/dist/components/dropdown/interface/DropdownInterface.d.ts +4 -5
  16. package/dist/components/text/AppText.d.ts +2 -3
  17. package/dist/components/text/AppText.js +1 -1
  18. package/dist/components/text/AppTextStyle.d.ts +18 -19
  19. package/dist/components/text/AppTextStyle.js +1 -5
  20. package/dist/interface/svg.interface.d.ts +2 -1
  21. package/dist/style/index.d.ts +0 -2
  22. package/dist/style/index.js +1 -7
  23. package/package.json +1 -1
  24. package/src/components/dropdown/Dropdown.tsx +17 -9
  25. package/src/components/dropdown/DropdownStyle.ts +12 -6
  26. package/src/components/dropdown/{components → component}/chip/Chip.tsx +1 -1
  27. package/src/components/dropdown/{components → component}/chip/ChipStyle.ts +3 -3
  28. package/src/components/dropdown/hooks/useDropdown.ts +6 -5
  29. package/src/components/dropdown/interface/ChipInterface.ts +4 -3
  30. package/src/components/dropdown/interface/DropdownInterface.ts +4 -5
  31. package/src/components/text/AppText.tsx +2 -3
  32. package/src/components/text/AppTextStyle.ts +3 -9
  33. package/src/interface/svg.interface.ts +3 -1
  34. package/src/style/index.ts +0 -7
  35. /package/src/components/dropdown/{components → component}/input/TextInput.tsx +0 -0
  36. /package/src/components/dropdown/{components → component}/input/TextInputStyle.ts +0 -0
package/README.md CHANGED
@@ -9,13 +9,13 @@ Supports **single** & **multiple selection**, custom icons, styling, and easy in
9
9
 
10
10
  ### Install Package
11
11
 
12
- ```bash
12
+ ```bash title="install.sh" copy
13
13
  npm install @rn-components-dropdown/dropdown
14
14
  ```
15
15
 
16
16
  ### React Hook Form (optional — required only for DropdownController)
17
17
 
18
- ```bash
18
+ ```bash title="install.sh" copy
19
19
  npm install react-hook-form
20
20
  ```
21
21
 
@@ -102,8 +102,7 @@ export default function FormScreen() {
102
102
  return (
103
103
  <DropdownController
104
104
  control={control}
105
- name="fruit"
106
- rules={{ required: "Please select a fruit" }}
105
+ controller="fruit"
107
106
  dropProps={{
108
107
  data: [
109
108
  { id: 1, label: "Apple" },
@@ -125,10 +124,10 @@ export default function FormScreen() {
125
124
  | Prop | Type | Description |
126
125
  |---------------|-------------|-----------------------------------------------|
127
126
  | control | Control | React Hook Form control object |
128
- | name | string | Field name in the form |
127
+ | controller | string | Field name in the form |
129
128
  | rules | object | Validation rules (optional) |
130
- | dropProps | object | All dropdown props |
131
- | defaultValue | any | Initial/default value |
129
+ | dropProps | object | All dropdown props |
130
+ | defaultValue | any | Initial/default value |
132
131
 
133
132
  ---
134
133
 
@@ -40,18 +40,21 @@ Object.defineProperty(exports, "__esModule", { value: true });
40
40
  const react_native_1 = require("react-native");
41
41
  const lodash_1 = __importDefault(require("lodash"));
42
42
  const AppText_1 = __importDefault(require("../text/AppText"));
43
- const Chip_1 = __importDefault(require("./components/chip/Chip"));
43
+ const Chip_1 = __importDefault(require("./component/chip/Chip"));
44
44
  const react_1 = __importStar(require("react"));
45
45
  const useDropdown_1 = __importDefault(require("./hooks/useDropdown"));
46
46
  const SvgButton_1 = __importDefault(require("../svgButton/SvgButton"));
47
47
  const DropdownStyle_1 = require("./DropdownStyle");
48
48
  const CheckIcon_1 = __importDefault(require("../../assets/svg/CheckIcon"));
49
49
  const svg_1 = require("../../assets/svg");
50
- const TextInput_1 = __importDefault(require("./components/input/TextInput"));
50
+ const TextInput_1 = __importDefault(require("./component/input/TextInput"));
51
51
  const DropdownComponent = (props) => {
52
- const { label, testID, iconStyle, renderItem, style = {}, subfixIcon, labelField, valueField, onChangeText, itemTextStyle, flatListProps, minHeight = 0, containerStyle, search = false, renderLeftIcon, multiSelectIcon, itemTestIDField, maxHeight = 300, inverted = true, renderRightIcon, backgroundColor, placeholderStyle, inputSearchStyle, searchPlaceholder, selectedTextStyle, renderInputSearch, iconColor = 'gray', accessibilityLabel, itemContainerStyle, labelContainer = {}, labelTextStyle = {}, selectedTextProps = {}, chipContainerProps = {}, selectionType = 'single', activeColor = 'lightGray', keyboardAvoiding = true, dropdownPosition = 'auto', placeholder = 'Select item', itemAccessibilityLabelField, showsVerticalScrollIndicator = true, } = props;
52
+ const { label, testID, iconStyle, renderItem, style = {}, subfixIcon, labelField, valueField, onChangeText, itemTextStyle, flatListProps, minHeight = 0, containerStyle, search = false, renderLeftIcon, checkIconColor, radioIconColor, multiSelectIcon, itemTestIDField, maxHeight = 300, inverted = true, renderRightIcon, backgroundColor, placeholderStyle, inputSearchStyle, searchPlaceholder, selectedTextStyle, renderInputSearch, iconColor = 'gray', accessibilityLabel, itemContainerStyle, labelContainer = {}, labelTextStyle = {}, selectedTextProps = {}, chipContainerProps = {}, keyboardAvoiding = true, selectionType = 'single', activeColor = 'lightGray', dropdownPosition = 'auto', itemAccessibilityLabelField, placeholder = 'Please select', showsVerticalScrollIndicator = true, } = props;
53
53
  const { chipColor, clearIcon, textColor, onClearPress: onClear, } = chipContainerProps;
54
- const { styles, colors } = (0, DropdownStyle_1.useDropdownStyle)({});
54
+ const { styles, colors } = (0, DropdownStyle_1.useDropdownStyle)({
55
+ checkIconColor: checkIconColor,
56
+ radioIconColor: radioIconColor,
57
+ });
55
58
  const { ref, font, visible, refList, position, onSelect, listData, onSearch, onMeasure, searchText, showOrClose, scrollIndex, currentValue, onCheckPress, onClearPress, setSearchText, keyboardHeight, } = (0, useDropdown_1.default)({ ...props });
56
59
  const renderRight = () => {
57
60
  return renderRightIcon ? (renderRightIcon(visible)) : (<SvgButton_1.default icon={subfixIcon ? (subfixIcon) : visible ? (<svg_1.ArrowUp color={iconColor}/>) : (<svg_1.ArrowDown color={iconColor}/>)} onPress={showOrClose} style={react_native_1.StyleSheet.flatten([
@@ -96,13 +99,17 @@ const DropdownComponent = (props) => {
96
99
  }, [styles]);
97
100
  const renderCheckItem = (0, react_1.useCallback)(({ item, index }) => {
98
101
  const isSelected = lodash_1.default.some(currentValue, (h) => lodash_1.default.isEqual(lodash_1.default.get(h, valueField), lodash_1.default.get(item, valueField)));
99
- return (<react_native_1.TouchableHighlight key={index.toString()} testID={lodash_1.default.get(item, itemTestIDField || labelField)} accessible={!!accessibilityLabel} accessibilityLabel={lodash_1.default.get(item, itemAccessibilityLabelField || labelField)} underlayColor={colors[activeColor]} onPress={() => onCheckPress(item)}>
102
+ return (<react_native_1.TouchableHighlight key={index.toString()} testID={lodash_1.default.get(item, itemTestIDField || labelField)} accessible={!!accessibilityLabel} accessibilityLabel={lodash_1.default.get(item, itemAccessibilityLabelField || labelField)} underlayColor={activeColor} onPress={() => onCheckPress(item)}>
100
103
  <react_native_1.View style={react_native_1.StyleSheet.flatten([itemContainerStyle])}>
101
104
  {renderItem ? (renderItem(item, isSelected, labelField, valueField)) : (<react_native_1.View style={styles.item}>
102
105
  <SvgButton_1.default icon={multiSelectIcon ? (multiSelectIcon) : (<CheckIcon_1.default color={colors.white}/>)} onPress={() => onCheckPress(item)} style={[
103
106
  styles.checkContainer,
104
107
  {
105
- backgroundColor: isSelected ? colors.gray : colors.white,
108
+ backgroundColor: isSelected
109
+ ? checkIconColor
110
+ ? checkIconColor
111
+ : colors.gray
112
+ : colors.white,
106
113
  },
107
114
  ]}/>
108
115
  <AppText_1.default style={react_native_1.StyleSheet.flatten([
@@ -134,7 +141,7 @@ const DropdownComponent = (props) => {
134
141
  const isSelected = currentValue && lodash_1.default.get(currentValue, valueField);
135
142
  const selected = lodash_1.default.isEqual(lodash_1.default.get(item, valueField), isSelected);
136
143
  lodash_1.default.assign(item, { _index: index });
137
- return (<react_native_1.TouchableHighlight key={index.toString()} testID={lodash_1.default.get(item, itemTestIDField || labelField)} accessible={!!accessibilityLabel} accessibilityLabel={lodash_1.default.get(item, itemAccessibilityLabelField || labelField)} underlayColor={colors[activeColor]} onPress={() => onSelect(item)}>
144
+ return (<react_native_1.TouchableHighlight key={index.toString()} testID={lodash_1.default.get(item, itemTestIDField || labelField)} accessible={!!accessibilityLabel} accessibilityLabel={lodash_1.default.get(item, itemAccessibilityLabelField || labelField)} underlayColor={activeColor} onPress={() => onSelect(item)}>
138
145
  <react_native_1.View style={react_native_1.StyleSheet.flatten([itemContainerStyle])}>
139
146
  {renderItem ? (renderItem(item, selected, labelField, valueField)) : (<react_native_1.View style={styles.item}>
140
147
  {renderRadio(selected)}
@@ -255,7 +262,6 @@ const DropdownComponent = (props) => {
255
262
  <react_native_1.View style={react_native_1.StyleSheet.flatten([
256
263
  styles.flex1,
257
264
  isFull && styles.styleContainerVertical,
258
- backgroundColor && { backgroundColor: backgroundColor },
259
265
  keyboardStyle,
260
266
  ])}>
261
267
  <react_native_1.View style={react_native_1.StyleSheet.flatten([
@@ -1,8 +1,7 @@
1
- import { ThemeColors } from '../../interface/colors.interface';
2
1
  interface Props {
3
2
  size?: number;
4
- radioIconColor?: keyof ThemeColors;
5
- checkIconColor?: keyof ThemeColors;
3
+ radioIconColor?: string;
4
+ checkIconColor?: string;
6
5
  }
7
6
  export declare const useDropdownStyle: (props: Props) => {
8
7
  styles: {
@@ -48,6 +47,7 @@ export declare const useDropdownStyle: (props: Props) => {
48
47
  };
49
48
  title: {
50
49
  fontSize: number;
50
+ color: string;
51
51
  marginVertical: number;
52
52
  writingDirection: "ltr" | "rtl";
53
53
  };
@@ -62,6 +62,7 @@ export declare const useDropdownStyle: (props: Props) => {
62
62
  textItem: {
63
63
  flex: number;
64
64
  fontSize: number;
65
+ color: string;
65
66
  writingDirection: "ltr" | "rtl";
66
67
  };
67
68
  icon: {
@@ -1,13 +1,13 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.useDropdownStyle = void 0;
4
+ const style_1 = require("../../style");
4
5
  const react_1 = require("react");
5
6
  const react_native_1 = require("react-native");
6
7
  const useOrientation_1 = require("./hooks/useOrientation");
7
- const style_1 = require("../../style");
8
8
  const useDropdownStyle = (props) => {
9
- const orientation = (0, useOrientation_1.useDeviceOrientation)();
10
9
  const { ...colors } = style_1.LIGHT_COLORS;
10
+ const orientation = (0, useOrientation_1.useDeviceOrientation)();
11
11
  const { size = 16, radioIconColor, checkIconColor } = props;
12
12
  const styles = (0, react_1.useMemo)(() => {
13
13
  return react_native_1.StyleSheet.create({
@@ -53,6 +53,7 @@ const useDropdownStyle = (props) => {
53
53
  },
54
54
  title: {
55
55
  fontSize: 16,
56
+ color: colors.gray,
56
57
  marginVertical: style_1.SPACING.s6,
57
58
  writingDirection: react_native_1.I18nManager.isRTL ? 'rtl' : 'ltr',
58
59
  },
@@ -67,6 +68,7 @@ const useDropdownStyle = (props) => {
67
68
  textItem: {
68
69
  flex: 1,
69
70
  fontSize: 16,
71
+ color: colors.gray,
70
72
  writingDirection: react_native_1.I18nManager.isRTL ? 'rtl' : 'ltr',
71
73
  },
72
74
  icon: {
@@ -90,7 +92,7 @@ const useDropdownStyle = (props) => {
90
92
  paddingVertical: style_1.SPACING.s6,
91
93
  },
92
94
  labelTextStyle: {
93
- color: colors.black,
95
+ color: colors.gray,
94
96
  },
95
97
  itemIconContainer: {
96
98
  borderWidth: 2,
@@ -0,0 +1,3 @@
1
+ import { ChipInterface } from '../../interface/ChipInterface';
2
+ declare const Chip: (props: ChipInterface) => import("react").JSX.Element;
3
+ export default Chip;
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const react_native_1 = require("react-native");
7
+ const ChipStyle_1 = __importDefault(require("./ChipStyle"));
8
+ const AppText_1 = __importDefault(require("../../../text/AppText"));
9
+ const svg_1 = require("../../../../assets/svg");
10
+ const SvgButton_1 = __importDefault(require("../../../svgButton/SvgButton"));
11
+ const Chip = (props) => {
12
+ const { styles, colors } = (0, ChipStyle_1.default)({ ...props });
13
+ const { label, onClearPress, textColor, clearIcon } = props;
14
+ return (<react_native_1.View style={styles.box}>
15
+ <AppText_1.default size={12} fontFamily={'semiBold'} style={styles.chipText} color={textColor ? textColor : 'gray'}>
16
+ {label}
17
+ </AppText_1.default>
18
+ {clearIcon ? (clearIcon) : (<react_native_1.View style={styles.clearContainer}>
19
+ <SvgButton_1.default icon={<svg_1.ClearIcon size={8} color={textColor ? textColor : colors.white}/>} onPress={onClearPress} style={styles.clearIcon}/>
20
+ </react_native_1.View>)}
21
+ </react_native_1.View>);
22
+ };
23
+ exports.default = Chip;
@@ -0,0 +1,83 @@
1
+ import { ChipInterface } from '../../interface/ChipInterface';
2
+ declare const useChipStyle: (props: ChipInterface) => {
3
+ styles: {
4
+ box: {
5
+ elevation: number;
6
+ width: "auto";
7
+ borderRadius: number;
8
+ flexDirection: "row";
9
+ alignItems: "center";
10
+ justifyContent: "center";
11
+ backgroundColor: import("react-native").ColorValue;
12
+ margin: number;
13
+ height: number;
14
+ } | {
15
+ elevation: number;
16
+ width: "auto";
17
+ borderRadius: number;
18
+ flexDirection: "row";
19
+ alignItems: "center";
20
+ justifyContent: "center";
21
+ backgroundColor: import("react-native").ColorValue;
22
+ shadowRadius?: undefined;
23
+ shadowOpacity?: undefined;
24
+ shadowColor?: undefined;
25
+ shadowOffset?: undefined;
26
+ margin: number;
27
+ height: number;
28
+ } | {
29
+ elevation: number;
30
+ width: "auto";
31
+ borderRadius: number;
32
+ flexDirection: "row";
33
+ alignItems: "center";
34
+ justifyContent: "center";
35
+ backgroundColor: import("react-native").ColorValue;
36
+ shadowRadius: number;
37
+ shadowOpacity: number;
38
+ shadowColor: string;
39
+ shadowOffset: {
40
+ width: number;
41
+ height: number;
42
+ };
43
+ margin: number;
44
+ height: number;
45
+ };
46
+ chipText: {
47
+ paddingLeft: number;
48
+ fontWeight: "600";
49
+ };
50
+ clearContainer: {
51
+ width: number;
52
+ height: number;
53
+ borderWidth: number;
54
+ borderRadius: number;
55
+ marginHorizontal: number;
56
+ alignItems: "center";
57
+ justifyContent: "center";
58
+ borderColor: import("react-native").ColorValue;
59
+ backgroundColor: import("react-native").ColorValue;
60
+ };
61
+ clearIcon: {
62
+ width: number;
63
+ height: number;
64
+ borderRadius: number;
65
+ alignItems: "center";
66
+ justifyContent: "center";
67
+ };
68
+ };
69
+ colors: {
70
+ blue: string;
71
+ gray: string;
72
+ error: string;
73
+ green: string;
74
+ white: string;
75
+ black: string;
76
+ primary: string;
77
+ lightGray: string;
78
+ grayishBlue: string;
79
+ red: string;
80
+ border: string;
81
+ };
82
+ };
83
+ export default useChipStyle;
@@ -0,0 +1,62 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const react_1 = require("react");
4
+ const style_1 = require("../../../../style");
5
+ const react_native_1 = require("react-native");
6
+ const useChipStyle = (props) => {
7
+ const { chipColor, textColor } = props;
8
+ const { ...colors } = style_1.LIGHT_COLORS;
9
+ const styles = (0, react_1.useMemo)(() => {
10
+ return react_native_1.StyleSheet.create({
11
+ box: {
12
+ margin: 4,
13
+ height: 26,
14
+ ...react_native_1.Platform.select({
15
+ android: {
16
+ elevation: 5,
17
+ },
18
+ ios: {
19
+ shadowRadius: 1.84,
20
+ shadowOpacity: 0.35,
21
+ shadowColor: colors.black,
22
+ shadowOffset: { width: 0, height: 2 },
23
+ },
24
+ }),
25
+ elevation: 5,
26
+ width: 'auto',
27
+ borderRadius: 30,
28
+ flexDirection: 'row',
29
+ alignItems: 'center',
30
+ justifyContent: 'center',
31
+ backgroundColor: chipColor ? chipColor : colors.lightGray,
32
+ },
33
+ chipText: {
34
+ paddingLeft: 10,
35
+ fontWeight: '600',
36
+ },
37
+ clearContainer: {
38
+ width: 18,
39
+ height: 18,
40
+ borderWidth: 2,
41
+ borderRadius: 100,
42
+ marginHorizontal: 4,
43
+ alignItems: 'center',
44
+ justifyContent: 'center',
45
+ borderColor: textColor ? textColor : colors.white,
46
+ backgroundColor: chipColor ? chipColor : colors.lightGray,
47
+ },
48
+ clearIcon: {
49
+ width: 12,
50
+ height: 12,
51
+ borderRadius: 100,
52
+ alignItems: 'center',
53
+ justifyContent: 'center',
54
+ },
55
+ });
56
+ }, [chipColor, colors, textColor]);
57
+ return {
58
+ styles,
59
+ colors,
60
+ };
61
+ };
62
+ exports.default = useChipStyle;
@@ -0,0 +1,3 @@
1
+ import type { CTextInput } from '../../interface/InputProps';
2
+ declare const TextInputComponent: CTextInput;
3
+ export default TextInputComponent;
@@ -0,0 +1,61 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ var __importDefault = (this && this.__importDefault) || function (mod) {
36
+ return (mod && mod.__esModule) ? mod : { "default": mod };
37
+ };
38
+ Object.defineProperty(exports, "__esModule", { value: true });
39
+ const TextInputStyle_1 = require("./TextInputStyle");
40
+ const react_1 = __importStar(require("react"));
41
+ const svg_1 = require("../../../../assets/svg");
42
+ const react_native_1 = require("react-native");
43
+ const AppTextInput_1 = __importDefault(require("../../../textInput/AppTextInput"));
44
+ const TextInputComponent = props => {
45
+ const { value, placeholder = '', placeholderTextColor = '#000', onChangeText = (_value) => { }, searchIcon, } = props;
46
+ const [searchtext, setSearchText] = (0, react_1.useState)('');
47
+ const { styles } = (0, TextInputStyle_1.useTextStyle)();
48
+ (0, react_1.useEffect)(() => {
49
+ if (value) {
50
+ setSearchText(value);
51
+ }
52
+ }, [value]);
53
+ const onChange = (text) => {
54
+ setSearchText(text);
55
+ onChangeText(text);
56
+ };
57
+ return (<react_native_1.TouchableWithoutFeedback>
58
+ <AppTextInput_1.default {...props} value={searchtext} style={styles.input} onChangeText={onChange} placeholder={placeholder} textStyle={styles.inputContainer} placeholderTextColor={placeholderTextColor} icon={searchIcon ? searchIcon : <svg_1.SearchIcon />}/>
59
+ </react_native_1.TouchableWithoutFeedback>);
60
+ };
61
+ exports.default = TextInputComponent;
@@ -0,0 +1,32 @@
1
+ export declare const useTextStyle: () => {
2
+ styles: {
3
+ input: {
4
+ height: number;
5
+ width: "95%";
6
+ fontSize: number;
7
+ borderWidth: number;
8
+ borderRadius: number;
9
+ marginVertical: number;
10
+ marginHorizontal: number;
11
+ borderColor: string;
12
+ };
13
+ inputContainer: {
14
+ width: "90%";
15
+ fontSize: number;
16
+ color: string;
17
+ };
18
+ };
19
+ colors: {
20
+ blue: string;
21
+ gray: string;
22
+ error: string;
23
+ green: string;
24
+ white: string;
25
+ black: string;
26
+ primary: string;
27
+ lightGray: string;
28
+ grayishBlue: string;
29
+ red: string;
30
+ border: string;
31
+ };
32
+ };
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.useTextStyle = void 0;
4
+ const react_1 = require("react");
5
+ const react_native_1 = require("react-native");
6
+ const style_1 = require("../../../../style");
7
+ const useTextStyle = () => {
8
+ const { ...colors } = style_1.LIGHT_COLORS;
9
+ const styles = (0, react_1.useMemo)(() => {
10
+ return react_native_1.StyleSheet.create({
11
+ input: {
12
+ height: 40,
13
+ width: '95%',
14
+ fontSize: 16,
15
+ borderWidth: 1,
16
+ borderRadius: 3,
17
+ marginVertical: 10,
18
+ marginHorizontal: 8,
19
+ borderColor: colors.border,
20
+ },
21
+ inputContainer: {
22
+ width: '90%',
23
+ fontSize: 14,
24
+ color: colors.gray,
25
+ },
26
+ });
27
+ }, [colors]);
28
+ return {
29
+ styles,
30
+ colors,
31
+ };
32
+ };
33
+ exports.useTextStyle = useTextStyle;
@@ -234,12 +234,11 @@ const useDropdown = (props) => {
234
234
  });
235
235
  }, [setCurrentValue, valueField, onChange, currentValue]);
236
236
  const onClearPress = (0, react_1.useCallback)((item) => {
237
- const clone = lodash_1.default.clone(currentValue);
238
- const rem = lodash_1.default.remove(clone, i => i?.[valueField] !== item[valueField]);
239
- const val = rem?.map(i => i?.[valueField]);
240
- setCurrentValue(rem);
237
+ const updated = currentValue.filter((i) => i[valueField] !== item[valueField]);
238
+ const val = currentValue.map((i) => i[valueField]);
239
+ setCurrentValue(updated);
241
240
  onChange?.(item[valueField], val);
242
- }, [onChange]);
241
+ }, [currentValue, valueField, onChange, setCurrentValue]);
243
242
  return {
244
243
  ref,
245
244
  font,
@@ -1,8 +1,8 @@
1
- import { ThemeColors } from '../../../interface/colors.interface';
1
+ import { ColorValue } from "react-native";
2
2
  export interface ChipInterface {
3
3
  label?: string;
4
4
  onClearPress?: () => void;
5
- chipColor?: keyof ThemeColors;
6
- textColor?: keyof ThemeColors;
5
+ chipColor?: ColorValue;
6
+ textColor?: ColorValue;
7
7
  clearIcon?: React.JSX.Element;
8
8
  }
@@ -1,7 +1,6 @@
1
1
  import React from 'react';
2
2
  import type { StyleProp, TextStyle, ViewStyle, TextProps, ImageStyle, FlatListProps } from 'react-native';
3
3
  import { ChipInterface } from './ChipInterface';
4
- import { ThemeColors } from '../../../interface/colors.interface';
5
4
  export type IDropdownRef = {
6
5
  open: () => void;
7
6
  close: () => void;
@@ -24,8 +23,11 @@ export type DropdownProps<S, T extends SelectionType> = {
24
23
  placeholder?: string;
25
24
  onFocus?: () => void;
26
25
  autoScroll?: boolean;
26
+ activeColor?: string;
27
27
  searchField?: keyof S;
28
28
  value?: S[] | undefined;
29
+ checkIconColor?: string;
30
+ radioIconColor?: string;
29
31
  itemTestIDField?: string;
30
32
  backgroundColor?: string;
31
33
  keyboardAvoiding?: boolean;
@@ -37,11 +39,8 @@ export type DropdownProps<S, T extends SelectionType> = {
37
39
  selectedTextProps?: TextProps;
38
40
  subfixIcon?: React.JSX.Element;
39
41
  onClear?: (id?: number) => void;
40
- activeColor?: keyof ThemeColors;
41
42
  iconStyle?: StyleProp<ImageStyle>;
42
43
  chipContainerProps?: ChipInterface;
43
- checkIconColor?: keyof ThemeColors;
44
- radioIconColor?: keyof ThemeColors;
45
44
  multiSelectIcon?: React.JSX.Element;
46
45
  mode?: 'default' | 'modal' | 'auto';
47
46
  itemTextStyle?: StyleProp<TextStyle>;
@@ -67,7 +66,7 @@ export type DropdownProps<S, T extends SelectionType> = {
67
66
  onChange?: (selecteValue?: keyof S, selectedList?: SelectionType extends 'single' | 'multi' ? S[] : S) => void;
68
67
  };
69
68
  export interface IUseDetectDevice {
70
- isAndroid: boolean;
71
69
  isIOS: boolean;
72
70
  isTablet: boolean;
71
+ isAndroid: boolean;
73
72
  }
@@ -1,11 +1,10 @@
1
1
  import React from 'react';
2
- import { TextProps } from 'react-native';
3
- import { ThemeColors } from '../../interface/colors.interface';
2
+ import { ColorValue, TextProps } from 'react-native';
4
3
  interface props extends TextProps {
5
4
  size?: number;
6
5
  fontFamily?: any;
7
6
  required?: boolean;
8
- color?: keyof ThemeColors;
7
+ color?: ColorValue;
9
8
  type?: 'error' | 'normal';
10
9
  }
11
10
  declare const AppText: ({ size, style, color, children, type, fontFamily, required, ...props }: props) => React.JSX.Element;
@@ -4,8 +4,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  const react_1 = __importDefault(require("react"));
7
- const react_native_1 = require("react-native");
8
7
  const AppTextStyle_1 = require("./AppTextStyle");
8
+ const react_native_1 = require("react-native");
9
9
  const AppText = ({ size, style, color, children, type = 'normal', fontFamily = 'regular', required, ...props }) => {
10
10
  const family = fontFamily;
11
11
  const styles = (0, AppTextStyle_1.useAppTextStyle)({
@@ -1,14 +1,13 @@
1
- import { TextStyle } from 'react-native';
2
- import { ThemeColors } from '../../interface/colors.interface';
1
+ import { ColorValue, TextStyle } from 'react-native';
3
2
  interface props {
4
3
  size?: number;
5
4
  style?: TextStyle;
6
- color?: keyof ThemeColors;
5
+ color?: ColorValue;
7
6
  type?: 'error' | 'normal';
8
7
  }
9
8
  export declare const useAppTextStyle: ({ size, style, color, type, }: props) => {
10
9
  container: {
11
- color: import("react-native").ColorValue;
10
+ color: ColorValue;
12
11
  fontFamily?: string | undefined;
13
12
  fontSize: number;
14
13
  fontStyle?: "normal" | "italic" | undefined;
@@ -18,8 +17,8 @@ export declare const useAppTextStyle: ({ size, style, color, type, }: props) =>
18
17
  textAlign?: "auto" | "left" | "right" | "center" | "justify" | undefined;
19
18
  textDecorationLine?: "none" | "underline" | "line-through" | "underline line-through" | undefined;
20
19
  textDecorationStyle?: "solid" | "double" | "dotted" | "dashed" | undefined;
21
- textDecorationColor?: import("react-native").ColorValue | undefined;
22
- textShadowColor?: import("react-native").ColorValue | undefined;
20
+ textDecorationColor?: ColorValue | undefined;
21
+ textShadowColor?: ColorValue | undefined;
23
22
  textShadowOffset?: {
24
23
  width: number;
25
24
  height: number;
@@ -30,33 +29,33 @@ export declare const useAppTextStyle: ({ size, style, color, type, }: props) =>
30
29
  fontVariant?: import("react-native").FontVariant[] | undefined;
31
30
  writingDirection?: "auto" | "ltr" | "rtl" | undefined;
32
31
  backfaceVisibility?: "visible" | "hidden" | undefined;
33
- backgroundColor?: import("react-native").ColorValue | undefined;
34
- borderBlockColor?: import("react-native").ColorValue | undefined;
35
- borderBlockEndColor?: import("react-native").ColorValue | undefined;
36
- borderBlockStartColor?: import("react-native").ColorValue | undefined;
37
- borderBottomColor?: import("react-native").ColorValue | undefined;
32
+ backgroundColor?: ColorValue | undefined;
33
+ borderBlockColor?: ColorValue | undefined;
34
+ borderBlockEndColor?: ColorValue | undefined;
35
+ borderBlockStartColor?: ColorValue | undefined;
36
+ borderBottomColor?: ColorValue | undefined;
38
37
  borderBottomEndRadius?: import("react-native").AnimatableNumericValue | string | undefined;
39
38
  borderBottomLeftRadius?: import("react-native").AnimatableNumericValue | string | undefined;
40
39
  borderBottomRightRadius?: import("react-native").AnimatableNumericValue | string | undefined;
41
40
  borderBottomStartRadius?: import("react-native").AnimatableNumericValue | string | undefined;
42
- borderColor?: import("react-native").ColorValue | undefined;
41
+ borderColor?: ColorValue | undefined;
43
42
  borderCurve?: "circular" | "continuous" | undefined;
44
- borderEndColor?: import("react-native").ColorValue | undefined;
43
+ borderEndColor?: ColorValue | undefined;
45
44
  borderEndEndRadius?: import("react-native").AnimatableNumericValue | string | undefined;
46
45
  borderEndStartRadius?: import("react-native").AnimatableNumericValue | string | undefined;
47
- borderLeftColor?: import("react-native").ColorValue | undefined;
46
+ borderLeftColor?: ColorValue | undefined;
48
47
  borderRadius?: import("react-native").AnimatableNumericValue | string | undefined;
49
- borderRightColor?: import("react-native").ColorValue | undefined;
50
- borderStartColor?: import("react-native").ColorValue | undefined;
48
+ borderRightColor?: ColorValue | undefined;
49
+ borderStartColor?: ColorValue | undefined;
51
50
  borderStartEndRadius?: import("react-native").AnimatableNumericValue | string | undefined;
52
51
  borderStartStartRadius?: import("react-native").AnimatableNumericValue | string | undefined;
53
52
  borderStyle?: "solid" | "dotted" | "dashed" | undefined;
54
- borderTopColor?: import("react-native").ColorValue | undefined;
53
+ borderTopColor?: ColorValue | undefined;
55
54
  borderTopEndRadius?: import("react-native").AnimatableNumericValue | string | undefined;
56
55
  borderTopLeftRadius?: import("react-native").AnimatableNumericValue | string | undefined;
57
56
  borderTopRightRadius?: import("react-native").AnimatableNumericValue | string | undefined;
58
57
  borderTopStartRadius?: import("react-native").AnimatableNumericValue | string | undefined;
59
- outlineColor?: import("react-native").ColorValue | undefined;
58
+ outlineColor?: ColorValue | undefined;
60
59
  outlineOffset?: import("react-native").AnimatableNumericValue | undefined;
61
60
  outlineStyle?: "solid" | "dotted" | "dashed" | undefined;
62
61
  outlineWidth?: import("react-native").AnimatableNumericValue | undefined;
@@ -145,7 +144,7 @@ export declare const useAppTextStyle: ({ size, style, color, type, }: props) =>
145
144
  paddingInline?: import("react-native").DimensionValue | undefined;
146
145
  paddingInlineEnd?: import("react-native").DimensionValue | undefined;
147
146
  paddingInlineStart?: import("react-native").DimensionValue | undefined;
148
- shadowColor?: import("react-native").ColorValue | undefined;
147
+ shadowColor?: ColorValue | undefined;
149
148
  shadowOffset?: Readonly<{
150
149
  width: number;
151
150
  height: number;
@@ -10,11 +10,7 @@ const useAppTextStyle = ({ size, style, color, type = 'normal', }) => {
10
10
  return react_native_1.StyleSheet.create({
11
11
  container: {
12
12
  fontSize: size || 14,
13
- color: type === 'error'
14
- ? colors.error
15
- : color
16
- ? colors[color]
17
- : colors.primary,
13
+ color: type === 'error' ? colors.error : color ? color : colors.primary,
18
14
  ...style,
19
15
  },
20
16
  require: {
@@ -1,4 +1,5 @@
1
+ import { ColorValue } from "react-native";
1
2
  export interface SvgInterface {
2
3
  size?: number;
3
- color?: string;
4
+ color?: ColorValue;
4
5
  }
@@ -1,7 +1,5 @@
1
1
  export * from './colors';
2
2
  export * from './spacing';
3
3
  export * from './shadow';
4
- export declare const addAlphaToHex: (color: string, opacity: number) => string;
5
4
  export declare const SCREEN_WIDTH: number;
6
5
  export declare const SCREEN_HEIGHT: number;
7
- export declare const MIN_DEVICE_WIDTH: number;
@@ -14,16 +14,10 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
- exports.MIN_DEVICE_WIDTH = exports.SCREEN_HEIGHT = exports.SCREEN_WIDTH = exports.addAlphaToHex = void 0;
17
+ exports.SCREEN_HEIGHT = exports.SCREEN_WIDTH = void 0;
18
18
  __exportStar(require("./colors"), exports);
19
19
  __exportStar(require("./spacing"), exports);
20
20
  __exportStar(require("./shadow"), exports);
21
21
  const react_native_1 = require("react-native");
22
- const addAlphaToHex = (color, opacity) => {
23
- const _opacity = Math.round(Math.min(Math.max(opacity || 1, 0), 1) * 255);
24
- return color + _opacity.toString(16).toUpperCase();
25
- };
26
- exports.addAlphaToHex = addAlphaToHex;
27
22
  exports.SCREEN_WIDTH = react_native_1.Dimensions.get('window').width;
28
23
  exports.SCREEN_HEIGHT = react_native_1.Dimensions.get('window').height;
29
- exports.MIN_DEVICE_WIDTH = react_native_1.Platform.OS === 'ios' ? 390 : 360;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rn-components-dropdown/dropdown",
3
- "version": "1.0.12",
3
+ "version": "1.0.14",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "repository": {
@@ -11,14 +11,14 @@ import {
11
11
  } from 'react-native';
12
12
  import _ from 'lodash';
13
13
  import AppText from '../text/AppText';
14
- import Chip from './components/chip/Chip';
14
+ import Chip from './component/chip/Chip';
15
15
  import React, { useCallback } from 'react';
16
16
  import useDropdown from './hooks/useDropdown';
17
17
  import SvgButton from '../svgButton/SvgButton';
18
18
  import { useDropdownStyle } from './DropdownStyle';
19
19
  import CheckIcon from '../../assets/svg/CheckIcon';
20
20
  import { ArrowDown, ArrowUp } from '../../assets/svg';
21
- import SearchInput from './components/input/TextInput';
21
+ import SearchInput from './component/input/TextInput';
22
22
  import { DropdownProps } from './interface/DropdownInterface';
23
23
 
24
24
  const DropdownComponent = <T, Mode extends 'single' | 'multi'>(
@@ -40,6 +40,8 @@ const DropdownComponent = <T, Mode extends 'single' | 'multi'>(
40
40
  containerStyle,
41
41
  search = false,
42
42
  renderLeftIcon,
43
+ checkIconColor,
44
+ radioIconColor,
43
45
  multiSelectIcon,
44
46
  itemTestIDField,
45
47
  maxHeight = 300,
@@ -58,12 +60,12 @@ const DropdownComponent = <T, Mode extends 'single' | 'multi'>(
58
60
  labelTextStyle = {},
59
61
  selectedTextProps = {},
60
62
  chipContainerProps = {},
63
+ keyboardAvoiding = true,
61
64
  selectionType = 'single',
62
65
  activeColor = 'lightGray',
63
- keyboardAvoiding = true,
64
66
  dropdownPosition = 'auto',
65
- placeholder = 'Select item',
66
67
  itemAccessibilityLabelField,
68
+ placeholder = 'Please select',
67
69
  showsVerticalScrollIndicator = true,
68
70
  } = props;
69
71
 
@@ -74,7 +76,10 @@ const DropdownComponent = <T, Mode extends 'single' | 'multi'>(
74
76
  onClearPress: onClear,
75
77
  } = chipContainerProps;
76
78
 
77
- const { styles, colors } = useDropdownStyle({});
79
+ const { styles, colors } = useDropdownStyle({
80
+ checkIconColor: checkIconColor,
81
+ radioIconColor: radioIconColor,
82
+ });
78
83
  const {
79
84
  ref,
80
85
  font,
@@ -202,7 +207,7 @@ const DropdownComponent = <T, Mode extends 'single' | 'multi'>(
202
207
  item,
203
208
  itemAccessibilityLabelField || labelField,
204
209
  )}
205
- underlayColor={colors[activeColor]}
210
+ underlayColor={activeColor}
206
211
  onPress={() => onCheckPress(item)}
207
212
  >
208
213
  <View style={StyleSheet.flatten([itemContainerStyle])}>
@@ -222,7 +227,11 @@ const DropdownComponent = <T, Mode extends 'single' | 'multi'>(
222
227
  style={[
223
228
  styles.checkContainer,
224
229
  {
225
- backgroundColor: isSelected ? colors.gray : colors.white,
230
+ backgroundColor: isSelected
231
+ ? checkIconColor
232
+ ? checkIconColor
233
+ : colors.gray
234
+ : colors.white,
226
235
  },
227
236
  ]}
228
237
  />
@@ -272,7 +281,7 @@ const DropdownComponent = <T, Mode extends 'single' | 'multi'>(
272
281
  item,
273
282
  itemAccessibilityLabelField || labelField,
274
283
  )}
275
- underlayColor={colors[activeColor]}
284
+ underlayColor={activeColor}
276
285
  onPress={() => onSelect(item)}
277
286
  >
278
287
  <View style={StyleSheet.flatten([itemContainerStyle])}>
@@ -457,7 +466,6 @@ const DropdownComponent = <T, Mode extends 'single' | 'multi'>(
457
466
  style={StyleSheet.flatten([
458
467
  styles.flex1,
459
468
  isFull && styles.styleContainerVertical,
460
- backgroundColor && { backgroundColor: backgroundColor },
461
469
  keyboardStyle,
462
470
  ])}
463
471
  >
@@ -1,18 +1,22 @@
1
+ import {
2
+ SPACING,
3
+ LIGHT_COLORS,
4
+ SCREEN_WIDTH,
5
+ DEFAULT_COLORS,
6
+ } from '../../style';
1
7
  import { useMemo } from 'react';
2
8
  import { I18nManager, StyleSheet } from 'react-native';
3
9
  import { useDeviceOrientation } from './hooks/useOrientation';
4
- import { ThemeColors } from '../../interface/colors.interface';
5
- import { DEFAULT_COLORS, SCREEN_WIDTH, SPACING, LIGHT_COLORS } from '../../style';
6
10
 
7
11
  interface Props {
8
12
  size?: number;
9
- radioIconColor?: keyof ThemeColors;
10
- checkIconColor?: keyof ThemeColors;
13
+ radioIconColor?: string;
14
+ checkIconColor?: string;
11
15
  }
12
16
 
13
17
  export const useDropdownStyle = (props: Props) => {
18
+ const { ...colors } = LIGHT_COLORS;
14
19
  const orientation = useDeviceOrientation();
15
- const { ...colors } = LIGHT_COLORS
16
20
  const { size = 16, radioIconColor, checkIconColor } = props;
17
21
 
18
22
  const styles = useMemo(() => {
@@ -59,6 +63,7 @@ export const useDropdownStyle = (props: Props) => {
59
63
  },
60
64
  title: {
61
65
  fontSize: 16,
66
+ color: colors.gray,
62
67
  marginVertical: SPACING.s6,
63
68
  writingDirection: I18nManager.isRTL ? 'rtl' : 'ltr',
64
69
  },
@@ -73,6 +78,7 @@ export const useDropdownStyle = (props: Props) => {
73
78
  textItem: {
74
79
  flex: 1,
75
80
  fontSize: 16,
81
+ color: colors.gray,
76
82
  writingDirection: I18nManager.isRTL ? 'rtl' : 'ltr',
77
83
  },
78
84
  icon: {
@@ -96,7 +102,7 @@ export const useDropdownStyle = (props: Props) => {
96
102
  paddingVertical: SPACING.s6,
97
103
  },
98
104
  labelTextStyle: {
99
- color: colors.black,
105
+ color: colors.gray,
100
106
  },
101
107
  itemIconContainer: {
102
108
  borderWidth: 2,
@@ -26,7 +26,7 @@ const Chip = (props: ChipInterface) => {
26
26
  icon={
27
27
  <ClearIcon
28
28
  size={8}
29
- color={textColor ? colors[textColor] : colors.white}
29
+ color={textColor ? textColor : colors.white}
30
30
  />
31
31
  }
32
32
  onPress={onClearPress}
@@ -28,7 +28,7 @@ const useChipStyle = (props: ChipInterface) => {
28
28
  flexDirection: 'row',
29
29
  alignItems: 'center',
30
30
  justifyContent: 'center',
31
- backgroundColor: chipColor ? colors[chipColor] : colors.lightGray,
31
+ backgroundColor: chipColor ? chipColor : colors.lightGray,
32
32
  },
33
33
  chipText: {
34
34
  paddingLeft: 10,
@@ -42,8 +42,8 @@ const useChipStyle = (props: ChipInterface) => {
42
42
  marginHorizontal: 4,
43
43
  alignItems: 'center',
44
44
  justifyContent: 'center',
45
- borderColor: textColor ? colors[textColor] : colors.white,
46
- backgroundColor: chipColor ? colors[chipColor] : colors.lightGray,
45
+ borderColor: textColor ? textColor : colors.white,
46
+ backgroundColor: chipColor ? chipColor : colors.lightGray,
47
47
  },
48
48
  clearIcon: {
49
49
  width: 12,
@@ -323,13 +323,14 @@ const useDropdown = <T, Mode extends 'single' | 'multi'>(
323
323
 
324
324
  const onClearPress = useCallback(
325
325
  (item: T) => {
326
- const clone = _.clone(currentValue);
327
- const rem = _.remove(clone, i => i?.[valueField] !== item[valueField]);
328
- const val = rem?.map(i => i?.[valueField]);
329
- setCurrentValue(rem);
326
+ const updated = currentValue.filter(
327
+ (i: any) => i[valueField] !== item[valueField],
328
+ );
329
+ const val = currentValue.map((i: any) => i[valueField]);
330
+ setCurrentValue(updated);
330
331
  onChange?.(item[valueField] as keyof T, val);
331
332
  },
332
- [onChange],
333
+ [currentValue, valueField, onChange, setCurrentValue],
333
334
  );
334
335
 
335
336
  return {
@@ -1,9 +1,10 @@
1
- import { ThemeColors } from '../../../interface/colors.interface';
1
+ import { ColorValue } from "react-native";
2
+
2
3
 
3
4
  export interface ChipInterface {
4
5
  label?: string;
5
6
  onClearPress?: () => void;
6
- chipColor?: keyof ThemeColors;
7
- textColor?: keyof ThemeColors;
7
+ chipColor?: ColorValue;
8
+ textColor?: ColorValue;
8
9
  clearIcon?: React.JSX.Element;
9
10
  }
@@ -8,7 +8,6 @@ import type {
8
8
  FlatListProps,
9
9
  } from 'react-native';
10
10
  import { ChipInterface } from './ChipInterface';
11
- import { ThemeColors } from '../../../interface/colors.interface';
12
11
 
13
12
  export type IDropdownRef = {
14
13
  open: () => void;
@@ -34,8 +33,11 @@ export type DropdownProps<S, T extends SelectionType> = {
34
33
  placeholder?: string;
35
34
  onFocus?: () => void;
36
35
  autoScroll?: boolean;
36
+ activeColor?: string;
37
37
  searchField?: keyof S;
38
38
  value?: S[] | undefined;
39
+ checkIconColor?: string;
40
+ radioIconColor?: string;
39
41
  itemTestIDField?: string;
40
42
  backgroundColor?: string;
41
43
  keyboardAvoiding?: boolean;
@@ -47,11 +49,8 @@ export type DropdownProps<S, T extends SelectionType> = {
47
49
  selectedTextProps?: TextProps;
48
50
  subfixIcon?: React.JSX.Element;
49
51
  onClear?: (id?: number) => void;
50
- activeColor?: keyof ThemeColors;
51
52
  iconStyle?: StyleProp<ImageStyle>;
52
53
  chipContainerProps?: ChipInterface;
53
- checkIconColor?: keyof ThemeColors;
54
- radioIconColor?: keyof ThemeColors;
55
54
  multiSelectIcon?: React.JSX.Element;
56
55
  mode?: 'default' | 'modal' | 'auto';
57
56
  itemTextStyle?: StyleProp<TextStyle>;
@@ -88,7 +87,7 @@ export type DropdownProps<S, T extends SelectionType> = {
88
87
  };
89
88
 
90
89
  export interface IUseDetectDevice {
91
- isAndroid: boolean;
92
90
  isIOS: boolean;
93
91
  isTablet: boolean;
92
+ isAndroid: boolean;
94
93
  }
@@ -1,13 +1,12 @@
1
1
  import React from 'react';
2
- import { Text, TextProps } from 'react-native';
3
2
  import { useAppTextStyle } from './AppTextStyle';
4
- import { ThemeColors } from '../../interface/colors.interface';
3
+ import { ColorValue, Text, TextProps } from 'react-native';
5
4
 
6
5
  interface props extends TextProps {
7
6
  size?: number;
8
7
  fontFamily?: any;
9
8
  required?: boolean;
10
- color?: keyof ThemeColors;
9
+ color?: ColorValue;
11
10
  type?: 'error' | 'normal';
12
11
  }
13
12
 
@@ -1,12 +1,11 @@
1
1
  import { useMemo } from 'react';
2
2
  import { LIGHT_COLORS } from '../../style';
3
- import { StyleSheet, TextStyle } from 'react-native';
4
- import { ThemeColors } from '../../interface/colors.interface';
3
+ import { ColorValue, StyleSheet, TextStyle } from 'react-native';
5
4
 
6
5
  interface props {
7
6
  size?: number;
8
7
  style?: TextStyle;
9
- color?: keyof ThemeColors;
8
+ color?: ColorValue;
10
9
  type?: 'error' | 'normal';
11
10
  }
12
11
 
@@ -22,12 +21,7 @@ export const useAppTextStyle = ({
22
21
  return StyleSheet.create({
23
22
  container: {
24
23
  fontSize: size || 14,
25
- color:
26
- type === 'error'
27
- ? colors.error
28
- : color
29
- ? colors[color]
30
- : colors.primary,
24
+ color: type === 'error' ? colors.error : color ? color : colors.primary,
31
25
  ...style,
32
26
  },
33
27
  require: {
@@ -1,4 +1,6 @@
1
+ import { ColorValue } from "react-native";
2
+
1
3
  export interface SvgInterface {
2
4
  size?: number;
3
- color?: string;
5
+ color?: ColorValue;
4
6
  }
@@ -3,12 +3,5 @@ export * from './spacing';
3
3
  export * from './shadow';
4
4
  import { Dimensions, Platform } from 'react-native';
5
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
6
  export const SCREEN_WIDTH = Dimensions.get('window').width;
12
7
  export const SCREEN_HEIGHT = Dimensions.get('window').height;
13
- export const MIN_DEVICE_WIDTH = Platform.OS === 'ios' ? 390 : 360;
14
-