@codeleap/mobile 3.18.3 → 3.18.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codeleap/mobile",
3
- "version": "3.18.3",
3
+ "version": "3.18.6",
4
4
  "main": "src/index.ts",
5
5
  "license": "UNLICENSED",
6
6
  "repository": {
@@ -118,6 +118,7 @@ export const Select = <T extends string | number = string, Multi extends boolean
118
118
  visible: _visible,
119
119
  toggle: _toggle,
120
120
  ListHeaderComponent,
121
+ ListComponent = List,
121
122
  onLoadOptionsError,
122
123
  loadOptionsOnMount = defaultOptions.length === 0,
123
124
  loadOptionsOnOpen = false,
@@ -195,7 +196,7 @@ export const Select = <T extends string | number = string, Multi extends boolean
195
196
 
196
197
  const close = () => toggle?.()
197
198
 
198
- const select = (selectedValue) => {
199
+ const select = useCallback((selectedValue) => {
199
200
 
200
201
  let newValue = null
201
202
 
@@ -243,11 +244,11 @@ export const Select = <T extends string | number = string, Multi extends boolean
243
244
  close?.()
244
245
  }
245
246
 
246
- }
247
+ }, [isValueArray, ...(isValueArray ? value : [value]), limit, multiple])
247
248
 
248
249
  const Item = renderItem || Button
249
250
 
250
- const renderListItem = useCallback(({ item }) => {
251
+ const renderListItem = useCallback(({ item, index }) => {
251
252
 
252
253
  let selected = false
253
254
 
@@ -268,6 +269,7 @@ export const Select = <T extends string | number = string, Multi extends boolean
268
269
  // @ts-ignore
269
270
  rightIcon={selectedIcon}
270
271
  styles={itemStyles}
272
+ index={index}
271
273
  {...itemProps}
272
274
  />
273
275
  }, [value, select, multiple])
@@ -347,7 +349,7 @@ export const Select = <T extends string | number = string, Multi extends boolean
347
349
  toggle={toggle}
348
350
 
349
351
  >
350
- <List<SelectProps<any>['options']>
352
+ <ListComponent<SelectProps<any>['options']>
351
353
  data={searchable ? filteredOptions : options}
352
354
  scrollEnabled={false}
353
355
  showsHorizontalScrollIndicator={false}
@@ -23,6 +23,8 @@ export type SelectRenderFNProps<T> = {
23
23
  touchableProps?: Partial<PropsOf<typeof Touchable>>
24
24
  textProps?: Partial<PropsOf<typeof Text>>
25
25
  iconProps?: Partial<PropsOf<typeof Icon>>
26
+ index: number
27
+ debugName: string
26
28
  }
27
29
 
28
30
  export type SelectRenderFN<T> = (props: SelectRenderFNProps<T>) => JSX.Element
@@ -88,6 +90,7 @@ export type SelectProps<T = any, Multi extends boolean = false> = {
88
90
  searchable?: boolean
89
91
  limit?: number
90
92
  ListHeaderComponent?: React.ComponentType<SelectHeaderProps>
93
+ ListComponent?: React.ComponentType<any>
91
94
  searchInputProps?: Partial<SearchInputProps>
92
95
  loadOptionsOnMount?: boolean
93
96
  loadOptionsOnOpen?: boolean