@codeleap/mobile 3.1.2 → 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
@@ -4,29 +4,27 @@ import { StyleSheet } from 'react-native'
4
4
  import {
5
5
  TypeGuards,
6
6
  useDefaultComponentStyle,
7
- onUpdate
7
+ onUpdate,
8
8
  } from '@codeleap/common'
9
9
 
10
10
  import { SliderProps, TrackMarkProps } from './types'
11
11
  import { InputBase, selectInputBaseProps } from '../InputBase'
12
- import {SliderPresets} from './styles'
12
+ import { SliderPresets } from './styles'
13
13
  import { Text } from '../Text'
14
14
  import { View } from '../View'
15
15
 
16
16
  export * from './styles'
17
17
 
18
-
19
-
20
18
  const DefaultSliderTrackMark = (props: TrackMarkProps) => {
21
19
  const { index, content, style } = props
22
20
 
23
- if(!TypeGuards.isString(props.content)){
21
+ if (!TypeGuards.isString(props.content)) {
24
22
  return <>
25
23
  {props.content}
26
24
  </>
27
25
  }
28
26
 
29
- return <Text
27
+ return <Text
30
28
  text={props.content}
31
29
  style={style}
32
30
  />
@@ -35,7 +33,7 @@ const DefaultSliderTrackMark = (props: TrackMarkProps) => {
35
33
  export const Slider = (props:SliderProps) => {
36
34
  const {
37
35
  inputBaseProps,
38
- others
36
+ others,
39
37
  } = selectInputBaseProps(props)
40
38
 
41
39
  const {
@@ -57,13 +55,11 @@ export const Slider = (props:SliderProps) => {
57
55
  const [_value, _setValue] = React.useState(value)
58
56
 
59
57
  onUpdate(() => {
60
- if(value !== _value){
58
+ if (value !== _value) {
61
59
  _setValue(value)
62
60
  }
63
61
  }, [value])
64
62
 
65
-
66
-
67
63
  const variantStyles = useDefaultComponentStyle<'u:Slider', typeof SliderPresets>('u:Slider', {
68
64
  variants,
69
65
  styles,
@@ -74,30 +70,30 @@ export const Slider = (props:SliderProps) => {
74
70
  return StyleSheet.flatten([
75
71
  variantStyles.thumb,
76
72
  disabled && variantStyles['thumb:disabled'],
77
- ])
78
- }, [])
73
+ ])
74
+ }, [])
79
75
 
80
76
  const trackStyle = React.useMemo(() => {
81
77
  return StyleSheet.flatten([
82
78
  variantStyles.track,
83
79
  disabled && variantStyles['track:disabled'],
84
- ])
85
- }, [disabled])
80
+ ])
81
+ }, [disabled])
86
82
 
87
83
  const selectedTrackStyle = React.useMemo(() => {
88
84
  return StyleSheet.flatten([
89
85
  variantStyles.selectedTrack,
90
86
  disabled && variantStyles['selectedTrack:disabled'],
91
- ])
92
- }, [disabled])
87
+ ])
88
+ }, [disabled])
93
89
 
94
90
  const unselectedTrackStyle = React.useMemo(() => {
95
91
  return StyleSheet.flatten([
96
92
  variantStyles.unselectedTrack,
97
93
  disabled && variantStyles['unselectedTrack:disabled'],
98
- ])
94
+ ])
99
95
  }, [disabled])
100
-
96
+
101
97
  const containerStyle = React.useMemo(() => {
102
98
  return StyleSheet.flatten([
103
99
  variantStyles.sliderContainer,
@@ -108,11 +104,11 @@ export const Slider = (props:SliderProps) => {
108
104
  const trackMarksHaveContent = !(TypeGuards.isArray(trackMarks) || TypeGuards.isNil(trackMarks))
109
105
 
110
106
  const trackMarksProp = React.useMemo(() => {
111
- if(!trackMarksHaveContent){
107
+ if (!trackMarksHaveContent) {
112
108
  return trackMarks
113
109
  }
114
110
  return Object.keys(trackMarks).map((key) => Number(key))
115
- },[trackMarksHaveContent])
111
+ }, [trackMarksHaveContent])
116
112
 
117
113
  const trackMarkStyle = React.useMemo(() => {
118
114
  return StyleSheet.flatten([
@@ -128,7 +124,7 @@ export const Slider = (props:SliderProps) => {
128
124
  styles={variantStyles}
129
125
  labelAsRow
130
126
  >
131
- <RNSlider
127
+ <RNSlider
132
128
  value={_value}
133
129
  onValueChange={_setValue}
134
130
  // @ts-ignore
@@ -150,38 +146,38 @@ export const Slider = (props:SliderProps) => {
150
146
  {
151
147
  trackMarksProp ? (
152
148
  <View style={variantStyles.trackMarkWrapper}>
153
- {
154
- trackMarksProp.map((_, idx) => {
155
- let idxStyle = {}
156
-
157
- if(idx === 0){
158
- idxStyle = variantStyles.firstTrackMark
159
- } else if(idx === trackMarksProp.length - 1){
160
- idxStyle = variantStyles.lastTrackMark
161
- }
162
- const style = [
163
- trackMarkStyle,
164
- idxStyle,
165
- ]
166
-
167
- if(!trackMarksHaveContent){
168
- return <SliderTrackMark
169
- index={idx}
170
- style={style}
171
- key={idx}
172
- />
173
- }
174
-
175
- const relativeValue = trackMarksProp[idx]
176
- const content = trackMarks[relativeValue]
177
-
178
- return <SliderTrackMark index={idx} content={content} style={style} key={idx}/>
179
- })
180
- }
149
+ {
150
+ trackMarksProp.map((_, idx) => {
151
+ let idxStyle = {}
152
+
153
+ if (idx === 0) {
154
+ idxStyle = variantStyles.firstTrackMark
155
+ } else if (idx === trackMarksProp.length - 1) {
156
+ idxStyle = variantStyles.lastTrackMark
157
+ }
158
+ const style = [
159
+ trackMarkStyle,
160
+ idxStyle,
161
+ ]
162
+
163
+ if (!trackMarksHaveContent) {
164
+ return <SliderTrackMark
165
+ index={idx}
166
+ style={style}
167
+ key={idx}
168
+ />
169
+ }
170
+
171
+ const relativeValue = trackMarksProp[idx]
172
+ const content = trackMarks[relativeValue]
173
+
174
+ return <SliderTrackMark index={idx} content={content} style={style} key={idx}/>
175
+ })
176
+ }
181
177
  </View>
182
178
  ) : null
183
179
  }
184
- </InputBase>
180
+ </InputBase>
185
181
  )
186
182
  }
187
183
 
@@ -6,7 +6,6 @@ import {
6
6
  StylesOf,
7
7
  PropsOf,
8
8
  } from '@codeleap/common'
9
- import { ReactNode } from 'react'
10
9
  import { StyleSheet } from 'react-native'
11
10
  import { View } from '../View'
12
11
 
@@ -18,15 +17,12 @@ import { InputBase, InputBaseDefaultOrder, InputBaseProps, selectInputBaseProps
18
17
  import { useAnimatedVariantStyles } from '../..'
19
18
  import { Touchable } from '../Touchable'
20
19
 
21
-
22
20
  export * from './styles'
23
21
 
24
-
25
-
26
22
  export type SwitchProps = Pick<
27
23
  InputBaseProps,
28
24
  'debugName' | 'disabled' | 'label'
29
- > & {
25
+ > & {
30
26
  variants?: ComponentVariants<typeof SwitchPresets>['variants']
31
27
  styles?: StylesOf<SwitchComposition>
32
28
  value: boolean
@@ -37,107 +33,105 @@ export type SwitchProps = Pick<
37
33
 
38
34
  const reversedOrder = [...InputBaseDefaultOrder].reverse()
39
35
 
36
+ export const Switch = (props: SwitchProps) => {
37
+ const {
38
+ inputBaseProps,
39
+ others,
40
+ } = selectInputBaseProps(props)
41
+ const {
42
+ variants = [],
43
+ style = {},
44
+ styles = {},
45
+ value,
46
+ disabled,
47
+ debugName,
48
+ onValueChange,
49
+ switchOnLeft,
50
+ } = others
40
51
 
52
+ const variantStyles = useDefaultComponentStyle<'u:Switch', typeof SwitchPresets>('u:Switch', {
53
+ variants,
54
+ styles,
55
+ rootElement: 'wrapper',
56
+ transform: StyleSheet.flatten,
57
+ })
41
58
 
42
- export const Switch = (props: SwitchProps) => {
43
- const {
44
- inputBaseProps,
45
- others
46
- } = selectInputBaseProps(props)
47
- const {
48
- variants = [],
49
- style = {},
50
- styles = {},
51
- value,
52
- disabled,
53
- debugName,
54
- onValueChange,
55
- switchOnLeft,
56
- } = others
59
+ const trackAnimation = useAnimatedVariantStyles({
60
+ variantStyles,
61
+ animatedProperties: ['track:off', 'track:disabled', 'track:on', 'track:disabled-on', 'track:disabled-off'],
62
+ transition: variantStyles['track:transition'],
63
+ updater: () => {
64
+ 'worklet'
65
+ let disabledStyle = {}
66
+ if (disabled) {
67
+ disabledStyle = value ? variantStyles['track:disabled-on'] : variantStyles['track:disabled-off']
68
+ }
69
+ const style = value ? variantStyles['track:on'] : variantStyles['track:off']
57
70
 
58
- const variantStyles = useDefaultComponentStyle<'u:Switch', typeof SwitchPresets>('u:Switch', {
59
- variants,
60
- styles,
61
- rootElement: 'wrapper',
62
- transform: StyleSheet.flatten
63
- })
64
-
65
- const trackAnimation = useAnimatedVariantStyles({
66
- variantStyles,
67
- animatedProperties: ['track:off','track:disabled', 'track:on', 'track:disabled-on', 'track:disabled-off'],
68
- transition: variantStyles['track:transition'],
69
- updater: () =>{
70
- 'worklet'
71
- let disabledStyle = {}
72
- if(disabled){
73
- disabledStyle = value ? variantStyles['track:disabled-on'] : variantStyles['track:disabled-off']
74
- }
75
- const style = value ? variantStyles['track:on'] : variantStyles['track:off']
71
+ return {
72
+ ...style,
73
+ ...disabledStyle,
74
+ }
76
75
 
77
- return {
78
- ...style,
79
- ...disabledStyle
80
- }
81
-
82
- },
83
- dependencies: [value, disabled],
84
- })
76
+ },
77
+ dependencies: [value, disabled],
78
+ })
85
79
 
86
- const thumbAnimation = useAnimatedVariantStyles({
87
- variantStyles,
88
- animatedProperties: ['thumb:off','thumb:disabled', 'thumb:on', 'thumb:disabled-off', 'thumb:disabled-on'],
89
- transition: variantStyles['thumb:transition'],
90
- updater: () =>{
91
- 'worklet'
92
- let disabledStyle = {}
93
- if(disabled){
94
- disabledStyle = value ? variantStyles['thumb:disabled-on'] : variantStyles['thumb:disabled-off']
95
- }
96
- const style = value ? variantStyles['thumb:on'] : variantStyles['thumb:off']
97
- return {
98
- ...style,
99
- ...disabledStyle
100
- }
101
-
102
- },
103
- dependencies: [value, disabled],
104
- })
80
+ const thumbAnimation = useAnimatedVariantStyles({
81
+ variantStyles,
82
+ animatedProperties: ['thumb:off', 'thumb:disabled', 'thumb:on', 'thumb:disabled-off', 'thumb:disabled-on'],
83
+ transition: variantStyles['thumb:transition'],
84
+ updater: () => {
85
+ 'worklet'
86
+ let disabledStyle = {}
87
+ if (disabled) {
88
+ disabledStyle = value ? variantStyles['thumb:disabled-on'] : variantStyles['thumb:disabled-off']
89
+ }
90
+ const style = value ? variantStyles['thumb:on'] : variantStyles['thumb:off']
91
+ return {
92
+ ...style,
93
+ ...disabledStyle,
94
+ }
95
+
96
+ },
97
+ dependencies: [value, disabled],
98
+ })
99
+
100
+ const _switchOnLeft = switchOnLeft ?? variantStyles.__props?.switchOnLeft
105
101
 
106
- const _switchOnLeft = switchOnLeft ?? variantStyles['__props']?.switchOnLeft
102
+ return <InputBase
103
+ {...inputBaseProps}
104
+ debugName={debugName}
105
+ wrapper={Touchable}
106
+ styles={variantStyles}
107
+ wrapperProps={{
108
+ onPress: () => {
109
+ onValueChange(!value)
110
+ },
111
+ disabled,
112
+ rippleDisabled: true,
113
+ }}
114
+ order={_switchOnLeft ? reversedOrder : InputBaseDefaultOrder}
115
+ style={style}
116
+ disabled={disabled}
107
117
 
108
- return <InputBase
109
- {...inputBaseProps}
110
- debugName={debugName}
111
- wrapper={Touchable}
112
- styles={variantStyles}
113
- wrapperProps={{
114
- onPress: () => {
115
- onValueChange(!value)
116
- },
117
- disabled,
118
- rippleDisabled: true
119
- }}
120
- order={_switchOnLeft ? reversedOrder : InputBaseDefaultOrder}
121
- style={style}
122
- disabled={disabled}
123
-
118
+ >
119
+ <View
120
+ animated
121
+ style={[
122
+ variantStyles.track,
123
+ disabled && variantStyles['track:disabled'],
124
+ trackAnimation,
125
+ ]}
124
126
  >
125
- <View
126
- animated
127
+ <View
128
+ animated
127
129
  style={[
128
- variantStyles.track,
129
- disabled && variantStyles['track:disabled'],
130
- trackAnimation
130
+ variantStyles.thumb,
131
+ disabled && variantStyles['thumb:disabled'],
132
+ thumbAnimation,
131
133
  ]}
132
- >
133
- <View
134
- animated
135
- style={[
136
- variantStyles.thumb,
137
- disabled && variantStyles['thumb:disabled'],
138
- thumbAnimation
139
- ]}
140
- />
141
- </View>
142
- </InputBase>
134
+ />
135
+ </View>
136
+ </InputBase>
143
137
  }
@@ -1,5 +1,5 @@
1
1
  import * as React from 'react'
2
- import { ComponentPropsWithoutRef, forwardRef } from 'react'
2
+ import { forwardRef } from 'react'
3
3
  import {
4
4
  ComponentVariants,
5
5
  useDefaultComponentStyle,
@@ -7,13 +7,13 @@ import {
7
7
  TypeGuards,
8
8
  useState,
9
9
  } from '@codeleap/common'
10
- import { Animated, Platform, StyleSheet, Text as NativeText } from 'react-native'
11
- import { useAnimateColor, usePressableFeedback } from '../../utils'
10
+ import { Animated, Platform, StyleSheet, Text as NativeText, TextProps as RNTextProps } from 'react-native'
11
+ import { usePressableFeedback } from '../../utils'
12
12
  import { TextPresets } from './styles'
13
13
 
14
14
  export * from './styles'
15
15
 
16
- export type TextProps = ComponentPropsWithoutRef<typeof NativeText> & {
16
+ export type TextProps = RNTextProps & {
17
17
  text?: React.ReactNode
18
18
  variants?: ComponentVariants<typeof TextPresets>['variants']
19
19
  animated?: boolean
@@ -21,11 +21,9 @@ export type TextProps = ComponentPropsWithoutRef<typeof NativeText> & {
21
21
  debugName?: string
22
22
  debounce?: number
23
23
  pressDisabled?: boolean
24
- } & BaseViewProps
24
+ }
25
25
 
26
-
27
-
28
- export const Text = forwardRef<NativeText, TextProps>((textProps, ref) => {
26
+ const _Text = forwardRef<NativeText, TextProps>((textProps, ref) => {
29
27
  const { variants = [], text, children, onPress, style, debounce = 1000, pressDisabled, ...props } = textProps
30
28
 
31
29
  const pressPolyfillEnabled = Platform.OS === 'android' && !!onPress && !pressDisabled
@@ -68,14 +66,10 @@ export const Text = forwardRef<NativeText, TextProps>((textProps, ref) => {
68
66
 
69
67
  const styles = StyleSheet.flatten([variantStyles.text, style])
70
68
 
71
-
72
-
73
69
  if (!!text && !TypeGuards.isString(text)) return <>{text}</>
74
70
 
75
71
  const Component = textProps.animated ? Animated.Text : NativeText
76
72
 
77
-
78
-
79
73
  const { getFeedbackStyle } = usePressableFeedback(styles, {
80
74
  disabled: !pressPolyfillEnabled,
81
75
  feedbackConfig: variantStyles.pressFeedback,
@@ -90,7 +84,7 @@ export const Text = forwardRef<NativeText, TextProps>((textProps, ref) => {
90
84
 
91
85
  return <Component {...props}
92
86
  onPressIn={handlePress(true)} onPressOut={handlePress(false)}
93
- style={[styles, feedbackStyle, !!onPress && pressDisabled ? variantStyles['text:disabled'] : null]}
87
+ style={[styles, feedbackStyle, !!onPress && pressDisabled ? variantStyles['text:disabled'] : null]}
94
88
  allowFontScaling={false}
95
89
  {...pressProps}
96
90
  // @ts-ignore
@@ -102,7 +96,7 @@ export const Text = forwardRef<NativeText, TextProps>((textProps, ref) => {
102
96
 
103
97
  })
104
98
 
105
-
99
+ export const Text = _Text as (props: TextProps & {ref?: React.MutableRefObject<NativeText> }) => JSX.Element
106
100
 
107
101
  export const AnimatedText = Animated.createAnimatedComponent(Text)
108
102
 
@@ -43,7 +43,7 @@ const defaultProps:Partial<TextInputProps> = {
43
43
  visibleIcon: 'input-visiblity:visible' as IconPlaceholder,
44
44
  }
45
45
 
46
- export const TextInput = forwardRef<NativeTextInput, TextInputProps>((props, inputRef) => {
46
+ const TextInputComponent = forwardRef<NativeTextInput, TextInputProps>((props, inputRef) => {
47
47
 
48
48
  const innerInputRef = React.useRef<NativeTextInput>(null)
49
49
 
@@ -217,6 +217,7 @@ export const TextInput = forwardRef<NativeTextInput, TextInputProps>((props, inp
217
217
  export type SearchInputProps = {
218
218
  onTypingChange: (isTyping: boolean) => void
219
219
  onSearchChange: (search: string) => void
220
+ onValueChange?: (search: string) => void
220
221
  onClear?: () => void
221
222
  debugName: string
222
223
  debounce?: number
@@ -235,13 +236,15 @@ export const SearchInput: ComponentWithDefaultProps<SearchInputProps> = (props)
235
236
  searchIcon,
236
237
  debounce,
237
238
  placeholder,
239
+ value,
240
+ onValueChange,
238
241
  ...others
239
242
  } = {
240
243
  ...SearchInput.defaultProps,
241
244
  ...props,
242
245
  }
243
246
 
244
- const [search, setSearch] = useState('')
247
+ const [search, setSearch] = !TypeGuards.isNil(value) && !!onValueChange ? [value, onValueChange] : useState('')
245
248
 
246
249
  const setSearchTimeout = React.useRef<NodeJS.Timeout|null>(null)
247
250
 
@@ -291,7 +294,10 @@ export const SearchInput: ComponentWithDefaultProps<SearchInputProps> = (props)
291
294
  )
292
295
  }
293
296
 
297
+ export const TextInput = TextInputComponent as ComponentWithDefaultProps<TextInputProps>
298
+
294
299
  TextInput.defaultProps = defaultProps
300
+
295
301
  SearchInput.defaultProps = {
296
302
  debounce: null,
297
303
  clearIcon: 'x' as IconPlaceholder,
@@ -1,25 +1,25 @@
1
1
  import * as React from 'react'
2
- import { ComponentPropsWithoutRef, forwardRef } from 'react'
2
+ import { forwardRef } from 'react'
3
3
  import {
4
4
  ComponentVariants,
5
5
  useDefaultComponentStyle,
6
- BaseViewProps,
7
6
 
8
7
  useCodeleapContext,
9
8
  AnyFunction,
10
9
  TypeGuards,
11
10
  onMount,
12
11
  } from '@codeleap/common'
13
- import { Pressable, StyleSheet, View as RNView, Insets, Platform } from 'react-native'
12
+ import { Pressable, StyleSheet, View as RNView, Insets, Platform, PressableProps, ViewStyle, StyleProp } from 'react-native'
14
13
  import { TouchableComposition, TouchablePresets } from './styles'
15
14
  import { StylesOf } from '../../types'
16
15
  import { View } from '../View'
17
16
  import { usePressableFeedback } from '../../utils'
17
+
18
18
  import { PressableRipple } from '../../modules/PressableRipple'
19
- export type TouchableProps = React.PropsWithChildren<
19
+ export type TouchableProps =
20
20
  Omit<
21
- ComponentPropsWithoutRef<typeof Pressable>,
22
- 'onPress'|'children'
21
+ PressableProps,
22
+ 'onPress' | 'children' | 'style'
23
23
  > & {
24
24
  variants?: ComponentVariants<typeof TouchablePresets>['variants']
25
25
  component?: any
@@ -34,11 +34,13 @@ export type TouchableProps = React.PropsWithChildren<
34
34
  styles?: StylesOf<TouchableComposition>
35
35
  setPressed?: (param: boolean) => void
36
36
  rippleDisabled?: boolean
37
- } & BaseViewProps
38
- >
37
+ children?: React.ReactNode
38
+ style?: StyleProp<ViewStyle>
39
+ }
40
+
39
41
  export * from './styles'
40
42
 
41
- export const Touchable: React.FC<TouchableProps> = forwardRef<
43
+ const _Touchable = forwardRef<
42
44
  RNView,
43
45
  TouchableProps
44
46
  >((touchableProps, ref) => {
@@ -237,3 +239,5 @@ export const Touchable: React.FC<TouchableProps> = forwardRef<
237
239
  </Wrapper>
238
240
  )
239
241
  })
242
+
243
+ export const Touchable = _Touchable as ((props: TouchableProps) => JSX.Element)
@@ -1,36 +1,34 @@
1
- import * as React from 'react'
2
- import { ComponentPropsWithoutRef, forwardRef } from 'react'
1
+ import React from 'react'
2
+ import { forwardRef } from 'react'
3
3
  import {
4
4
  ComponentVariants,
5
5
  useDefaultComponentStyle,
6
6
  ViewStyles,
7
- BaseViewProps,
8
7
  useCodeleapContext,
9
8
  useMemo,
9
+ AnyRef,
10
10
  } from '@codeleap/common'
11
11
  import { View as NativeView, ViewProps as RNViewProps } from 'react-native'
12
- import { GetKeyboardAwarePropsOptions, useKeyboardAwareView } from '../../utils'
13
- import {TransitionConfig} from '../../types'
12
+ import { GetKeyboardAwarePropsOptions } from '../../utils'
13
+ import { TransitionConfig } from '../../types'
14
14
  import Animated from 'react-native-reanimated'
15
15
  export * from './styles'
16
16
 
17
+ type NativeViewProps = RNViewProps
17
18
 
19
+ export type ViewRefType = NativeView
18
20
 
19
- type NativeViewProps =Omit<ComponentPropsWithoutRef<typeof NativeView>, 'children'>
20
-
21
- export type ViewRefType = NativeView | React.ForwardedRef<NativeView>
22
- export type ViewProps = React.PropsWithChildren<{
23
- ref?: ViewRefType
21
+ export type ViewProps ={
22
+ ref?: AnyRef<ViewRefType>
24
23
  component?: any
25
24
  animated?: boolean
26
25
  keyboardAware?: GetKeyboardAwarePropsOptions
27
26
  transition?: Partial<TransitionConfig>
28
- } &
29
- NativeViewProps & ComponentVariants<typeof ViewStyles> & BaseViewProps
30
- >
31
-
27
+ }
28
+ & NativeViewProps
29
+ & ComponentVariants<typeof ViewStyles>
32
30
 
33
- export const View = forwardRef<NativeView,ViewProps>((viewProps, ref) => {
31
+ export const View = forwardRef<NativeView, ViewProps>((viewProps, ref) => {
34
32
  const {
35
33
  responsiveVariants = {},
36
34
  variants = [],
@@ -46,15 +44,14 @@ export const View = forwardRef<NativeView,ViewProps>((viewProps, ref) => {
46
44
  responsiveVariants,
47
45
  variants,
48
46
  })
49
- const Component = animated ? Animated.View : component || NativeView
47
+ const Component = animated ? Animated.View : component || NativeView
50
48
 
51
49
  return (
52
- <Component {...props} style={[variantStyles.wrapper, style]}>
50
+ <Component {...props} style={[variantStyles.wrapper, style]}>
53
51
  {children}
54
52
  </Component>
55
53
  )
56
- }) as unknown as React.FC<ViewProps>
57
-
54
+ }) as unknown as ((props: ViewProps) => JSX.Element)
58
55
 
59
56
  type GapProps = ViewProps & {
60
57
  value: number
@@ -62,7 +59,7 @@ type GapProps = ViewProps & {
62
59
  defaultProps?: any
63
60
  }
64
61
 
65
- export const Gap:React.FC<React.PropsWithChildren<GapProps>> = ({ children, value, defaultProps = {}, ...props }) => {
62
+ export const Gap = ({ children, value, defaultProps = {}, ...props }: GapProps) => {
66
63
  const { Theme } = useCodeleapContext()
67
64
  const childArr = React.Children.toArray(children)
68
65
 
@@ -27,8 +27,8 @@ export * from './Pager'
27
27
  export * from './EmptyPlaceholder'
28
28
  export * from './Backdrop'
29
29
  export * from './Drawer'
30
+ export * from './SegmentedControl'
30
31
  export * from './Autocomplete'
31
-
32
32
  export * from './Grid'
33
33
  export * from './InputLabel'
34
34
  export * from './LoadingOverlay'
@@ -1,4 +1,3 @@
1
- // @ts-nocheck
2
1
  import React from 'react'
3
2
  export { createStackNavigator } from '@react-navigation/stack'
4
3
  export { createDrawerNavigator } from '@react-navigation/drawer'
@@ -11,5 +10,5 @@ export function useNavigationContext() {
11
10
  const navigation = React.useContext(NavigationContext)
12
11
  if (!navigation && !root) return undefined
13
12
 
14
- return (navigation ?? root) as unknown as T
13
+ return (navigation ?? root)
15
14
  }