@codeleap/mobile 3.24.2 → 3.25.0

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 (131) hide show
  1. package/package.json +6 -4
  2. package/src/Registry.ts +52 -0
  3. package/src/components/ActionIcon/index.tsx +55 -37
  4. package/src/components/ActionIcon/styles.ts +2 -4
  5. package/src/components/ActionIcon/types.ts +15 -0
  6. package/src/components/ActivityIndicator/index.tsx +42 -64
  7. package/src/components/ActivityIndicator/styles.ts +1 -10
  8. package/src/components/ActivityIndicator/types.ts +9 -0
  9. package/src/components/Autocomplete/index.tsx +46 -54
  10. package/src/components/Autocomplete/styles.ts +2 -5
  11. package/src/components/Autocomplete/types.ts +13 -23
  12. package/src/components/Avatar/index.tsx +59 -71
  13. package/src/components/Avatar/styles.ts +1 -9
  14. package/src/components/Avatar/types.ts +23 -0
  15. package/src/components/AvatarGroup/index.tsx +30 -44
  16. package/src/components/AvatarGroup/styles.ts +0 -6
  17. package/src/components/AvatarGroup/types.ts +10 -0
  18. package/src/components/Backdrop/index.tsx +51 -34
  19. package/src/components/Backdrop/styles.ts +5 -10
  20. package/src/components/Backdrop/types.ts +14 -0
  21. package/src/components/Badge/index.tsx +36 -62
  22. package/src/components/Badge/styles.ts +3 -11
  23. package/src/components/Badge/types.ts +27 -0
  24. package/src/components/Button/index.tsx +55 -82
  25. package/src/components/Button/styles.ts +13 -14
  26. package/src/components/Button/types.ts +20 -0
  27. package/src/components/Calendar/index.tsx +35 -29
  28. package/src/components/Checkbox/index.tsx +43 -64
  29. package/src/components/Checkbox/styles.ts +1 -6
  30. package/src/components/Checkbox/types.ts +13 -0
  31. package/src/components/DatePickerModal/index.tsx +50 -65
  32. package/src/components/DatePickerModal/styles.ts +9 -10
  33. package/src/components/DatePickerModal/types.ts +36 -54
  34. package/src/components/EmptyPlaceholder/index.tsx +40 -63
  35. package/src/components/EmptyPlaceholder/styles.ts +0 -5
  36. package/src/components/EmptyPlaceholder/types.ts +21 -0
  37. package/src/components/FileInput/index.tsx +11 -49
  38. package/src/components/FileInput/types.ts +27 -0
  39. package/src/components/Grid/index.tsx +84 -116
  40. package/src/components/Grid/styles.ts +0 -5
  41. package/src/components/Grid/types.ts +20 -0
  42. package/src/components/Icon/index.tsx +44 -79
  43. package/src/components/Icon/styles.ts +0 -6
  44. package/src/components/Icon/types.ts +15 -0
  45. package/src/components/Image/index.tsx +58 -78
  46. package/src/components/Image/styles.ts +1 -6
  47. package/src/components/Image/types.ts +18 -0
  48. package/src/components/ImageView/Spotlight.tsx +1 -4
  49. package/src/components/ImageView/component.tsx +1 -2
  50. package/src/components/InputBase/index.tsx +33 -24
  51. package/src/components/InputBase/styles.ts +66 -75
  52. package/src/components/InputBase/types.ts +3 -4
  53. package/src/components/InputBase/utils.ts +6 -4
  54. package/src/components/List/index.tsx +99 -151
  55. package/src/components/List/styles.ts +0 -6
  56. package/src/components/List/types.ts +41 -0
  57. package/src/components/LoadingOverlay/index.tsx +42 -29
  58. package/src/components/LoadingOverlay/styles.ts +7 -7
  59. package/src/components/LoadingOverlay/types.ts +9 -0
  60. package/src/components/Modal/index.tsx +80 -127
  61. package/src/components/Modal/styles.ts +0 -8
  62. package/src/components/Modal/types.ts +41 -0
  63. package/src/components/Navigation/Navigation.tsx +1 -0
  64. package/src/components/Navigation/types.ts +2 -9
  65. package/src/components/NumberIncrement/index.tsx +50 -60
  66. package/src/components/NumberIncrement/styles.ts +0 -5
  67. package/src/components/NumberIncrement/types.ts +32 -39
  68. package/src/components/Pager/index.tsx +42 -94
  69. package/src/components/Pager/styles.ts +1 -13
  70. package/src/components/Pager/types.ts +37 -0
  71. package/src/components/PaginationIndicator/index.tsx +51 -0
  72. package/src/components/PaginationIndicator/styles.ts +3 -0
  73. package/src/components/PaginationIndicator/types.ts +10 -0
  74. package/src/components/RadioInput/index.tsx +32 -57
  75. package/src/components/RadioInput/styles.ts +5 -7
  76. package/src/components/RadioInput/types.ts +31 -0
  77. package/src/components/RefreshControl/index.tsx +39 -19
  78. package/src/components/RefreshControl/styles.ts +1 -6
  79. package/src/components/RefreshControl/types.ts +9 -0
  80. package/src/components/Scroll/index.tsx +89 -105
  81. package/src/components/Scroll/styles.ts +0 -5
  82. package/src/components/Scroll/types.ts +21 -0
  83. package/src/components/SearchInput/index.tsx +90 -0
  84. package/src/components/Sections/index.tsx +111 -161
  85. package/src/components/Sections/styles.ts +0 -5
  86. package/src/components/Sections/types.ts +39 -0
  87. package/src/components/SegmentedControl/Option.tsx +46 -31
  88. package/src/components/SegmentedControl/index.tsx +86 -121
  89. package/src/components/SegmentedControl/styles.ts +15 -22
  90. package/src/components/SegmentedControl/types.ts +31 -0
  91. package/src/components/Select/index.tsx +71 -82
  92. package/src/components/Select/styles.ts +3 -5
  93. package/src/components/Select/types.ts +20 -25
  94. package/src/components/Slider/index.tsx +58 -43
  95. package/src/components/Slider/styles.ts +15 -6
  96. package/src/components/Slider/types.ts +9 -14
  97. package/src/components/Switch/index.tsx +43 -56
  98. package/src/components/Switch/styles.ts +1 -7
  99. package/src/components/Switch/types.ts +12 -0
  100. package/src/components/Text/index.tsx +56 -52
  101. package/src/components/Text/styles.ts +1 -7
  102. package/src/components/Text/types.ts +18 -0
  103. package/src/components/TextInput/index.tsx +49 -162
  104. package/src/components/TextInput/styles.ts +2 -8
  105. package/src/components/TextInput/types.ts +23 -0
  106. package/src/components/Touchable/index.tsx +44 -87
  107. package/src/components/Touchable/styles.ts +0 -9
  108. package/src/components/Touchable/types.ts +27 -0
  109. package/src/components/View/index.tsx +23 -92
  110. package/src/components/View/styles.ts +0 -6
  111. package/src/components/View/types.ts +13 -0
  112. package/src/components/components.ts +2 -6
  113. package/src/hooks/index.ts +13 -0
  114. package/src/index.ts +2 -0
  115. package/src/modules/PressableRipple/type.ts +1 -0
  116. package/src/utils/KeyboardAware/context.tsx +0 -2
  117. package/src/utils/KeyboardAware/keyboardHooks.ts +1 -2
  118. package/src/utils/ModalManager/components.tsx +1 -30
  119. package/src/utils/ModalManager/context.tsx +4 -4
  120. package/src/utils/ModalManager/index.ts +1 -4
  121. package/src/utils/hooks.ts +12 -1
  122. package/src/components/Calendar/style.ts +0 -6
  123. package/src/components/ContentView/index.tsx +0 -63
  124. package/src/components/ContentView/styles.ts +0 -8
  125. package/src/components/Drawer/index.tsx +0 -28
  126. package/src/components/Drawer/styles.ts +0 -8
  127. package/src/components/FileInput/styles.ts +0 -8
  128. package/src/components/InputLabel/index.tsx +0 -38
  129. package/src/components/InputLabel/styles.ts +0 -7
  130. package/src/components/List/PaginationIndicator.tsx +0 -54
  131. package/src/components/defaultStyles.ts +0 -77
@@ -1,27 +1,22 @@
1
- import { ComponentVariants, Form, PropsOf, SliderStyles } from '@codeleap/common'
2
-
3
- import {
4
- SliderComposition,
5
- } from './styles'
6
-
1
+ import { SliderComposition } from './styles'
7
2
  import { SliderProps as RNSliderProps } from '@miblanchard/react-native-slider/lib/types'
8
- import { StylesOf } from '../../types'
9
- import { View } from '../View'
10
3
  import { InputBaseProps } from '../InputBase'
4
+ import { StyledProp } from '@codeleap/styles'
11
5
 
12
- export type SliderProps = Partial<Omit<RNSliderProps, 'value' | 'onValueChange'>> & Pick<InputBaseProps, 'disabled' | 'debugName' | 'description' | 'label'> & {
6
+ export type SliderProps =
7
+ Partial<Omit<RNSliderProps, 'value' | 'onValueChange' | 'style'>> &
8
+ Pick<InputBaseProps, 'disabled' | 'debugName' | 'description' | 'label'> &
9
+ {
13
10
  debounce?: number | null
14
11
  trackMarklabels: string[]
15
12
  value: number | number[]
16
- onValueChange: (val: number| number[]) => void
17
- variants?: ComponentVariants<typeof SliderStyles>['variants']
18
- styles?: StylesOf<SliderComposition>
19
- style?: PropsOf<typeof View>['style']
13
+ onValueChange: (val: number | number[]) => void
20
14
  trackMarks?: RNSliderProps['trackMarks'] | Record<number, string>
21
15
  trackMarksClickable?: boolean
22
16
  labelClickable?: boolean
23
17
  trackMarkComponent?: React.ComponentType<TrackMarkProps>
24
- }
18
+ style?: StyledProp<SliderComposition>
19
+ }
25
20
 
26
21
  export type TrackMarkProps = {
27
22
  index: number
@@ -1,35 +1,15 @@
1
- import * as React from 'react'
2
- import {
3
-
4
- ComponentVariants,
5
- useDefaultComponentStyle,
6
- StylesOf,
7
- PropsOf,
8
- } from '@codeleap/common'
9
- import { StyleSheet } from 'react-native'
1
+ import React from 'react'
10
2
  import { View } from '../View'
11
-
12
- import {
13
- SwitchPresets,
14
- SwitchComposition,
15
- } from './styles'
16
- import { InputBase, InputBaseDefaultOrder, InputBaseProps, selectInputBaseProps } from '../InputBase'
3
+ import { InputBase, InputBaseDefaultOrder, selectInputBaseProps } from '../InputBase'
17
4
  import { useAnimatedVariantStyles } from '../..'
18
5
  import { Touchable } from '../Touchable'
6
+ import { SwitchProps } from './types'
7
+ import { AnyRecord, IJSX, StyledComponentProps } from '@codeleap/styles'
8
+ import { MobileStyleRegistry } from '../../Registry'
9
+ import { useStylesFor } from '../../hooks'
19
10
 
20
11
  export * from './styles'
21
-
22
- export type SwitchProps = Pick<
23
- InputBaseProps,
24
- 'debugName' | 'disabled' | 'label'
25
- > & {
26
- variants?: ComponentVariants<typeof SwitchPresets>['variants']
27
- styles?: StylesOf<SwitchComposition>
28
- value: boolean
29
- onValueChange: (value: boolean) => void
30
- style?: PropsOf<typeof View>['style']
31
- switchOnLeft?: boolean
32
- }
12
+ export * from './types'
33
13
 
34
14
  const reversedOrder = [...InputBaseDefaultOrder].reverse()
35
15
 
@@ -37,11 +17,13 @@ export const Switch = (props: SwitchProps) => {
37
17
  const {
38
18
  inputBaseProps,
39
19
  others,
40
- } = selectInputBaseProps(props)
20
+ } = selectInputBaseProps({
21
+ ...Switch.defaultProps,
22
+ ...props,
23
+ })
24
+
41
25
  const {
42
- variants = [],
43
- style = {},
44
- styles = {},
26
+ style,
45
27
  value,
46
28
  disabled,
47
29
  debugName,
@@ -49,45 +31,39 @@ export const Switch = (props: SwitchProps) => {
49
31
  switchOnLeft,
50
32
  } = others
51
33
 
52
- const variantStyles = useDefaultComponentStyle<'u:Switch', typeof SwitchPresets>('u:Switch', {
53
- variants,
54
- styles,
55
- rootElement: 'wrapper',
56
- transform: StyleSheet.flatten,
57
- })
34
+ const styles = useStylesFor(Switch.styleRegistryName, style)
58
35
 
59
36
  const trackAnimation = useAnimatedVariantStyles({
60
- variantStyles,
37
+ variantStyles: styles,
61
38
  animatedProperties: ['track:off', 'track:disabled', 'track:on', 'track:disabled-on', 'track:disabled-off'],
62
- transition: variantStyles['track:transition'],
39
+ transition: styles['track:transition'],
63
40
  updater: () => {
64
41
  'worklet'
65
42
  let disabledStyle = {}
66
43
  if (disabled) {
67
- disabledStyle = value ? variantStyles['track:disabled-on'] : variantStyles['track:disabled-off']
44
+ disabledStyle = value ? styles['track:disabled-on'] : styles['track:disabled-off']
68
45
  }
69
- const style = value ? variantStyles['track:on'] : variantStyles['track:off']
46
+ const style = value ? styles['track:on'] : styles['track:off']
70
47
 
71
48
  return {
72
49
  ...style,
73
50
  ...disabledStyle,
74
51
  }
75
-
76
52
  },
77
53
  dependencies: [value, disabled],
78
54
  })
79
55
 
80
56
  const thumbAnimation = useAnimatedVariantStyles({
81
- variantStyles,
57
+ variantStyles: styles,
82
58
  animatedProperties: ['thumb:off', 'thumb:disabled', 'thumb:on', 'thumb:disabled-off', 'thumb:disabled-on'],
83
- transition: variantStyles['thumb:transition'],
59
+ transition: styles['thumb:transition'],
84
60
  updater: () => {
85
61
  'worklet'
86
62
  let disabledStyle = {}
87
63
  if (disabled) {
88
- disabledStyle = value ? variantStyles['thumb:disabled-on'] : variantStyles['thumb:disabled-off']
64
+ disabledStyle = value ? styles['thumb:disabled-on'] : styles['thumb:disabled-off']
89
65
  }
90
- const style = value ? variantStyles['thumb:on'] : variantStyles['thumb:off']
66
+ const style = value ? styles['thumb:on'] : styles['thumb:off']
91
67
  return {
92
68
  ...style,
93
69
  ...disabledStyle,
@@ -97,13 +73,14 @@ export const Switch = (props: SwitchProps) => {
97
73
  dependencies: [value, disabled],
98
74
  })
99
75
 
100
- const _switchOnLeft = switchOnLeft ?? variantStyles.__props?.switchOnLeft
76
+ // @ts-expect-error
77
+ const _switchOnLeft = switchOnLeft ?? styles?.__props?.switchOnLeft
101
78
 
102
79
  return <InputBase
103
80
  {...inputBaseProps}
104
81
  debugName={debugName}
105
82
  wrapper={Touchable}
106
- styles={variantStyles}
83
+ style={styles}
107
84
  wrapperProps={{
108
85
  onPress: () => {
109
86
  onValueChange(!value)
@@ -112,26 +89,36 @@ export const Switch = (props: SwitchProps) => {
112
89
  rippleDisabled: true,
113
90
  }}
114
91
  order={_switchOnLeft ? reversedOrder : InputBaseDefaultOrder}
115
- style={style}
116
92
  disabled={disabled}
117
-
118
93
  >
119
94
  <View
120
95
  animated
96
+ animatedStyle={trackAnimation}
121
97
  style={[
122
- variantStyles.track,
123
- disabled && variantStyles['track:disabled'],
124
- trackAnimation,
98
+ styles?.track,
99
+ disabled && styles['track:disabled'],
125
100
  ]}
126
101
  >
127
102
  <View
128
103
  animated
104
+ animatedStyle={thumbAnimation}
129
105
  style={[
130
- variantStyles.thumb,
131
- disabled && variantStyles['thumb:disabled'],
132
- thumbAnimation,
106
+ styles?.thumb,
107
+ disabled && styles['thumb:disabled'],
133
108
  ]}
134
109
  />
135
110
  </View>
136
111
  </InputBase>
137
112
  }
113
+
114
+ Switch.styleRegistryName = 'Switch'
115
+ Switch.elements = [...InputBase.elements, 'track', 'thumb']
116
+ Switch.rootElement = 'wrapper'
117
+
118
+ Switch.withVariantTypes = <S extends AnyRecord>(styles: S) => {
119
+ return Switch as (props: StyledComponentProps<SwitchProps, typeof styles>) => IJSX
120
+ }
121
+
122
+ Switch.defaultProps = {} as Partial<SwitchProps>
123
+
124
+ MobileStyleRegistry.registerComponent(Switch)
@@ -1,8 +1,7 @@
1
- import { createDefaultVariantFactory, includePresets } from '@codeleap/common'
2
1
  import { InputBaseParts, InputBaseStates } from '../InputBase'
3
2
 
4
3
  type AnimatableParts = 'track' | 'thumb'
5
- export type SwitchParts = InputBaseParts | AnimatableParts
4
+ export type SwitchParts = InputBaseParts | AnimatableParts
6
5
 
7
6
  export type SwitchAnimationStates = 'on' | 'off' | 'disabled-on' | 'disabled-off'
8
7
 
@@ -14,8 +13,3 @@ export type SwitchComposition =
14
13
  | `${AnimatableParts}:transition`
15
14
  | `${AnimatableParts}:${SwitchAnimationStates}`
16
15
  | '__props'
17
-
18
- const createSwitchStyle = createDefaultVariantFactory<SwitchComposition>()
19
-
20
- export const SwitchPresets = includePresets((styles) => createSwitchStyle(() => ({ wrapper: styles })))
21
-
@@ -0,0 +1,12 @@
1
+ import { StyledProp } from '@codeleap/styles'
2
+ import { InputBaseProps } from '../InputBase'
3
+ import { SwitchComposition } from './styles'
4
+
5
+ export type SwitchProps =
6
+ Omit<InputBaseProps, 'style'> &
7
+ {
8
+ value: boolean
9
+ onValueChange: (value: boolean) => void
10
+ style?: StyledProp<SwitchComposition>
11
+ switchOnLeft?: boolean
12
+ }
@@ -1,31 +1,27 @@
1
- import * as React from 'react'
2
- import { forwardRef } from 'react'
3
- import {
4
- ComponentVariants,
5
- useDefaultComponentStyle,
6
- BaseViewProps,
7
- TypeGuards,
8
- useState,
9
- } from '@codeleap/common'
10
- import { Animated, Platform, StyleSheet, Text as NativeText, TextProps as RNTextProps } from 'react-native'
11
- import { usePressableFeedback } from '../../utils'
12
- import { TextPresets } from './styles'
13
- import { ComponentWithDefaultProps } from '../../types'
1
+ import React, { forwardRef, useState } from 'react'
2
+ import { TypeGuards } from '@codeleap/common'
3
+ import { Animated, Platform, Text as NativeText } from 'react-native'
4
+ import { TouchableFeedbackConfig, usePressableFeedback } from '../../utils'
5
+ import { TextProps } from './types'
6
+ import { AnyRecord, IJSX, StyledComponentProps, StyledComponentWithProps } from '@codeleap/styles'
7
+ import { MobileStyleRegistry } from '../../Registry'
8
+ import { useStylesFor } from '../../hooks'
14
9
 
15
10
  export * from './styles'
16
-
17
- export type TextProps = RNTextProps & {
18
- text?: React.ReactNode
19
- variants?: ComponentVariants<typeof TextPresets>['variants']
20
- animated?: boolean
21
- colorChangeConfig?: Partial<Animated.TimingAnimationConfig>
22
- debugName?: string
23
- debounce?: number
24
- pressDisabled?: boolean
25
- }
26
-
27
- const _Text = forwardRef<NativeText, TextProps>((textProps, ref) => {
28
- const { variants = [], text, children, onPress, style, debounce = 1000, pressDisabled, ...props } = {
11
+ export * from './types'
12
+
13
+ export const Text = forwardRef<NativeText, TextProps>((textProps, ref) => {
14
+ const {
15
+ text,
16
+ children,
17
+ onPress,
18
+ style,
19
+ debounce,
20
+ pressDisabled,
21
+ animated,
22
+ animatedStyle,
23
+ ...props
24
+ } = {
29
25
  ...Text.defaultProps,
30
26
  ...textProps,
31
27
  }
@@ -38,7 +34,7 @@ const _Text = forwardRef<NativeText, TextProps>((textProps, ref) => {
38
34
  const [pressed, setPressed] = useState(false)
39
35
  const pressedRef = React.useRef(false)
40
36
 
41
- const _onPress:TextProps['onPress'] = (e) => {
37
+ const _onPress: TextProps['onPress'] = (e) => {
42
38
  if (!onPress) return
43
39
 
44
40
  if (TypeGuards.isNumber(debounce)) {
@@ -65,48 +61,56 @@ const _Text = forwardRef<NativeText, TextProps>((textProps, ref) => {
65
61
  }
66
62
  }
67
63
  }
68
- const variantStyles = useDefaultComponentStyle<'u:Text', typeof TextPresets>('u:Text', {
69
- variants,
70
- transform: StyleSheet.flatten,
71
- rootElement: 'text',
72
- })
73
64
 
74
- const styles = StyleSheet.flatten([variantStyles.text, style])
65
+ const styles = useStylesFor(Text.styleRegistryName, style)
75
66
 
76
67
  if (!!text && !TypeGuards.isString(text)) return <>{text}</>
77
68
 
78
- const Component = textProps.animated ? Animated.Text : NativeText
69
+ const Component = animated ? Animated.Text : NativeText
79
70
 
80
71
  const { getFeedbackStyle } = usePressableFeedback(styles, {
81
72
  disabled: !pressPolyfillEnabled,
82
- feedbackConfig: variantStyles.pressFeedback,
73
+ feedbackConfig: styles?.pressFeedback as TouchableFeedbackConfig,
83
74
  hightlightPropertyIn: 'color',
84
75
  hightlightPropertyOut: 'backgroundColor',
85
76
  })
77
+
86
78
  const feedbackStyle = pressPolyfillEnabled ? getFeedbackStyle(pressed) : undefined
87
79
 
88
80
  const pressProps = !!onPress ? {
89
81
  onPress: pressDisabled ? null : _onPress,
90
82
  } : {}
91
83
 
92
- return <Component {...props}
93
- onPressIn={handlePress(true)} onPressOut={handlePress(false)}
94
- style={[styles, feedbackStyle, !!onPress && pressDisabled ? variantStyles['text:disabled'] : null]}
95
- allowFontScaling={false}
96
- {...pressProps}
97
- // @ts-ignore
98
- ref={ref}
99
- >
100
- {text}
101
- {children}
102
- </Component>
103
-
104
- })
105
-
106
- export const Text = _Text as ComponentWithDefaultProps<TextProps & {ref?: React.MutableRefObject<NativeText> }>
84
+ const disabled = !!onPress && pressDisabled
85
+
86
+ return (
87
+ <Component
88
+ {...props}
89
+ onPressIn={handlePress(true)} onPressOut={handlePress(false)}
90
+ style={[styles?.text, animatedStyle, feedbackStyle, disabled ? styles['text:disabled'] : null]}
91
+ allowFontScaling={false}
92
+ {...pressProps}
93
+ // @ts-ignore
94
+ ref={ref}
95
+ >
96
+ {text}
97
+ {children}
98
+ </Component>
99
+ )
100
+ }) as StyledComponentWithProps<TextProps>
101
+
102
+ Text.styleRegistryName = 'Text'
103
+ Text.elements = ['text', 'pressFeedback']
104
+ Text.rootElement = 'text'
105
+
106
+ Text.withVariantTypes = <S extends AnyRecord>(styles: S) => {
107
+ return Text as (props: StyledComponentProps<TextProps & { ref?: React.MutableRefObject<NativeText> }, typeof styles>) => IJSX
108
+ }
107
109
 
108
110
  Text.defaultProps = {
109
- }
111
+ debounce: 1000,
112
+ } as Partial<TextProps>
110
113
 
111
- export const AnimatedText = Animated.createAnimatedComponent(Text)
114
+ MobileStyleRegistry.registerComponent(Text)
112
115
 
116
+ export const AnimatedText = Animated.createAnimatedComponent(Text)
@@ -1,4 +1,4 @@
1
- import { createDefaultVariantFactory, includePresets, StylesOf } from '@codeleap/common'
1
+ import { StylesOf } from '@codeleap/common'
2
2
  import { FeedbackConfig } from '../../utils'
3
3
 
4
4
  export type TextComposition = 'text' | 'pressFeedback' | 'text:disabled'
@@ -6,9 +6,3 @@ export type TextComposition = 'text' | 'pressFeedback' | 'text:disabled'
6
6
  export type TextStylesGen<TCSS = any> = StylesOf<'text', TCSS> & {
7
7
  'pressFeedback'?: FeedbackConfig
8
8
  }
9
-
10
- const createTextStyle = createDefaultVariantFactory<
11
- TextComposition, TextStylesGen
12
- >()
13
-
14
- export const TextPresets = includePresets((styles) => createTextStyle(() => ({ text: styles })))
@@ -0,0 +1,18 @@
1
+ import { StyledProp } from '@codeleap/styles'
2
+ import { ReactNode } from 'react'
3
+ import { TextProps as RNTextProps, Animated, ViewStyle, ImageStyle, TextStyle } from 'react-native'
4
+ import { AnimatedStyleProp } from 'react-native-reanimated'
5
+ import { TextComposition } from './styles'
6
+
7
+ export type TextProps =
8
+ Omit<RNTextProps, 'style'> &
9
+ {
10
+ text?: ReactNode
11
+ animated?: boolean
12
+ colorChangeConfig?: Partial<Animated.TimingAnimationConfig>
13
+ debugName?: string
14
+ debounce?: number
15
+ pressDisabled?: boolean
16
+ style?: StyledProp<TextComposition>
17
+ animatedStyle?: AnimatedStyleProp<ViewStyle | ImageStyle | TextStyle>
18
+ }