@codeleap/mobile 3.1.1 → 3.2.1

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 (44) hide show
  1. package/package.json +5 -4
  2. package/src/components/ActionIcon/index.tsx +1 -1
  3. package/src/components/ActivityIndicator/index.tsx +13 -12
  4. package/src/components/Avatar/index.tsx +7 -7
  5. package/src/components/AvatarGroup/index.tsx +4 -6
  6. package/src/components/Badge/index.tsx +12 -12
  7. package/src/components/Button/index.tsx +2 -1
  8. package/src/components/DatePickerModal/index.tsx +4 -0
  9. package/src/components/DatePickerModal/types.ts +4 -1
  10. package/src/components/EmptyPlaceholder/index.tsx +3 -3
  11. package/src/components/FileInput/index.tsx +46 -16
  12. package/src/components/Icon/index.tsx +11 -12
  13. package/src/components/Image/index.tsx +17 -15
  14. package/src/components/ImageView/Spotlight.tsx +2 -2
  15. package/src/components/List/index.tsx +1 -1
  16. package/src/components/Modal/index.tsx +2 -2
  17. package/src/components/Navigation/constants.ts +19 -3
  18. package/src/components/Pager/index.tsx +7 -11
  19. package/src/components/RadioInput/index.tsx +1 -1
  20. package/src/components/RefreshControl/index.tsx +1 -1
  21. package/src/components/Scroll/index.tsx +7 -9
  22. package/src/components/Sections/index.tsx +8 -11
  23. package/src/components/SegmentedControl/Option.tsx +2 -2
  24. package/src/components/SegmentedControl/index.tsx +72 -33
  25. package/src/components/Select/index.tsx +2 -1
  26. package/src/components/Select/styles.ts +0 -1
  27. package/src/components/Select/types.ts +10 -4
  28. package/src/components/Slider/index.tsx +46 -50
  29. package/src/components/Switch/index.tsx +92 -98
  30. package/src/components/Text/index.tsx +8 -14
  31. package/src/components/TextInput/index.tsx +8 -2
  32. package/src/components/Touchable/index.tsx +13 -9
  33. package/src/components/View/index.tsx +17 -20
  34. package/src/components/components.ts +1 -1
  35. package/src/modules/reactNavigation.ts +1 -2
  36. package/src/modules/textInputMask.tsx +0 -6
  37. package/src/utils/theme.ts +1 -1
  38. package/src/modules/documentPicker.ts +0 -7
  39. package/src/modules/fastImage.ts +0 -2
  40. package/src/modules/imageCropPicker.d.ts +0 -497
  41. package/src/modules/index.d.ts +0 -682
  42. package/src/modules/rnDeviceInfo.ts +0 -6
  43. package/src/modules/types/documentPicker.d.ts +0 -215
  44. package/src/modules/types/fileTypes.ts +0 -138
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codeleap/mobile",
3
- "version": "3.1.1",
3
+ "version": "3.2.1",
4
4
  "main": "src/index.ts",
5
5
  "license": "UNLICENSED",
6
6
  "repository": {
@@ -9,7 +9,8 @@
9
9
  "directory": "packages/mobile"
10
10
  },
11
11
  "devDependencies": {
12
- "@codeleap/config": "*"
12
+ "@codeleap/config": "*",
13
+ "@types/react-native": "link:../../apps/mobile/node_modules/@types/react-native"
13
14
  },
14
15
  "scripts": {
15
16
  "build": "tsc --build",
@@ -32,16 +33,16 @@
32
33
  "react-native-fast-image": "8.6.3",
33
34
  "react-native-gesture-handler": "2.9.0",
34
35
  "react-native-image-crop-picker": "0.37.2",
36
+ "react-native-super-grid": "4.6.1",
35
37
  "react-native-image-viewing": "0.2.2",
36
38
  "react-native-keyboard-aware-scroll-view": "0.9.5",
37
- "typescript": "4.5.4"
39
+ "typescript": "5.0.4"
38
40
  },
39
41
  "dependencies": {
40
42
  "@gorhom/portal": "1.0.14",
41
43
  "@miblanchard/react-native-slider": "2.3.1",
42
44
  "date-fns": "^2.29.3",
43
45
  "react-native-masked-text": "1.13.0",
44
- "react-native-super-grid": "4.4.2",
45
46
  "react-native-uuid": "2.0.1"
46
47
  }
47
48
  }
@@ -14,7 +14,7 @@ export type ActionIconProps= {
14
14
  styles?: StylesOf<ActionIconComposition> | StylesOf<ActionIconComposition>[]
15
15
  } & Omit<TouchableProps, 'styles' | 'variants'> & ComponentVariants<typeof ActionIconPresets> & BadgeComponentProps
16
16
 
17
- export const ActionIcon:React.FC<ActionIconProps> = (props) => {
17
+ export const ActionIcon = (props: ActionIconProps) => {
18
18
  const { name, icon, iconProps, variants, styles, children, badge = false, badgeProps = {}, ...touchableProps } = props
19
19
  const variantStyles = useDefaultComponentStyle<'u:ActionIcon', typeof ActionIconPresets>('u:ActionIcon', {
20
20
  variants, styles, transform: StyleSheet.flatten,
@@ -7,7 +7,7 @@ import {
7
7
  ComponentVariants,
8
8
  useCodeleapContext,
9
9
  } from '@codeleap/common'
10
- import { StylesOf } from '../../types'
10
+ import { ComponentWithDefaultProps, StylesOf } from '../../types'
11
11
  import {
12
12
  ActivityIndicatorComposition,
13
13
  ActivityIndicatorPresets,
@@ -19,17 +19,19 @@ export type ActivityIndicatorProps =
19
19
  & {
20
20
  variants?: ComponentVariants<typeof ActivityIndicatorPresets>['variants']
21
21
  styles?: StylesOf<ActivityIndicatorComposition>
22
- component?: React.ComponentType<Omit<ActivityIndicatorProps & {ref?: React.Ref<Indicator>}, 'component'>>
22
+ component?: (props: Omit<ActivityIndicatorProps & {ref?: React.Ref<Indicator>}, 'component'>) => JSX.Element
23
23
  }
24
24
 
25
+ type TActivityIndicator = ComponentWithDefaultProps<ActivityIndicatorProps>
26
+
25
27
  export const ActivityIndicator = forwardRef<Indicator, ActivityIndicatorProps>(
26
28
  (activityIndicatorProps, ref) => {
27
- const {
28
- variants = [],
29
- style,
30
- styles: propStyles,
31
- component,
32
- ...props
29
+ const {
30
+ variants = [],
31
+ style = {},
32
+ styles: propStyles = {},
33
+ component = Indicator,
34
+ ...props
33
35
  } = {
34
36
  ...ActivityIndicator.defaultProps,
35
37
  ...activityIndicatorProps,
@@ -49,7 +51,6 @@ export const ActivityIndicator = forwardRef<Indicator, ActivityIndicatorProps>(
49
51
  const size = styles?.height || styles?.width || 'large'
50
52
 
51
53
  const Component = component
52
-
53
54
 
54
55
  return (
55
56
  <Component
@@ -62,8 +63,8 @@ export const ActivityIndicator = forwardRef<Indicator, ActivityIndicatorProps>(
62
63
  />
63
64
  )
64
65
  },
65
- )
66
+ ) as TActivityIndicator
66
67
 
67
68
  ActivityIndicator.defaultProps = {
68
- component: Indicator,
69
- }
69
+ component: forwardRef(({ size, color, style }, ref) => <Indicator size={size} color={color} style={style} ref={ref}/>),
70
+ }
@@ -33,7 +33,7 @@ export type AvatarProps = ComponentVariants<typeof AvatarPresets> & {
33
33
  noFeedback?: boolean
34
34
  } & BadgeComponentProps
35
35
 
36
- export const Avatar: React.FC<AvatarProps> = (props) => {
36
+ export const Avatar = (props:AvatarProps) => {
37
37
  const {
38
38
  debugName,
39
39
  name = '',
@@ -92,8 +92,8 @@ export const Avatar: React.FC<AvatarProps> = (props) => {
92
92
  onPress={() => onPress?.()}
93
93
  style={[
94
94
  variantStyles.touchable,
95
- !hasBackgroundColor && {
96
- backgroundColor: randomColor,
95
+ !hasBackgroundColor && {
96
+ backgroundColor: randomColor,
97
97
  },
98
98
  ]}
99
99
  noFeedback={noFeedback || !onPress}
@@ -110,10 +110,10 @@ export const Avatar: React.FC<AvatarProps> = (props) => {
110
110
  </Touchable>
111
111
 
112
112
  {badgeIcon && (
113
- <Touchable
114
- debugName={`${debugName} badge`}
115
- style={variantStyles.badgeIconWrapper}
116
- onPress={() => onPress?.()}
113
+ <Touchable
114
+ debugName={`${debugName} badge`}
115
+ style={variantStyles.badgeIconWrapper}
116
+ onPress={() => onPress?.()}
117
117
  noFeedback
118
118
  >
119
119
  <Icon name={badgeIcon} style={variantStyles.badgeIcon} />
@@ -22,9 +22,7 @@ const defaultProps:Partial<AvatarGroupProps> = {
22
22
  displacement: 20.5,
23
23
  }
24
24
 
25
-
26
-
27
- export const AvatarGroup: React.FC<AvatarGroupProps> = (props) => {
25
+ export const AvatarGroup = (props:AvatarGroupProps) => {
28
26
  const {
29
27
  variants = [],
30
28
  avatars = [],
@@ -35,7 +33,7 @@ export const AvatarGroup: React.FC<AvatarGroupProps> = (props) => {
35
33
  ...viewProps
36
34
  } = {
37
35
  ...defaultProps,
38
- ...props
36
+ ...props,
39
37
  }
40
38
 
41
39
  const variantStyles = useDefaultComponentStyle('u:AvatarGroup', {
@@ -58,7 +56,7 @@ export const AvatarGroup: React.FC<AvatarGroupProps> = (props) => {
58
56
  key={avatar.debugName || index}
59
57
  {...avatar}
60
58
  variants={avatar.variants || avatarVariants}
61
- style={getAvatarStyle(index,displacement)}
59
+ style={getAvatarStyle(index, displacement)}
62
60
  styles={avatarStyles}
63
61
  />
64
62
  ))}
@@ -68,7 +66,7 @@ export const AvatarGroup: React.FC<AvatarGroupProps> = (props) => {
68
66
 
69
67
  AvatarGroup.defaultProps = defaultProps
70
68
 
71
- const getAvatarStyle = (index: number,displacementPixels: number) => {
69
+ const getAvatarStyle = (index: number, displacementPixels: number) => {
72
70
  const displacement = index * 20.5
73
71
  return { right: `${displacement}%` }
74
72
  }
@@ -7,8 +7,8 @@ import { StyleSheet } from 'react-native'
7
7
 
8
8
  export * from './styles'
9
9
 
10
- export type BadgeProps = ComponentVariants<typeof BadgePresets>
11
- & ViewProps
10
+ export type BadgeProps = ComponentVariants<typeof BadgePresets>
11
+ & ViewProps
12
12
  & {
13
13
  styles?: StylesOf<BadgeComposition>
14
14
  maxCount?: number
@@ -106,7 +106,7 @@ export const Badge = (props: BadgeProps) => {
106
106
  let BadgeContent = renderBadgeContent
107
107
 
108
108
  if (TypeGuards.isNil(renderBadgeContent)) {
109
- BadgeContent = () => <Text text={content} {...textProps} style={countStyles} />
109
+ BadgeContent = () => <Text text={content} {...textProps} style={countStyles} />
110
110
  }
111
111
 
112
112
  return (
@@ -116,14 +116,14 @@ export const Badge = (props: BadgeProps) => {
116
116
  >
117
117
  <View {...innerWrapperProps} style={innerWrapperStyles}>
118
118
  {showContent
119
- ? <BadgeContent
120
- {...props}
121
- maxCount={maxCount}
122
- minCount={minCount}
123
- count={count}
124
- getBadgeContent={getBadgeContent}
125
- content={content}
126
- />
119
+ ? <BadgeContent
120
+ {...props}
121
+ maxCount={maxCount}
122
+ minCount={minCount}
123
+ count={count}
124
+ getBadgeContent={getBadgeContent}
125
+ content={content}
126
+ />
127
127
  : null
128
128
  }
129
129
  </View>
@@ -131,4 +131,4 @@ export const Badge = (props: BadgeProps) => {
131
131
  )
132
132
  }
133
133
 
134
- Badge.defaultProps = defaultProps
134
+ Badge.defaultProps = defaultProps
@@ -142,4 +142,5 @@ export const Button = forwardRef<GetRefType<TouchableProps['ref']>, ButtonProps>
142
142
  <Badge badge={badge} style={badgeStyles} {...badgeProps} />
143
143
  </Touchable>
144
144
  )
145
- })
145
+ }) as ((props: ButtonProps) => JSX.Element)
146
+
@@ -121,6 +121,8 @@ export const DatePickerModal = (props: DatePickerModalProps) => {
121
121
  description,
122
122
  showDoneButton,
123
123
  style,
124
+ minimumDate,
125
+ maximumDate,
124
126
  footerComponent,
125
127
  ...modalProps
126
128
  } = allProps
@@ -226,6 +228,8 @@ export const DatePickerModal = (props: DatePickerModalProps) => {
226
228
  textColor={variantStyles?.picker?.color}
227
229
  androidVariant='iosClone'
228
230
  onConfirm={setValue}
231
+ minimumDate={minimumDate}
232
+ maximumDate={maximumDate}
229
233
  {...datePickerProps}
230
234
  mode={mode}
231
235
 
@@ -6,7 +6,7 @@ import { TextInputComposition } from '../TextInput'
6
6
  import { ButtonComposition, ButtonProps } from '../Button'
7
7
  import { ModalProps } from '../Modal'
8
8
 
9
- type DatePickerModalOuterInputProps = Omit<DatePickerModalProps, 'outerInputComponent' | 'styles'> & {
9
+ export type DatePickerModalOuterInputProps = Omit<DatePickerModalProps, 'outerInputComponent' | 'styles'> & {
10
10
  valueLabel: FormTypes.Label
11
11
  styles?: StylesOf<TextInputComposition>
12
12
  }
@@ -52,4 +52,7 @@ export type DatePickerModalProps = Omit<ModalProps, 'styles' | 'variants' | 'ref
52
52
 
53
53
  footerComponent?: React.ComponentType<DatePickerModalFooterProps>
54
54
 
55
+ minimumDate?: DatePickerProps['minimumDate']
56
+
57
+ maximumDate?: DatePickerProps['maximumDate']
55
58
  } & ComponentVariants<typeof DatePickerModalPresets>
@@ -16,9 +16,9 @@ import {
16
16
  EmptyPlaceholderPresets,
17
17
  } from './styles'
18
18
 
19
- import { ImageSourcePropType, StyleSheet, Image as RNImage } from 'react-native'
19
+ import { StyleSheet } from 'react-native'
20
20
  import { StylesOf } from '../../types'
21
- import { Image } from '../Image'
21
+ import { Image, ImageProps } from '../Image'
22
22
 
23
23
  export * from './styles'
24
24
 
@@ -27,7 +27,7 @@ export type EmptyPlaceholderProps = {
27
27
 
28
28
  title?: React.ReactElement | string
29
29
  description?: React.ReactElement | string
30
- image?: ImageSourcePropType
30
+ image?: ImageProps['source']
31
31
  icon?: IconPlaceholder
32
32
 
33
33
  loading?: boolean
@@ -1,27 +1,31 @@
1
- import React, { forwardRef, useImperativeHandle } from 'react'
2
- import { DocumentPicker, ImageCropPicker } from '../../modules/documentPicker'
1
+ import React, { forwardRef, useImperativeHandle, useRef } from 'react'
3
2
  import {
4
- MobileInputFile,
5
3
  parseFilePathData,
6
4
  useCodeleapContext,
7
5
  MobileFile,
6
+ AnyRef,
7
+ FormTypes,
8
8
  } from '@codeleap/common'
9
9
  import { OSAlert } from '../../utils'
10
- import { ImageOrVideo, Options } from 'react-native-image-crop-picker'
11
- import { DocumentPickerOptions } from '../../modules/types/documentPicker'
12
-
10
+ import ImageCropPicker, { ImageOrVideo, Options } from 'react-native-image-crop-picker'
11
+ import DocumentPicker, { DocumentPickerOptions } from 'react-native-document-picker'
13
12
  export * from './styles'
14
13
 
14
+ export const useSomething = useImperativeHandle
15
+
16
+ type FileInputImageSource = 'camera' | 'library' | 'fs'
17
+
18
+ type FileResult = FormTypes.AnyFile
19
+
15
20
  export type FileInputRef = {
16
- openFilePicker: (string?: 'camera' | 'library') => void
21
+ openFilePicker: (string?: FileInputImageSource) => Promise<FileResult[]>
17
22
  }
18
-
19
23
  export type FileInputProps = {
20
24
  mode: 'hidden' | 'button'
21
- onFileSelect(files: MobileInputFile<ImageOrVideo>[]): void
25
+ onFileSelect?: (files: FileResult[]) => void
22
26
  options?: DocumentPickerOptions<any>
23
27
 
24
- ref?: FileInputRef
28
+ ref?: AnyRef<FileInputRef>
25
29
 
26
30
  type?: 'image' | 'anyFile'
27
31
  alertProps?: Parameters<typeof OSAlert.ask>[0]
@@ -37,7 +41,7 @@ const pickerDefaults = {
37
41
  cropping: true,
38
42
  }
39
43
 
40
- function parsePickerData(data:ImageOrVideo):MobileInputFile<ImageOrVideo> {
44
+ function parsePickerData(data:ImageOrVideo):FileResult {
41
45
 
42
46
  const filePathData = parseFilePathData(data.path)
43
47
  const d:MobileFile = {
@@ -55,7 +59,7 @@ function parsePickerData(data:ImageOrVideo):MobileInputFile<ImageOrVideo> {
55
59
  }
56
60
  }
57
61
 
58
- export const FileInput = forwardRef<
62
+ const _FileInput = forwardRef<
59
63
  FileInputRef,
60
64
  FileInputProps
61
65
  >((fileInputProps, ref) => {
@@ -74,7 +78,7 @@ export const FileInput = forwardRef<
74
78
  onOpenFileSystem = null,
75
79
  onError,
76
80
  } = fileInputProps
77
-
81
+ const resolveWithFile = useRef<(file:FileResult[]) => any>()
78
82
  const { logger } = useCodeleapContext()
79
83
 
80
84
  async function openFileSystem() {
@@ -84,7 +88,13 @@ export const FileInput = forwardRef<
84
88
  files = [files]
85
89
  }
86
90
 
87
- onFileSelect(files.map((file) => ({ preview: file.uri, file })))
91
+ const filesWithPreview = files.map((file) => ({ preview: file.uri, file }))
92
+
93
+ if (resolveWithFile.current) {
94
+ resolveWithFile.current(filesWithPreview)
95
+ resolveWithFile.current = undefined
96
+ }
97
+ onFileSelect?.(filesWithPreview)
88
98
  } catch (err) {
89
99
  handleError(err)
90
100
  }
@@ -111,7 +121,7 @@ export const FileInput = forwardRef<
111
121
  }
112
122
  onFileSelect(imageArray.map(parsePickerData))
113
123
  }
114
- const onPress = (open?: 'camera' | 'library' | 'fs', options?: Options) => {
124
+ const onPress = (open?: FileInputImageSource, options?: Options) => {
115
125
  if (open == 'fs') {
116
126
  openFileSystem()
117
127
  } else {
@@ -174,8 +184,28 @@ export const FileInput = forwardRef<
174
184
  }
175
185
 
176
186
  useImperativeHandle(ref, () => ({
177
- openFilePicker,
187
+ openFilePicker: (imageSource: FileInputImageSource = null) => {
188
+ openFilePicker(imageSource)
189
+ return new Promise<FileResult[]>((resolve) => {
190
+ resolveWithFile.current = resolve
191
+ })
192
+ },
178
193
  }))
179
194
 
180
195
  return null
181
196
  })
197
+
198
+ export const FileInput = _FileInput as unknown as ((props: FileInputProps) => JSX.Element)
199
+
200
+ export const useFileInput = () => {
201
+ const inputRef = useRef<FileInputRef>(null)
202
+
203
+ const openFilePicker = (imageSource:FileInputImageSource = null):Promise<FileResult[]> => {
204
+ return inputRef.current?.openFilePicker(imageSource)
205
+ }
206
+
207
+ return {
208
+ openFilePicker,
209
+ ref: inputRef as React.MutableRefObject<FileInputRef>,
210
+ }
211
+ }
@@ -6,7 +6,6 @@ import {
6
6
  useCodeleapContext,
7
7
  arePropsEqual,
8
8
  IconPlaceholder,
9
- onMount,
10
9
  onUpdate,
11
10
  PropsOf,
12
11
  StylesOf,
@@ -14,7 +13,6 @@ import {
14
13
  getNestedStylesByKey,
15
14
  } from '@codeleap/common'
16
15
  import { StyleSheet } from 'react-native'
17
- import { View } from '../View'
18
16
  export * from './styles'
19
17
 
20
18
  import {
@@ -22,6 +20,7 @@ import {
22
20
  IconPresets,
23
21
  } from './styles'
24
22
  import { Badge, BadgeComponentProps } from '../Badge'
23
+ import { View } from '../View'
25
24
 
26
25
  export type IconProps = {
27
26
  name: IconPlaceholder
@@ -33,16 +32,16 @@ export type IconProps = {
33
32
  styles?: StylesOf<IconComposition>
34
33
  } & BadgeComponentProps
35
34
 
36
- export const IconComponent: React.FC<IconProps> = (props) => {
37
- const {
38
- name,
39
- style,
40
- variants,
41
- badge = false,
42
- badgeProps = {},
35
+ export const IconComponent = (props: IconProps) => {
36
+ const {
37
+ name,
38
+ style,
39
+ variants,
40
+ badge = false,
41
+ badgeProps = {},
43
42
  wrapperProps = {},
44
43
  styles = {},
45
- ...otherProps
44
+ ...otherProps
46
45
  } = props
47
46
 
48
47
  const { Theme, logger } = useCodeleapContext()
@@ -87,7 +86,7 @@ export const IconComponent: React.FC<IconProps> = (props) => {
87
86
  }
88
87
 
89
88
  if (!name) {
90
- return null
89
+ return null
91
90
  }
92
91
 
93
92
  if (!Component) {
@@ -103,5 +102,5 @@ function areEqual(prevProps, nextProps) {
103
102
  return res
104
103
  }
105
104
 
106
- export const Icon = React.memo(IconComponent, areEqual)
105
+ export const Icon = React.memo(IconComponent, areEqual) as typeof IconComponent
107
106
 
@@ -1,24 +1,21 @@
1
1
  import * as React from 'react'
2
2
  import {
3
3
  ComponentVariants,
4
-
5
4
  useDefaultComponentStyle,
6
5
  arePropsEqual,
7
6
  FormTypes,
8
7
  TypeGuards,
9
- useBooleanToggle,
10
8
  getNestedStylesByKey,
11
9
  } from '@codeleap/common'
12
- import { ComponentPropsWithoutRef } from 'react'
13
10
  import {
14
11
  Image as NativeImage,
12
+ ImageProps as NativeImageProps,
15
13
  ImageStyle,
16
14
  StyleProp,
17
15
  StyleSheet,
18
16
  TextStyle,
19
17
  ViewStyle,
20
18
  } from 'react-native'
21
- import { FastImage } from '../../modules/fastImage'
22
19
  import {
23
20
  ImageComposition,
24
21
  ImagePresets,
@@ -28,27 +25,25 @@ import { Touchable } from '../Touchable'
28
25
  import { isFile, toMultipartFile } from '../../utils'
29
26
  import { LoadingOverlay, LoadingOverlayProps } from '../LoadingOverlay'
30
27
  import { StylesOf } from '../../types'
28
+ import FastImage, { Source } from 'react-native-fast-image'
29
+
31
30
  export * from './styles'
32
- type NativeImageProps = ComponentPropsWithoutRef<typeof NativeImage>
31
+
33
32
  export type ImageProps = Omit<NativeImageProps, 'source' | 'style'> & {
34
33
  variants?: ComponentVariants<typeof ImagePresets>['variants']
35
34
  fast?: boolean
36
35
  styles?: StylesOf<ImageComposition>
37
36
  style?: StyleProp<ImageStyle | TextStyle | ViewStyle>
38
37
  source:
39
- | (NativeImageProps['source'] & {
40
- priority?: keyof typeof FastImage.priority
41
- })
38
+ | Source
42
39
  | FormTypes.AnyFile
43
- | string
44
- | number
45
40
  resizeMode?: keyof typeof FastImage.resizeMode
46
41
  spotlight?: string
47
42
  maintainAspectRatio?: boolean
48
- withLoadingOverlay?: boolean | React.FC<LoadingOverlayProps>
43
+ withLoadingOverlay?: boolean | ((props: LoadingOverlayProps) => JSX.Element)
49
44
  }
50
45
 
51
- export const ImageComponent: React.FC<ImageProps> = (props) => {
46
+ export const ImageComponent = (props:ImageProps) => {
52
47
  const {
53
48
  variants,
54
49
  style,
@@ -62,12 +57,17 @@ export const ImageComponent: React.FC<ImageProps> = (props) => {
62
57
  ...imageProps
63
58
  } = props
64
59
 
65
- const variantStyles = useDefaultComponentStyle<'u:Image', typeof ImagePresets>('u:Image', { variants, styles: componentStyleSheet, transform: StyleSheet.flatten })
60
+ const variantStyles = useDefaultComponentStyle<'u:Image', typeof ImagePresets>('u:Image', {
61
+ variants,
62
+ styles: componentStyleSheet,
63
+ transform: StyleSheet.flatten,
64
+ })
66
65
  const [loading, setLoading] = React.useState(false)
67
66
 
68
67
  const styles = StyleSheet.flatten([variantStyles.wrapper, style])
69
68
 
70
69
  let imSource = source
70
+
71
71
  if (isFile(imSource)) {
72
72
  imSource = toMultipartFile(imSource)
73
73
  } else if (TypeGuards.isString(source)) {
@@ -139,6 +139,7 @@ export const ImageComponent: React.FC<ImageProps> = (props) => {
139
139
  style={[aspectRatioStyle, styles]}
140
140
  // @ts-ignore
141
141
  tintColor={styles?.tintColor}
142
+ // @ts-ignore
142
143
  source={imSource}
143
144
  resizeMode={FastImage.resizeMode[resizeMode || 'contain']}
144
145
  {...loadProps.current}
@@ -152,7 +153,8 @@ export const ImageComponent: React.FC<ImageProps> = (props) => {
152
153
  <NativeImage
153
154
  style={[aspectRatioStyle, styles]}
154
155
  resizeMode={resizeMode}
155
- source={imSource} {...(imageProps as any)}
156
+ source={imSource}
157
+ {...(imageProps as any)}
156
158
  {...loadProps.current}
157
159
  />
158
160
  {
@@ -167,5 +169,5 @@ function areEqual(prevProps, nextProps) {
167
169
  return res
168
170
  }
169
171
 
170
- export const Image = React.memo(ImageComponent, areEqual)
172
+ export const Image = React.memo(ImageComponent, areEqual) as typeof ImageComponent
171
173
 
@@ -4,7 +4,7 @@ import { deepEqual, onUpdate, ReactState, TypeGuards, usePrevious, useUnmount }
4
4
  import uuid from 'react-native-uuid'
5
5
  import { ImageView } from './component'
6
6
  import { ImageProps } from '../Image'
7
- import {ImageURISource, ImageRequireSource} from 'react-native'
7
+ import { ImageURISource, ImageRequireSource } from 'react-native'
8
8
  type ImageSource = ImageURISource | ImageRequireSource
9
9
 
10
10
  type TImage = {
@@ -143,7 +143,7 @@ export const useImageSpotlight = (name: string | null, src: ImageProps['source']
143
143
  }
144
144
  }
145
145
 
146
- export const Spotlight = ({ name }) => {
146
+ export const Spotlight = ({ name }: {name: string}) => {
147
147
  const spotlight = useSpotlight(name)
148
148
  useUnmount(() => {
149
149
  spotlight.clear()
@@ -146,7 +146,7 @@ const ListCP = forwardRef<KeyboardAwareFlatList, FlatListProps>(
146
146
  },
147
147
  )
148
148
 
149
- export type ListComponentType = <T extends any[] = any[]>(props: FlatListProps<T>) => React.ReactElement
149
+ export type ListComponentType = <T extends any[] = any[]>(props: FlatListProps<T>) => JSX.Element
150
150
 
151
151
  export const List = ListCP as unknown as ListComponentType
152
152
 
@@ -62,7 +62,7 @@ export type ModalHeaderProps = Omit<ModalProps, 'styles' | 'renderHeader'> & {
62
62
  description?: React.ReactElement
63
63
  }
64
64
 
65
- const DefaultHeader:React.FC<ModalHeaderProps> = (props) => {
65
+ const DefaultHeader = (props: ModalHeaderProps) => {
66
66
  const {
67
67
  styles,
68
68
  title = null,
@@ -101,7 +101,7 @@ const DefaultHeader:React.FC<ModalHeaderProps> = (props) => {
101
101
  )}</>
102
102
  }
103
103
 
104
- export const Modal: React.FC<ModalProps> = (modalProps) => {
104
+ export const Modal = (modalProps:ModalProps) => {
105
105
  const {
106
106
  variants = [],
107
107
  styles = {},
@@ -1,7 +1,23 @@
1
- // @ts-nocheck
2
- import { createBottomTabNavigator, createDrawerNavigator, createStackNavigator } from '../../modules/reactNavigation'
1
+ import { createDrawerNavigator } from '@react-navigation/drawer'
2
+ import { createStackNavigator } from '@react-navigation/stack'
3
+ import type { TypedNavigator } from '@react-navigation/core'
4
+ import { createBottomTabNavigator } from '@react-navigation/bottom-tabs'
3
5
 
4
- export const Navigators = {
6
+ type X = TypedNavigator<
7
+ any,
8
+ any,
9
+ any,
10
+ any,
11
+ any
12
+ >
13
+
14
+ type INavigators = {
15
+ Drawer: X
16
+ Stack: X
17
+ Tab: X
18
+ }
19
+
20
+ export const Navigators:INavigators = {
5
21
  Drawer: createDrawerNavigator(),
6
22
  Stack: createStackNavigator(),
7
23
  Tab: createBottomTabNavigator(),