@codeleap/mobile 2.3.16 → 2.3.20

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 (89) hide show
  1. package/dist/components/AutoComplete/index.d.ts +1 -0
  2. package/dist/components/AutoComplete/index.js +2 -1
  3. package/dist/components/AutoComplete/index.js.map +1 -1
  4. package/dist/components/AutoComplete/styles.js +67 -3
  5. package/dist/components/AutoComplete/styles.js.map +1 -1
  6. package/dist/components/Checkbox/index.d.ts +1 -1
  7. package/dist/components/EmptyPlaceholder/index.d.ts +5 -2
  8. package/dist/components/EmptyPlaceholder/index.js +19 -5
  9. package/dist/components/EmptyPlaceholder/index.js.map +1 -1
  10. package/dist/components/EmptyPlaceholder/styles.d.ts +1 -1
  11. package/dist/components/EmptyPlaceholder/styles.js +5 -7
  12. package/dist/components/EmptyPlaceholder/styles.js.map +1 -1
  13. package/dist/components/Grid/styles.d.ts +49 -0
  14. package/dist/components/Image/index.d.ts +1 -0
  15. package/dist/components/Image/index.js +21 -3
  16. package/dist/components/Image/index.js.map +1 -1
  17. package/dist/components/List/styles.d.ts +49 -0
  18. package/dist/components/List/styles.js +5 -4
  19. package/dist/components/List/styles.js.map +1 -1
  20. package/dist/components/Modal/index.d.ts +2 -0
  21. package/dist/components/Modal/index.js +11 -9
  22. package/dist/components/Modal/index.js.map +1 -1
  23. package/dist/components/Modal/styles.d.ts +2 -2
  24. package/dist/components/Modal/styles.js +18 -19
  25. package/dist/components/Modal/styles.js.map +1 -1
  26. package/dist/components/MultiSelect/index.js +7 -5
  27. package/dist/components/MultiSelect/index.js.map +1 -1
  28. package/dist/components/MultiSelect/styles.d.ts +0 -51
  29. package/dist/components/MultiSelect/styles.js +67 -5
  30. package/dist/components/MultiSelect/styles.js.map +1 -1
  31. package/dist/components/MultiSelect/types.d.ts +8 -1
  32. package/dist/components/Scroll/styles.d.ts +49 -0
  33. package/dist/components/Scroll/styles.js +3 -4
  34. package/dist/components/Scroll/styles.js.map +1 -1
  35. package/dist/components/SegmentedControl/index.js +5 -4
  36. package/dist/components/SegmentedControl/index.js.map +1 -1
  37. package/dist/components/SegmentedControl/styles.d.ts +1 -1
  38. package/dist/components/SegmentedControl/styles.js +9 -9
  39. package/dist/components/SegmentedControl/styles.js.map +1 -1
  40. package/dist/components/Select/index.d.ts +4 -1
  41. package/dist/components/Select/index.js +16 -21
  42. package/dist/components/Select/index.js.map +1 -1
  43. package/dist/components/Select/styles.d.ts +54 -53
  44. package/dist/components/Select/styles.js +61 -10
  45. package/dist/components/Select/styles.js.map +1 -1
  46. package/dist/components/Select/types.d.ts +8 -1
  47. package/dist/components/TextInput/index.js +4 -1
  48. package/dist/components/TextInput/index.js.map +1 -1
  49. package/dist/components/Touchable/index.js +5 -1
  50. package/dist/components/Touchable/index.js.map +1 -1
  51. package/dist/components/View/index.js +19 -13
  52. package/dist/components/View/index.js.map +1 -1
  53. package/dist/components/defaultStyles.d.ts +147 -51
  54. package/dist/utils/KeyboardAware/context.js +1 -6
  55. package/dist/utils/KeyboardAware/context.js.map +1 -1
  56. package/dist/utils/PermissionManager/context.js +3 -2
  57. package/dist/utils/PermissionManager/context.js.map +1 -1
  58. package/dist/utils/hooks.d.ts +2 -0
  59. package/dist/utils/hooks.js +44 -1
  60. package/dist/utils/hooks.js.map +1 -1
  61. package/dist/utils/theme.js +3 -3
  62. package/dist/utils/theme.js.map +1 -1
  63. package/package.json +3 -2
  64. package/src/components/AutoComplete/index.tsx +5 -1
  65. package/src/components/AutoComplete/styles.ts +112 -6
  66. package/src/components/Calendar/types.ts +71 -71
  67. package/src/components/EmptyPlaceholder/index.tsx +32 -8
  68. package/src/components/EmptyPlaceholder/styles.ts +18 -15
  69. package/src/components/Image/index.tsx +33 -3
  70. package/src/components/List/styles.ts +7 -1
  71. package/src/components/Modal/index.tsx +12 -7
  72. package/src/components/Modal/styles.ts +36 -46
  73. package/src/components/MultiSelect/index.tsx +10 -4
  74. package/src/components/MultiSelect/styles.ts +117 -4
  75. package/src/components/MultiSelect/types.ts +8 -0
  76. package/src/components/Scroll/styles.ts +4 -1
  77. package/src/components/SegmentedControl/index.tsx +5 -4
  78. package/src/components/SegmentedControl/styles.ts +13 -10
  79. package/src/components/Select/index.tsx +50 -27
  80. package/src/components/Select/styles.ts +103 -25
  81. package/src/components/Select/types.ts +11 -1
  82. package/src/components/TextInput/index.tsx +3 -1
  83. package/src/components/Touchable/index.tsx +5 -3
  84. package/src/components/View/index.tsx +25 -13
  85. package/src/utils/KeyboardAware/context.tsx +2 -7
  86. package/src/utils/KeyboardAware/lib/KeyboardAwareInterface.ts +3 -3
  87. package/src/utils/PermissionManager/context.tsx +1 -1
  88. package/src/utils/hooks.ts +50 -0
  89. package/src/utils/theme.ts +1 -1
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  assignTextStyle,
3
- ButtonComposition,
4
3
  createDefaultVariantFactory,
5
4
  includePresets,
6
5
  } from '@codeleap/common'
6
+ import { ActionIconComposition } from '../ActionIcon'
7
7
 
8
8
  export type AnimatableParts = 'box' | 'backdrop'
9
9
 
@@ -11,7 +11,6 @@ export type ModalParts =
11
11
  | AnimatableParts
12
12
  | 'wrapper'
13
13
  | 'innerWrapper'
14
-
15
14
  | 'scrollContent'
16
15
  | 'scroll'
17
16
  | 'body'
@@ -19,7 +18,7 @@ export type ModalParts =
19
18
  | 'header'
20
19
  | 'backdropTouchable'
21
20
  | 'title'
22
- | `closeButton${Capitalize<ButtonComposition>}`
21
+ | `closeButton${Capitalize<ActionIconComposition>}`
23
22
 
24
23
  export type ModalComposition =
25
24
  | ModalParts
@@ -32,26 +31,14 @@ const createModalStyle = createDefaultVariantFactory<ModalComposition>()
32
31
  const presets = includePresets((style) => createModalStyle(() => ({ body: style })))
33
32
 
34
33
  export const ModalStyles = {
35
-
36
34
  ...presets,
37
35
  default: createModalStyle((theme) => {
38
- const fullSize = {
39
- ...theme.presets.whole,
40
- position: 'absolute',
41
- width: theme.values.width,
42
- height: theme.values.height,
43
- maxHeight: theme.values.height,
44
- }
45
-
46
36
  return {
47
37
  wrapper: {
48
- zIndex: 1,
49
- height: theme.values.height,
50
- width: theme.values.width,
51
- ...theme.presets.whole,
52
- position: 'absolute',
53
- ...theme.presets.safeAreaTop(),
54
- paddingBottom: theme.values.bottomNavHeight,
38
+ ...theme.presets.absolute,
39
+ // ...theme.presets.whole,
40
+ ...theme.presets.fullHeight,
41
+ ...theme.presets.fullWidth,
55
42
  },
56
43
  'box:transition': {
57
44
  scale: {
@@ -70,12 +57,17 @@ export const ModalStyles = {
70
57
  },
71
58
  },
72
59
  backdrop: {
60
+ ...theme.presets.absolute,
61
+ ...theme.presets.whole,
73
62
 
74
63
  backgroundColor: theme.colors.black,
75
- ...fullSize,
64
+
76
65
  },
77
66
  backdropTouchable: {
78
- ...fullSize,
67
+ // height: '100%',
68
+ ...theme.presets.absolute,
69
+ ...theme.presets.whole,
70
+
79
71
  },
80
72
  'backdrop:visible': {
81
73
  opacity: 0.5,
@@ -84,28 +76,25 @@ export const ModalStyles = {
84
76
  opacity: 0,
85
77
  },
86
78
  innerWrapper: {
87
- ...theme.presets.alignCenter,
88
- ...theme.presets.justifyCenter,
89
- width: theme.values.width,
90
- flex: 1,
79
+
91
80
  },
92
81
  scroll: {
93
- width: theme.values.width,
94
- height: theme.values.window.height,
95
- maxHeight: theme.values.window.height,
82
+ flex: 1,
83
+ // maxHeight: theme.values.height,
96
84
  },
97
85
  scrollContent: {
98
86
  ...theme.presets.alignCenter,
99
87
  ...theme.presets.justifyCenter,
100
- ...theme.spacing.paddingVertical(2),
101
- ...theme.presets.fullWidth,
102
- flex: 1,
88
+ flexGrow: 1,
89
+ ...theme.presets.safeAreaTop(theme.values.innerSpacing.Y),
90
+ ...theme.presets.safeAreaBottom(theme.values.innerSpacing.Y),
103
91
  },
104
92
  box: {
105
- width: '80%',
106
93
  backgroundColor: theme.colors.background,
107
- borderRadius: theme.borderRadius.medium,
108
- ...theme.spacing.padding(2),
94
+ width: theme.values.width - theme.spacing.value(theme.values.innerSpacing.X * 2),
95
+ borderRadius: theme.borderRadius.modalOuter,
96
+ ...theme.spacing.paddingHorizontal(theme.values.innerSpacing.X),
97
+ ...theme.spacing.paddingVertical(theme.values.innerSpacing.Y),
109
98
  },
110
99
 
111
100
  'box:hidden': {
@@ -121,33 +110,34 @@ export const ModalStyles = {
121
110
  flexDirection: 'row',
122
111
  ...theme.presets.justifySpaceBetween,
123
112
  ...theme.presets.alignCenter,
113
+ ...theme.presets.alignSelfStretch,
114
+ ...theme.spacing.marginBottom(1),
124
115
  },
125
- closeButtonWrapper: {
116
+ closeButtonTouchableWrapper: {
126
117
  alignSelf: 'center',
127
118
  ...theme.spacing.marginLeft('auto'),
128
119
  },
120
+ closeButtonIcon: {
121
+ color: theme.colors.text,
122
+ },
129
123
  title: {
130
- ...theme.presets.textCenter,
131
124
  ...assignTextStyle('h3')(theme).text,
132
- ...theme.spacing.paddingBottom(1),
133
- flex: 1,
134
125
  },
135
126
  }
136
127
  }),
137
128
  popup: createModalStyle(() => ({})),
138
129
  fullscreen: createModalStyle((theme) => ({
139
- overlay: {
140
- backgroundColor: theme.colors.background,
141
- },
142
- 'overlay:visible': {
143
- opacity: 1,
130
+ scrollContent: {
131
+ paddingTop: 0,
132
+ paddingBottom: 0,
144
133
  },
145
134
  box: {
146
- flex: 1,
135
+ width: '100%',
136
+ flexGrow: 1,
147
137
  borderRadius: 0,
148
- width: theme.values.width,
149
- height: theme.values.window.height,
150
138
  ...theme.presets.center,
139
+ ...theme.presets.safeAreaTop(theme.values.innerSpacing.Y),
140
+ ...theme.presets.safeAreaBottom(theme.values.innerSpacing.Y),
151
141
  },
152
142
  })),
153
143
  }
@@ -32,6 +32,7 @@ export const MultiSelect = <T extends string|number = string>(selectProps:MultiS
32
32
  clearIconName = 'close',
33
33
  limit = null,
34
34
  validate = null,
35
+ itemProps = {},
35
36
  ...drawerProps
36
37
  } = selectProps
37
38
 
@@ -81,6 +82,8 @@ export const MultiSelect = <T extends string|number = string>(selectProps:MultiS
81
82
  onPress={() => select(item.value)}
82
83
  styles={variantStyles}
83
84
  icon={selectedIcon as IconPlaceholder}
85
+ {...itemProps}
86
+
84
87
  />
85
88
  }
86
89
 
@@ -123,16 +126,19 @@ export const MultiSelect = <T extends string|number = string>(selectProps:MultiS
123
126
  )
124
127
  }
125
128
 
126
- <ModalManager.Drawer scroll={false} title={label} {...drawerProps} styles={variantStyles}>
129
+ <ModalManager.Modal title={label} {...drawerProps} styles={variantStyles} id={null}>
127
130
  <List<MultiSelectProps<any>['options']>
128
131
  data={options}
129
- style={variantStyles.list}
130
- contentContainerStyle={variantStyles.listContent}
132
+ styles={getNestedStylesByKey('list', variantStyles)}
131
133
  keyExtractor={(i) => i.value}
134
+ separators
135
+ keyboardAware={{
136
+ enabled: false,
137
+ }}
132
138
  renderItem={renderListItem}
133
139
  {...listProps}
134
140
  />
135
- </ModalManager.Drawer>
141
+ </ModalManager.Modal>
136
142
 
137
143
  </>
138
144
  }
@@ -1,4 +1,4 @@
1
- import { createDefaultVariantFactory } from '@codeleap/common'
1
+ import { assignTextStyle, createDefaultVariantFactory } from '@codeleap/common'
2
2
  import { SelectComposition, SelectStyles } from '../Select'
3
3
  type ItemStates = '' | ':selected'
4
4
  export type MultiSelectComposition =
@@ -7,11 +7,124 @@ export type MultiSelectComposition =
7
7
  const createMultiSelectStyle = createDefaultVariantFactory<MultiSelectComposition>()
8
8
 
9
9
  export const MultiSelectStyles = {
10
- ...SelectStyles,
11
10
  default: createMultiSelectStyle((theme) => {
12
- const defaultStyle = SelectStyles.default(theme)
13
11
  return {
14
- ...defaultStyle,
12
+ wrapper: {
13
+ ...theme.presets.absolute,
14
+ // ...theme.presets.whole,
15
+ ...theme.presets.fullHeight,
16
+ ...theme.presets.fullWidth,
17
+ },
18
+ 'box:transition': {
19
+ scale: {
20
+ duration: theme.values.transitions.modal.duration,
21
+ type: 'timing',
22
+ },
23
+ opacity: {
24
+ duration: theme.values.transitions.modal.duration,
25
+ type: 'timing',
26
+ },
27
+ },
28
+ 'backdrop:transition': {
29
+ opacity: {
30
+ duration: theme.values.transitions.modal.duration,
31
+ type: 'timing',
32
+ },
33
+ },
34
+ backdrop: {
35
+ ...theme.presets.absolute,
36
+ ...theme.presets.whole,
37
+
38
+ backgroundColor: theme.colors.black,
39
+
40
+ },
41
+ backdropTouchable: {
42
+ // height: '100%',
43
+ ...theme.presets.absolute,
44
+ ...theme.presets.whole,
45
+
46
+ },
47
+ 'backdrop:visible': {
48
+ opacity: 0.5,
49
+ },
50
+ 'backdrop:hidden': {
51
+ opacity: 0,
52
+ },
53
+ innerWrapper: {
54
+
55
+ },
56
+ scroll: {
57
+ flex: 1,
58
+ // maxHeight: theme.values.height,
59
+ },
60
+ scrollContent: {
61
+ ...theme.presets.alignCenter,
62
+ ...theme.presets.justifyCenter,
63
+ minHeight: '100%',
64
+ ...theme.presets.safeAreaTop(theme.values.innerSpacing.Y),
65
+ ...theme.presets.safeAreaBottom(theme.values.innerSpacing.Y),
66
+ },
67
+ box: {
68
+ backgroundColor: theme.colors.background,
69
+ width: theme.values.width - theme.spacing.value(theme.values.innerSpacing.X * 2),
70
+ borderRadius: theme.borderRadius.modalOuter,
71
+ ...theme.spacing.paddingHorizontal(theme.values.innerSpacing.X),
72
+ ...theme.spacing.paddingVertical(theme.values.innerSpacing.Y),
73
+ },
74
+
75
+ 'box:hidden': {
76
+ opacity: 0,
77
+ scale: 0.8,
78
+
79
+ },
80
+ 'box:visible': {
81
+ opacity: 1,
82
+ scale: 1,
83
+ },
84
+ header: {
85
+ flexDirection: 'row',
86
+ ...theme.presets.justifySpaceBetween,
87
+ ...theme.presets.alignCenter,
88
+ },
89
+ closeButtonTouchableWrapper: {
90
+ alignSelf: 'center',
91
+ ...theme.spacing.marginLeft('auto'),
92
+ },
93
+ closeButtonIcon: {
94
+ color: theme.colors.text,
95
+ },
96
+ title: {
97
+ ...assignTextStyle('h3')(theme).text,
98
+ },
99
+ listWrapper: {
100
+ height: 'auto',
101
+ },
102
+
103
+ itemWrapper: {
104
+ ...theme.presets.row,
105
+ ...theme.presets.justifySpaceBetween,
106
+ ...theme.presets.alignCenter,
107
+ borderRadius: theme.borderRadius.medium,
108
+ ...theme.spacing.padding(1),
109
+ backgroundColor: theme.colors.backgroundSecondary,
110
+ },
111
+ 'itemWrapper:selected': {
112
+ backgroundColor: theme.colors.primary,
113
+ },
114
+ 'itemIcon:selected': {
115
+ color: theme.colors.backgroundSecondary,
116
+ ...theme.sized(2),
117
+
118
+ },
119
+ 'itemText:selected': {
120
+ color: theme.colors.backgroundSecondary,
121
+
122
+ },
123
+ itemIcon: {
124
+ height: 0,
125
+ width: 0,
126
+
127
+ },
15
128
 
16
129
  }
17
130
  }),
@@ -2,11 +2,15 @@ import {
2
2
  ComponentVariants,
3
3
  FormTypes,
4
4
  IconPlaceholder,
5
+ PropsOf,
5
6
  } from '@codeleap/common'
6
7
  import { StylesOf } from '../../types/utility'
7
8
  import { DrawerProps } from '../Drawer'
9
+ import { Icon } from '../Icon'
8
10
  import { FlatListProps } from '../List'
11
+ import { Text } from '../Text'
9
12
  import { TextInputProps } from '../TextInput'
13
+ import { Touchable } from '../Touchable'
10
14
  import { MultiSelectComposition, MultiSelectStyles } from './styles'
11
15
 
12
16
  export type MultiSelectRenderFNProps<T> = {
@@ -15,6 +19,9 @@ export type MultiSelectRenderFNProps<T> = {
15
19
  isSelected?: boolean
16
20
  item: FormTypes.Options<T>[number]
17
21
  icon?: IconPlaceholder
22
+ touchableProps?: Partial<PropsOf<typeof Touchable>>
23
+ textProps?: Partial<PropsOf<typeof Text>>
24
+ iconProps?: Partial<PropsOf<typeof Icon>>
18
25
  }
19
26
 
20
27
  export type MultiSelectRenderFN<T> = (props: MultiSelectRenderFNProps<T>) => JSX.Element
@@ -39,5 +46,6 @@ export type MultiSelectProps<T> = MultiSelectDrawerProps & {
39
46
  clearable?: boolean
40
47
  clearIconName?: IconPlaceholder
41
48
  validate?: TextInputProps['validate']
49
+ itemProps?: Partial<Pick<MultiSelectRenderFNProps<any>, 'iconProps'|'textProps'|'touchableProps'>>
42
50
  } & ComponentVariants<typeof MultiSelectStyles>
43
51
 
@@ -1,10 +1,13 @@
1
- import { createDefaultVariantFactory } from '@codeleap/common'
1
+ import { createDefaultVariantFactory, includePresets } from '@codeleap/common'
2
2
 
3
3
  export type ScrollComposition = 'wrapper' |'content' | 'refreshControl'
4
4
 
5
5
  const createScrollStyle = createDefaultVariantFactory<ScrollComposition>()
6
6
 
7
+ const presets = includePresets(style => createScrollStyle(() => ({ content: style })))
8
+
7
9
  export const ScrollStyles = {
10
+ ...presets,
8
11
  default: createScrollStyle((theme) => {
9
12
  return {
10
13
  wrapper: {
@@ -69,6 +69,7 @@ const _SegmentedControl = React.forwardRef<SegmentedControlRef, SegmentedControl
69
69
  styles,
70
70
  transform: StyleSheet.flatten,
71
71
  variants,
72
+ rootElement: 'scroll',
72
73
  })
73
74
 
74
75
  const scrollRef = useRef<KeyboardAwareScrollViewTypes.KeyboardAwareScrollView>(null)
@@ -123,7 +124,7 @@ const _SegmentedControl = React.forwardRef<SegmentedControlRef, SegmentedControl
123
124
  _animation = JSON.parse(JSON.stringify(_animation))
124
125
 
125
126
  const labelStyles = getNestedStylesByKey('label', variantStyles)
126
- return (<>
127
+ return (<View style={variantStyles.wrapper}>
127
128
  <InputLabel label={label} styles={labelStyles} required={false}/>
128
129
  <Scroll
129
130
  horizontal
@@ -136,7 +137,7 @@ const _SegmentedControl = React.forwardRef<SegmentedControlRef, SegmentedControl
136
137
  }}
137
138
  ref={scrollRef}
138
139
  >
139
- <View style={variantStyles.wrapper}>
140
+ <View style={variantStyles.innerWrapper}>
140
141
  <AnimatedView
141
142
  options={options}
142
143
  styles={variantStyles}
@@ -158,7 +159,7 @@ const _SegmentedControl = React.forwardRef<SegmentedControlRef, SegmentedControl
158
159
  key: idx,
159
160
  debugName: `Segmented Control ${debugName}, option ${o.label}`,
160
161
  onPress: onPress(o.value, idx),
161
- style: [widthStyle, variantStyles.button],
162
+ style: [widthStyle, variantStyles.button, selected && variantStyles['button:selected']],
162
163
  ...props.touchableProps,
163
164
 
164
165
  }
@@ -194,7 +195,7 @@ const _SegmentedControl = React.forwardRef<SegmentedControlRef, SegmentedControl
194
195
  })}
195
196
  </View>
196
197
  </Scroll>
197
- </>
198
+ </View>
198
199
  )
199
200
 
200
201
  })
@@ -7,6 +7,7 @@ export type SegmentedControlStates = 'selected'
7
7
  export type SegmentedControlComposition =
8
8
  'selectedBubble' |
9
9
  'wrapper' |
10
+ 'innerWrapper' |
10
11
  'scroll' |
11
12
  'scrollContent' |
12
13
  'text' |
@@ -28,7 +29,7 @@ SegmentedControlComposition,
28
29
  SegmentedControlStylesGen
29
30
  >()
30
31
 
31
- const presets = includePresets((style) => createSegmentedControlStyle(() => ({ scrollContent: style })))
32
+ const presets = includePresets((style) => createSegmentedControlStyle(() => ({ wrapper: style })))
32
33
 
33
34
  export const SegmentedControlStyles = {
34
35
  ...presets,
@@ -45,22 +46,25 @@ export const SegmentedControlStyles = {
45
46
  'text:selected': {
46
47
  color: theme.colors.white,
47
48
  },
49
+ wrapper: {
50
+ height: 'auto',
51
+ },
48
52
  scroll: {
49
53
  height: theme.values.buttons.default.height,
50
- // borderRadius: Theme.borderRadius.large,
54
+ maxHeight: theme.values.buttons.default.height,
51
55
  },
52
56
  scrollContent: {
53
- // borderRadius: Theme.borderRadius.large,
54
57
  ...theme.presets.row,
55
- ...theme.spacing.paddingHorizontal(2),
56
58
  ...theme.presets.alignStretch,
59
+ height: theme.values.buttons.default.height,
60
+
57
61
  },
58
62
  button: {
59
63
  backgroundColor: 'transparent',
60
64
  ...theme.presets.alignCenter,
61
65
  ...theme.presets.justifyCenter,
62
66
 
63
- borderRadius: theme.borderRadius.large,
67
+ borderRadius: theme.borderRadius.medium,
64
68
  ...theme.spacing.padding(1),
65
69
  minHeight: '100%',
66
70
 
@@ -69,18 +73,17 @@ export const SegmentedControlStyles = {
69
73
  position: 'absolute',
70
74
  zIndex: -1,
71
75
  ...theme.spacing.padding(2),
72
- // maxHeight: 50,
73
- // minHeight: 50,
74
76
  top: 0,
75
77
  bottom: 0,
76
- borderRadius: theme.borderRadius.large,
78
+ borderRadius: theme.borderRadius.medium,
77
79
  backgroundColor: theme.colors.primary,
78
80
  },
79
- wrapper: {
80
- borderRadius: theme.borderRadius.large,
81
+ innerWrapper: {
82
+ borderRadius: theme.borderRadius.medium,
81
83
  backgroundColor: theme.colors.backgroundSecondary,
82
84
  ...theme.presets.row,
83
85
  position: 'relative',
86
+ height: theme.values.buttons.default.height,
84
87
  },
85
88
 
86
89
  }
@@ -2,7 +2,7 @@ import { IconPlaceholder,
2
2
  getNestedStylesByKey,
3
3
  useDefaultComponentStyle,
4
4
  TypeGuards } from '@codeleap/common'
5
- import React, { useMemo } from 'react'
5
+ import React, { useCallback, useMemo } from 'react'
6
6
  import { StyleSheet } from 'react-native'
7
7
  import { List } from '../List'
8
8
  import { Text } from '../Text'
@@ -13,16 +13,39 @@ import { CustomSelectProps } from './types'
13
13
  import { ModalManager } from '../../utils'
14
14
  import { Icon } from '../Icon'
15
15
 
16
- export const SelectItem = ({ item, icon = null, isSelected, styles, onPress }) => {
17
- return <Touchable style={[
18
- styles.itemWrapper,
19
- isSelected && styles['itemWrapper:selected'],
20
- ]} onPress={onPress} debugName={`Select ${item.value}`}>
21
- <Text text={item.label} style={[
22
- styles.itemText,
23
- isSelected && styles['itemText:selected'],
24
- ]}/>
25
- {icon ? <Icon name={icon} style={[styles?.itemIcon, isSelected && styles?.['itemIcon:selected']]}/> : null}
16
+ export const SelectItem = ({
17
+ item,
18
+ icon = null,
19
+ isSelected,
20
+ styles,
21
+ onPress,
22
+ iconProps = {},
23
+ textProps = {},
24
+ ...touchableProps
25
+ }) => {
26
+ return <Touchable
27
+ style={[
28
+ styles.itemWrapper,
29
+ isSelected && styles['itemWrapper:selected'],
30
+ ]}
31
+ onPress={onPress}
32
+ debugName={`Select ${item.value}`}
33
+ debounce={null}
34
+ {...touchableProps}
35
+ >
36
+ <Text
37
+ text={item.label}
38
+ style={[
39
+ styles.itemText,
40
+ isSelected && styles['itemText:selected'],
41
+ ]}
42
+ {...textProps}
43
+ />
44
+ {icon ? <Icon
45
+ name={icon}
46
+ style={[styles?.itemIcon, isSelected && styles?.['itemIcon:selected']]}
47
+ {...iconProps}
48
+ /> : null}
26
49
  </Touchable>
27
50
  }
28
51
 
@@ -46,7 +69,7 @@ export const Select = <T extends string|number = string>(selectProps:CustomSelec
46
69
  selectedIcon = 'selectMarker',
47
70
  inputProps = {},
48
71
  hideInput = false,
49
-
72
+ itemProps = {},
50
73
  ...drawerProps
51
74
  } = selectProps
52
75
 
@@ -81,15 +104,17 @@ export const Select = <T extends string|number = string>(selectProps:CustomSelec
81
104
  }, [value, placeholder, options])
82
105
  const Item = renderItem || SelectItem
83
106
 
84
- const renderListItem = ({ item }) => {
107
+ const renderListItem = useCallback(({ item }) => {
108
+
85
109
  return <Item
86
110
  isSelected={value === item.value}
87
111
  item={item}
88
112
  onPress={() => select(item.value)}
89
113
  icon={selectedIcon}
90
114
  styles={variantStyles}
115
+ {...itemProps}
91
116
  />
92
- }
117
+ }, [value, select])
93
118
  const isEmpty = TypeGuards.isNil(value)
94
119
  const showClearIcon = !isEmpty && clearable
95
120
 
@@ -132,33 +157,31 @@ export const Select = <T extends string|number = string>(selectProps:CustomSelec
132
157
  )
133
158
  }
134
159
 
135
- <ModalManager.Drawer
136
- scroll={false}
160
+ <ModalManager.Modal
137
161
  title={label}
138
162
  keyboardAware={{
139
- baseStyleProp: 'style',
140
- adapt: 'paddingBottom',
141
- enabled: true,
142
- enableOnAndroid: true,
163
+
164
+ enabled: false,
143
165
  }}
144
166
  {...drawerProps}
145
167
  styles={variantStyles}
168
+ id={null}
146
169
  >
147
170
  <List<CustomSelectProps<any>['options']>
148
171
  data={options}
149
- style={variantStyles.list}
150
- contentContainerStyle={variantStyles.listContent}
172
+ scrollEnabled={false}
173
+ showsHorizontalScrollIndicator={false}
174
+ styles={getNestedStylesByKey('list', variantStyles)}
151
175
  keyExtractor={(i) => i.value}
152
176
  renderItem={renderListItem}
153
177
  keyboardAware={{
154
- baseStyleProp: 'style',
155
- adapt: 'maxHeight',
156
- enabled: true,
157
- enableOnAndroid: true,
178
+ enabled: false,
179
+ enableOnAndroid: false,
158
180
  }}
181
+ separators
159
182
  {...listProps}
160
183
  />
161
- </ModalManager.Drawer>
184
+ </ModalManager.Modal>
162
185
 
163
186
  </>
164
187
  }