@rn-components-dropdown/dropdown 1.0.25 → 1.0.28

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 (49) hide show
  1. package/dist/components/dropdown/Dropdown.js +113 -148
  2. package/dist/components/dropdown/DropdownStyle.d.ts +11 -11
  3. package/dist/components/dropdown/DropdownStyle.js +20 -24
  4. package/dist/components/dropdown/component/chip/Chip.js +14 -19
  5. package/dist/components/dropdown/component/chip/ChipStyle.d.ts +8 -18
  6. package/dist/components/dropdown/component/chip/ChipStyle.js +8 -10
  7. package/dist/components/dropdown/component/input/TextInput.js +12 -50
  8. package/dist/components/dropdown/component/input/TextInputStyle.d.ts +4 -4
  9. package/dist/components/dropdown/component/input/TextInputStyle.js +7 -11
  10. package/dist/components/dropdown/hooks/useDetectDevice.js +6 -9
  11. package/dist/components/dropdown/hooks/useDropdown.d.ts +8 -4
  12. package/dist/components/dropdown/hooks/useDropdown.js +48 -53
  13. package/dist/components/dropdown/hooks/useOrientation.js +7 -10
  14. package/dist/components/dropdown/interface/ChipInterface.js +1 -2
  15. package/dist/components/dropdown/interface/DropdownInterface.d.ts +4 -4
  16. package/dist/components/dropdown/interface/DropdownInterface.js +1 -2
  17. package/dist/components/dropdown/interface/InputProps.js +1 -2
  18. package/dist/components/svgButton/SvgButton.js +8 -13
  19. package/dist/components/svgButton/SvgButtonStyle.d.ts +2 -2
  20. package/dist/components/svgButton/SvgButtonStyle.js +7 -11
  21. package/dist/components/text/AppText.js +8 -16
  22. package/dist/components/text/AppTextStyle.d.ts +3 -156
  23. package/dist/components/text/AppTextStyle.js +8 -13
  24. package/dist/components/textInput/AppTextInput.js +19 -57
  25. package/dist/components/textInput/AppTextInputStyle.d.ts +4 -4
  26. package/dist/components/textInput/AppTextInputStyle.js +16 -20
  27. package/dist/controller/dropDownController/DropdownController.d.ts +4 -5
  28. package/dist/controller/dropDownController/DropdownController.js +13 -18
  29. package/dist/controller/dropDownController/DropdownControllerStyle.d.ts +3 -3
  30. package/dist/controller/dropDownController/DropdownControllerStyle.js +10 -14
  31. package/dist/index.js +2 -10
  32. package/dist/interface/colors.interface.js +1 -2
  33. package/dist/interface/svg.interface.js +1 -2
  34. package/dist/style/colors.js +6 -9
  35. package/dist/style/index.js +6 -23
  36. package/dist/style/shadow.d.ts +0 -149
  37. package/dist/style/shadow.js +1 -147
  38. package/dist/style/spacing.d.ts +0 -12
  39. package/dist/style/spacing.js +2 -17
  40. package/package.json +4 -3
  41. package/src/components/dropdown/Dropdown.tsx +28 -26
  42. package/src/components/dropdown/hooks/useDropdown.ts +14 -3
  43. package/src/components/dropdown/interface/DropdownInterface.ts +4 -4
  44. package/src/components/text/AppText.tsx +0 -3
  45. package/src/components/text/AppTextStyle.ts +1 -3
  46. package/src/controller/dropDownController/DropdownController.tsx +18 -17
  47. package/src/style/shadow.ts +0 -143
  48. package/src/style/spacing.ts +1 -13
  49. package/tsconfig.json +8 -4
@@ -1,108 +1,68 @@
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
- /* eslint-disable react-hooks/exhaustive-deps */
40
- const react_native_1 = require("react-native");
41
- const lodash_1 = __importDefault(require("lodash"));
42
- const AppText_1 = __importDefault(require("../text/AppText"));
43
- const Chip_1 = __importDefault(require("./component/chip/Chip"));
44
- const react_1 = __importStar(require("react"));
45
- const useDropdown_1 = __importDefault(require("./hooks/useDropdown"));
46
- const SvgButton_1 = __importDefault(require("../svgButton/SvgButton"));
47
- const DropdownStyle_1 = require("./DropdownStyle");
48
- const CheckIcon_1 = __importDefault(require("../../assets/svg/CheckIcon"));
49
- const svg_1 = require("../../assets/svg");
50
- const TextInput_1 = __importDefault(require("./component/input/TextInput"));
1
+ import { View, Modal, FlatList, StyleSheet, ScrollView, TouchableHighlight, TouchableWithoutFeedback, } from 'react-native';
2
+ import _ from 'lodash';
3
+ import AppText from '../text/AppText';
4
+ import Chip from './component/chip/Chip';
5
+ import React, { useCallback } from 'react';
6
+ import useDropdown from './hooks/useDropdown';
7
+ import SvgButton from '../svgButton/SvgButton';
8
+ import { useDropdownStyle } from './DropdownStyle';
9
+ import { ArrowDown, ArrowUp, CheckIcon } from '../../assets/svg';
10
+ import SearchInput from './component/input/TextInput';
51
11
  const DropdownComponent = (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;
12
+ 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, 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
13
  const { chipColor, clearIcon, textColor, onClearPress: onClear, } = chipContainerProps;
54
- const { styles, colors } = (0, DropdownStyle_1.useDropdownStyle)({
14
+ const { styles, colors } = useDropdownStyle({
55
15
  checkIconColor: checkIconColor,
56
16
  radioIconColor: radioIconColor,
57
17
  });
58
- const { ref, font, visible, refList, position, onSelect, listData, onSearch, onMeasure, searchText, showOrClose, scrollIndex, currentValue, onCheckPress, onClearPress, setSearchText, keyboardHeight, } = (0, useDropdown_1.default)({ ...props });
18
+ const { ref, font, visible, refList, position, onSelect, listData, onSearch, onMeasure, searchText, showOrClose, scrollIndex, currentValue, onCheckPress, onClearPress, setSearchText, keyboardHeight, } = useDropdown({ ...props });
59
19
  const renderRight = () => {
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([
20
+ return renderRightIcon ? (renderRightIcon(visible)) : (<SvgButton icon={subfixIcon ? (subfixIcon) : visible ? (<ArrowUp color={iconColor}/>) : (<ArrowDown color={iconColor}/>)} onPress={showOrClose} style={StyleSheet.flatten([
61
21
  iconStyle,
62
22
  styles.icon,
63
23
  { tintColor: iconColor },
64
24
  ])}/>);
65
25
  };
66
26
  const _renderDropdown = () => {
67
- const isSelected = currentValue && lodash_1.default.get(currentValue, valueField);
68
- return (<react_native_1.TouchableWithoutFeedback testID={testID} accessible={!!accessibilityLabel} accessibilityLabel={accessibilityLabel} onPress={() => (selectionType === 'single' ? showOrClose() : null)}>
69
- <react_native_1.View style={styles.dropdown}>
27
+ const isSelected = currentValue && _.get(currentValue, valueField);
28
+ return (<TouchableWithoutFeedback testID={testID} accessible={!!accessibilityLabel} accessibilityLabel={accessibilityLabel} onPress={() => (selectionType === 'single' ? showOrClose() : null)}>
29
+ <View style={styles.dropdown}>
70
30
  {renderLeftIcon?.(visible)}
71
- {selectionType === 'single' ? (<AppText_1.default style={[
31
+ {selectionType === 'single' ? (<AppText style={[
72
32
  styles.textItem,
73
33
  isSelected !== null ? selectedTextStyle : placeholderStyle,
74
34
  font(),
75
35
  ]} {...selectedTextProps}>
76
36
  {isSelected !== null
77
- ? lodash_1.default.get(currentValue, labelField)
37
+ ? _.get(currentValue, labelField)
78
38
  : placeholder}
79
- </AppText_1.default>) : currentValue?.length === 0 ? (<AppText_1.default style={[styles.textItem, placeholderStyle, font()]} {...selectedTextProps}>
39
+ </AppText>) : currentValue?.length === 0 ? (<AppText style={[styles.textItem, placeholderStyle, font()]} {...selectedTextProps}>
80
40
  {placeholder}
81
- </AppText_1.default>) : (<react_native_1.View style={styles.showMultiSelectContainer}>
82
- <react_native_1.ScrollView showsVerticalScrollIndicator={false}>
83
- <react_native_1.View style={styles.wraps}>
84
- {currentValue?.map?.((i) => (<Chip_1.default chipColor={chipColor || 'red'} textColor={textColor || 'white'} clearIcon={clearIcon} key={i?.[valueField]} label={i?.[labelField]} onClearPress={() => {
41
+ </AppText>) : (<View style={styles.showMultiSelectContainer}>
42
+ <ScrollView showsVerticalScrollIndicator={false}>
43
+ <View style={styles.wraps}>
44
+ {currentValue?.map?.((i) => (<Chip chipColor={chipColor || 'red'} textColor={textColor || 'white'} clearIcon={clearIcon} key={i?.[valueField]} label={i?.[labelField]} onClearPress={() => {
85
45
  onClear?.();
86
46
  onClearPress?.(i);
87
47
  }}/>))}
88
- </react_native_1.View>
89
- </react_native_1.ScrollView>
90
- </react_native_1.View>)}
48
+ </View>
49
+ </ScrollView>
50
+ </View>)}
91
51
  {renderRight()}
92
- </react_native_1.View>
93
- </react_native_1.TouchableWithoutFeedback>);
52
+ </View>
53
+ </TouchableWithoutFeedback>);
94
54
  };
95
- const renderRadio = (0, react_1.useCallback)((selected) => {
96
- return (<react_native_1.View style={styles.itemIconContainer}>
97
- {selected && <react_native_1.View style={styles.iconSubContainer}/>}
98
- </react_native_1.View>);
55
+ const renderRadio = useCallback((selected) => {
56
+ return (<View style={styles.itemIconContainer}>
57
+ {selected && <View style={styles.iconSubContainer}/>}
58
+ </View>);
99
59
  }, [styles]);
100
- const renderCheckItem = (0, react_1.useCallback)(({ item, index }) => {
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)));
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)}>
103
- <react_native_1.View style={react_native_1.StyleSheet.flatten([itemContainerStyle])}>
104
- {renderItem ? (renderItem(item, isSelected, labelField, valueField)) : (<react_native_1.View style={styles.item}>
105
- <SvgButton_1.default icon={multiSelectIcon ? (multiSelectIcon) : (<CheckIcon_1.default color={colors.white}/>)} onPress={() => onCheckPress(item)} style={[
60
+ const renderCheckItem = useCallback(({ item, index }) => {
61
+ const isSelected = _.some(currentValue, (h) => _.isEqual(_.get(h, valueField), _.get(item, valueField)));
62
+ return (<TouchableHighlight key={index.toString()} testID={_.get(item, itemTestIDField || labelField)} accessible={!!accessibilityLabel} accessibilityLabel={_.get(item, itemAccessibilityLabelField || labelField)} underlayColor={activeColor} onPress={() => onCheckPress(item)}>
63
+ <View style={StyleSheet.flatten([itemContainerStyle])}>
64
+ {renderItem ? (renderItem(item, isSelected, labelField, valueField)) : (<View style={styles.item}>
65
+ <SvgButton icon={multiSelectIcon ? (multiSelectIcon) : (<CheckIcon color={colors.white}/>)} onPress={() => onCheckPress(item)} style={[
106
66
  styles.checkContainer,
107
67
  {
108
68
  backgroundColor: isSelected
@@ -112,52 +72,54 @@ const DropdownComponent = (props) => {
112
72
  : colors.white,
113
73
  },
114
74
  ]}/>
115
- <AppText_1.default style={react_native_1.StyleSheet.flatten([
75
+ <AppText style={StyleSheet.flatten([
116
76
  styles.textItem,
117
77
  itemTextStyle,
118
78
  font(),
119
79
  ])}>
120
- {lodash_1.default.get(item, labelField)}
121
- </AppText_1.default>
122
- </react_native_1.View>)}
123
- </react_native_1.View>
124
- </react_native_1.TouchableHighlight>);
80
+ {_.get(item, labelField)}
81
+ </AppText>
82
+ </View>)}
83
+ </View>
84
+ </TouchableHighlight>);
125
85
  }, [
126
- font,
127
- colors,
128
- styles,
129
- labelField,
130
- renderItem,
131
- valueField,
132
- activeColor,
133
86
  currentValue,
134
- itemTextStyle,
135
87
  itemTestIDField,
88
+ labelField,
136
89
  accessibilityLabel,
137
- itemContainerStyle,
138
90
  itemAccessibilityLabelField,
91
+ activeColor,
92
+ itemContainerStyle,
93
+ renderItem,
94
+ valueField,
95
+ styles,
96
+ multiSelectIcon,
97
+ colors,
98
+ checkIconColor,
99
+ itemTextStyle,
100
+ font,
101
+ onCheckPress,
139
102
  ]);
140
- const _renderItem = (0, react_1.useCallback)(({ item, index }) => {
141
- const isSelected = currentValue && lodash_1.default.get(currentValue, valueField);
142
- const selected = lodash_1.default.isEqual(lodash_1.default.get(item, valueField), isSelected);
143
- lodash_1.default.assign(item, { _index: index });
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)}>
145
- <react_native_1.View style={react_native_1.StyleSheet.flatten([itemContainerStyle])}>
146
- {renderItem ? (renderItem(item, selected, labelField, valueField)) : (<react_native_1.View style={styles.item}>
103
+ const _renderItem = useCallback(({ item, index }) => {
104
+ const isSelected = currentValue && _.get(currentValue, valueField);
105
+ const selected = _.isEqual(_.get(item, valueField), isSelected);
106
+ _.assign(item, { _index: index });
107
+ return (<TouchableHighlight key={index.toString()} testID={_.get(item, itemTestIDField || labelField)} accessible={!!accessibilityLabel} accessibilityLabel={_.get(item, itemAccessibilityLabelField || labelField)} underlayColor={activeColor} onPress={() => onSelect(item)}>
108
+ <View style={StyleSheet.flatten([itemContainerStyle])}>
109
+ {renderItem ? (renderItem(item, selected, labelField, valueField)) : (<View style={styles.item}>
147
110
  {renderRadio(selected)}
148
- <AppText_1.default style={react_native_1.StyleSheet.flatten([
111
+ <AppText style={StyleSheet.flatten([
149
112
  styles.textItem,
150
113
  itemTextStyle,
151
114
  font(),
152
115
  ])}>
153
- {lodash_1.default.get(item, labelField)}
154
- </AppText_1.default>
155
- </react_native_1.View>)}
156
- </react_native_1.View>
157
- </react_native_1.TouchableHighlight>);
116
+ {_.get(item, labelField)}
117
+ </AppText>
118
+ </View>)}
119
+ </View>
120
+ </TouchableHighlight>);
158
121
  }, [
159
122
  font,
160
- colors,
161
123
  styles,
162
124
  onSelect,
163
125
  labelField,
@@ -172,7 +134,7 @@ const DropdownComponent = (props) => {
172
134
  itemContainerStyle,
173
135
  itemAccessibilityLabelField,
174
136
  ]);
175
- const renderSearch = (0, react_1.useCallback)(() => {
137
+ const renderSearch = useCallback(() => {
176
138
  if (search) {
177
139
  if (renderInputSearch) {
178
140
  return renderInputSearch(text => {
@@ -184,7 +146,7 @@ const DropdownComponent = (props) => {
184
146
  });
185
147
  }
186
148
  else {
187
- return (<TextInput_1.default value={searchText} autoCorrect={false} testID={testID + ' input'} placeholderTextColor={colors.black} style={[styles.input, inputSearchStyle]} accessibilityLabel={accessibilityLabel + ' input'} placeholder={searchPlaceholder || 'Write here for search...'} onChangeText={(e) => {
149
+ return (<SearchInput value={searchText} autoCorrect={false} testID={testID + ' input'} placeholderTextColor={colors.black} style={[styles.input, inputSearchStyle]} accessibilityLabel={accessibilityLabel + ' input'} placeholder={searchPlaceholder || 'Write here for search...'} onChangeText={(e) => {
188
150
  if (onChangeText) {
189
151
  setSearchText(e);
190
152
  onChangeText(e);
@@ -196,42 +158,46 @@ const DropdownComponent = (props) => {
196
158
  return null;
197
159
  }, [
198
160
  search,
161
+ renderInputSearch,
162
+ onChangeText,
163
+ onSearch,
164
+ setSearchText,
165
+ searchText,
199
166
  testID,
200
167
  colors,
201
168
  styles,
202
- onSearch,
203
- searchText,
204
- onChangeText,
205
169
  inputSearchStyle,
206
- renderInputSearch,
207
- searchPlaceholder,
208
170
  accessibilityLabel,
171
+ searchPlaceholder,
209
172
  ]);
210
- const _renderList = (0, react_1.useCallback)((isTopPosition) => {
173
+ const _renderList = useCallback((isTopPosition) => {
211
174
  const isInverted = !inverted ? false : isTopPosition;
212
175
  const _renderListHelper = () => {
213
- return (<react_native_1.FlatList ref={refList} data={listData} {...flatListProps} testID={testID + ' flatlist'} keyboardShouldPersistTaps="handled" onScrollToIndexFailed={scrollIndex} inverted={isTopPosition ? inverted : false} keyExtractor={(_item, index) => index.toString()} accessibilityLabel={accessibilityLabel + ' flatlist'} showsVerticalScrollIndicator={showsVerticalScrollIndicator} renderItem={selectionType === 'single' ? _renderItem : renderCheckItem}/>);
176
+ return (<FlatList ref={refList} data={listData} {...flatListProps} testID={testID + ' flatlist'} keyboardShouldPersistTaps="handled" onScrollToIndexFailed={scrollIndex} inverted={isTopPosition ? inverted : false} keyExtractor={(_item, index) => index.toString()} accessibilityLabel={accessibilityLabel + ' flatlist'} showsVerticalScrollIndicator={showsVerticalScrollIndicator} renderItem={selectionType === 'single' ? _renderItem : renderCheckItem}/>);
214
177
  };
215
- return (<react_native_1.TouchableWithoutFeedback>
216
- <react_native_1.View style={styles.flexShrink}>
178
+ return (<TouchableWithoutFeedback>
179
+ <View style={styles.flexShrink}>
217
180
  {isInverted && _renderListHelper()}
218
181
  {renderSearch()}
219
182
  {!isInverted && _renderListHelper()}
220
- </react_native_1.View>
221
- </react_native_1.TouchableWithoutFeedback>);
183
+ </View>
184
+ </TouchableWithoutFeedback>);
222
185
  }, [
223
- styles,
224
- testID,
225
186
  inverted,
226
- listData,
227
- scrollIndex,
187
+ styles,
228
188
  renderSearch,
189
+ refList,
190
+ listData,
229
191
  flatListProps,
230
- renderCheckItem,
192
+ testID,
193
+ scrollIndex,
231
194
  accessibilityLabel,
232
195
  showsVerticalScrollIndicator,
196
+ selectionType,
197
+ _renderItem,
198
+ renderCheckItem,
233
199
  ]);
234
- const _renderModal = (0, react_1.useCallback)(() => {
200
+ const _renderModal = useCallback(() => {
235
201
  if (visible && position) {
236
202
  const { isFull, width, height, top, bottom, left } = position;
237
203
  const onAutoPosition = () => {
@@ -257,14 +223,14 @@ const DropdownComponent = (props) => {
257
223
  dropdownPosition === 'auto') {
258
224
  extendHeight = keyboardHeight;
259
225
  }
260
- return (<react_native_1.Modal transparent visible={visible} statusBarTranslucent onRequestClose={showOrClose} supportedOrientations={['landscape', 'portrait']}>
261
- <react_native_1.TouchableWithoutFeedback onPress={showOrClose}>
262
- <react_native_1.View style={react_native_1.StyleSheet.flatten([
226
+ return (<Modal transparent visible={visible} statusBarTranslucent onRequestClose={showOrClose} supportedOrientations={['landscape', 'portrait']}>
227
+ <TouchableWithoutFeedback onPress={showOrClose}>
228
+ <View style={StyleSheet.flatten([
263
229
  styles.flex1,
264
230
  isFull && styles.styleContainerVertical,
265
231
  keyboardStyle,
266
232
  ])}>
267
- <react_native_1.View style={react_native_1.StyleSheet.flatten([
233
+ <View style={StyleSheet.flatten([
268
234
  styles.flex1,
269
235
  !isTopPosition
270
236
  ? { paddingTop: extendHeight }
@@ -274,7 +240,7 @@ const DropdownComponent = (props) => {
274
240
  },
275
241
  isFull && styles.fullScreen,
276
242
  ])}>
277
- <react_native_1.View style={react_native_1.StyleSheet.flatten([
243
+ <View style={StyleSheet.flatten([
278
244
  styles.container,
279
245
  isFull ? styles.styleHorizontal : styleVertical,
280
246
  {
@@ -283,11 +249,11 @@ const DropdownComponent = (props) => {
283
249
  containerStyle,
284
250
  ])}>
285
251
  {_renderList(isTopPosition)}
286
- </react_native_1.View>
287
- </react_native_1.View>
288
- </react_native_1.View>
289
- </react_native_1.TouchableWithoutFeedback>
290
- </react_native_1.Modal>);
252
+ </View>
253
+ </View>
254
+ </View>
255
+ </TouchableWithoutFeedback>
256
+ </Modal>);
291
257
  }
292
258
  return null;
293
259
  }
@@ -303,23 +269,22 @@ const DropdownComponent = (props) => {
303
269
  _renderList,
304
270
  keyboardHeight,
305
271
  containerStyle,
306
- backgroundColor,
307
272
  dropdownPosition,
308
273
  keyboardAvoiding,
309
274
  ]);
310
- const _renderLabel = (0, react_1.useCallback)(() => {
311
- return label ? (<react_native_1.View style={[styles.labelContainer, labelContainer]}>
312
- <AppText_1.default style={[styles.labelTextStyle, labelTextStyle]}>
275
+ const _renderLabel = useCallback(() => {
276
+ return label ? (<View style={[styles.labelContainer, labelContainer]}>
277
+ <AppText style={[styles.labelTextStyle, labelTextStyle]}>
313
278
  {label}
314
- </AppText_1.default>
315
- </react_native_1.View>) : (<></>);
279
+ </AppText>
280
+ </View>) : (<></>);
316
281
  }, [label, labelContainer, labelTextStyle, styles]);
317
- return (<react_native_1.View style={styles.mainContainer}>
282
+ return (<View style={styles.mainContainer}>
318
283
  {_renderLabel()}
319
- <react_native_1.View ref={ref} onLayout={onMeasure} style={react_native_1.StyleSheet.flatten([styles.mainWrap, style])}>
284
+ <View ref={ref} onLayout={onMeasure} style={StyleSheet.flatten([styles.mainWrap, style])}>
320
285
  {_renderDropdown()}
321
286
  {_renderModal()}
322
- </react_native_1.View>
323
- </react_native_1.View>);
287
+ </View>
288
+ </View>);
324
289
  };
325
- exports.default = DropdownComponent;
290
+ export default DropdownComponent;
@@ -5,9 +5,9 @@ interface Props {
5
5
  checkIconColor?: ColorValue;
6
6
  }
7
7
  export declare const useDropdownStyle: (props: Props) => {
8
- styles: {
8
+ styles: Readonly<{
9
9
  mainContainer: {
10
- width: "100%";
10
+ width: string;
11
11
  };
12
12
  mainWrap: {
13
13
  borderWidth: number;
@@ -98,16 +98,16 @@ export declare const useDropdownStyle: (props: Props) => {
98
98
  alignItems: "center";
99
99
  justifyContent: "center";
100
100
  padding: number;
101
- borderColor: ColorValue;
101
+ borderColor: string | number | import("react-native").NativeColorValue;
102
102
  };
103
103
  iconSubContainer: {
104
- width: "100%";
105
- height: "100%";
104
+ width: string;
105
+ height: string;
106
106
  borderRadius: number;
107
- backgroundColor: ColorValue;
107
+ backgroundColor: string | number | import("react-native").NativeColorValue;
108
108
  };
109
109
  styleHorizontal: {
110
- width: number | "100%";
110
+ width: string | number;
111
111
  alignSelf: "center";
112
112
  };
113
113
  styleContainerVertical: {
@@ -122,11 +122,11 @@ export declare const useDropdownStyle: (props: Props) => {
122
122
  height: number;
123
123
  alignItems: "center";
124
124
  justifyContent: "center";
125
- borderColor: ColorValue;
125
+ borderColor: string | number | import("react-native").NativeColorValue;
126
126
  };
127
127
  showMultiSelectContainer: {
128
- width: "90%";
129
- height: "auto";
128
+ width: string;
129
+ height: string;
130
130
  maxHeight: number;
131
131
  };
132
132
  wraps: {
@@ -135,7 +135,7 @@ export declare const useDropdownStyle: (props: Props) => {
135
135
  flexDirection: "row";
136
136
  paddingHorizontal: number;
137
137
  };
138
- };
138
+ }>;
139
139
  colors: {
140
140
  blue: string;
141
141
  gray: string;
@@ -1,16 +1,13 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.useDropdownStyle = void 0;
4
- const style_1 = require("../../style");
5
- const react_1 = require("react");
6
- const react_native_1 = require("react-native");
7
- const useOrientation_1 = require("./hooks/useOrientation");
8
- const useDropdownStyle = (props) => {
9
- const { ...colors } = style_1.LIGHT_COLORS;
10
- const orientation = (0, useOrientation_1.useDeviceOrientation)();
1
+ import { SPACING, LIGHT_COLORS, SCREEN_WIDTH, DEFAULT_COLORS, } from '../../style';
2
+ import { useMemo } from 'react';
3
+ import { I18nManager, StyleSheet } from 'react-native';
4
+ import { useDeviceOrientation } from './hooks/useOrientation';
5
+ export const useDropdownStyle = (props) => {
6
+ const { ...colors } = LIGHT_COLORS;
7
+ const orientation = useDeviceOrientation();
11
8
  const { size = 16, radioIconColor, checkIconColor } = props;
12
- const styles = (0, react_1.useMemo)(() => {
13
- return react_native_1.StyleSheet.create({
9
+ const styles = useMemo(() => {
10
+ return StyleSheet.create({
14
11
  mainContainer: {
15
12
  width: '100%',
16
13
  },
@@ -49,13 +46,13 @@ const useDropdownStyle = (props) => {
49
46
  maxHeight: 170,
50
47
  alignItems: 'center',
51
48
  justifyContent: 'space-between',
52
- flexDirection: react_native_1.I18nManager.isRTL ? 'row-reverse' : 'row',
49
+ flexDirection: I18nManager.isRTL ? 'row-reverse' : 'row',
53
50
  },
54
51
  title: {
55
52
  fontSize: 16,
56
53
  color: colors.gray,
57
- marginVertical: style_1.SPACING.s6,
58
- writingDirection: react_native_1.I18nManager.isRTL ? 'rtl' : 'ltr',
54
+ marginVertical: SPACING.s6,
55
+ writingDirection: I18nManager.isRTL ? 'rtl' : 'ltr',
59
56
  },
60
57
  item: {
61
58
  padding: 17,
@@ -63,13 +60,13 @@ const useDropdownStyle = (props) => {
63
60
  borderBottomWidth: 0.5,
64
61
  borderColor: colors.lightGray,
65
62
  justifyContent: 'space-between',
66
- flexDirection: react_native_1.I18nManager.isRTL ? 'row-reverse' : 'row',
63
+ flexDirection: I18nManager.isRTL ? 'row-reverse' : 'row',
67
64
  },
68
65
  textItem: {
69
66
  flex: 1,
70
67
  fontSize: 16,
71
68
  color: colors.gray,
72
- writingDirection: react_native_1.I18nManager.isRTL ? 'rtl' : 'ltr',
69
+ writingDirection: I18nManager.isRTL ? 'rtl' : 'ltr',
73
70
  },
74
71
  icon: {
75
72
  width: 20,
@@ -80,16 +77,16 @@ const useDropdownStyle = (props) => {
80
77
  height: 45,
81
78
  borderWidth: 0.5,
82
79
  borderColor: '#DDDDDD',
83
- marginBottom: style_1.SPACING.s8,
84
- paddingHorizontal: style_1.SPACING.s8,
80
+ marginBottom: SPACING.s8,
81
+ paddingHorizontal: SPACING.s8,
85
82
  },
86
83
  fullScreen: {
87
84
  alignItems: 'center',
88
85
  justifyContent: 'center',
89
86
  },
90
87
  labelContainer: {
91
- marginBottom: style_1.SPACING.s6,
92
- paddingVertical: style_1.SPACING.s6,
88
+ marginBottom: SPACING.s6,
89
+ paddingVertical: SPACING.s6,
93
90
  },
94
91
  labelTextStyle: {
95
92
  color: colors.gray,
@@ -112,12 +109,12 @@ const useDropdownStyle = (props) => {
112
109
  backgroundColor: radioIconColor || colors.gray,
113
110
  },
114
111
  styleHorizontal: {
115
- width: orientation === 'LANDSCAPE' ? style_1.SCREEN_WIDTH / 2 : '100%',
112
+ width: orientation === 'LANDSCAPE' ? SCREEN_WIDTH / 2 : '100%',
116
113
  alignSelf: 'center',
117
114
  },
118
115
  styleContainerVertical: {
119
116
  alignItems: 'center',
120
- backgroundColor: style_1.DEFAULT_COLORS.blackOpacity,
117
+ backgroundColor: DEFAULT_COLORS.blackOpacity,
121
118
  },
122
119
  checkContainer: {
123
120
  borderWidth: 2,
@@ -147,4 +144,3 @@ const useDropdownStyle = (props) => {
147
144
  colors,
148
145
  };
149
146
  };
150
- exports.useDropdownStyle = useDropdownStyle;
@@ -1,23 +1,18 @@
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"));
1
+ import { View } from 'react-native';
2
+ import useChipStyle from './ChipStyle';
3
+ import AppText from '../../../text/AppText';
4
+ import { ClearIcon } from '../../../../assets/svg';
5
+ import SvgButton from '../../../svgButton/SvgButton';
11
6
  const Chip = (props) => {
12
- const { styles, colors } = (0, ChipStyle_1.default)({ ...props });
7
+ const { styles, colors } = useChipStyle({ ...props });
13
8
  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'}>
9
+ return (<View style={styles.box}>
10
+ <AppText size={12} fontFamily={'semiBold'} style={styles.chipText} color={textColor ? textColor : 'gray'}>
16
11
  {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>);
12
+ </AppText>
13
+ {clearIcon ? (clearIcon) : (<View style={styles.clearContainer}>
14
+ <SvgButton icon={<ClearIcon size={8} color={textColor ? textColor : colors.white}/>} onPress={onClearPress} style={styles.clearIcon}/>
15
+ </View>)}
16
+ </View>);
22
17
  };
23
- exports.default = Chip;
18
+ export default Chip;