@jamadd/react-native-template-ui 0.8.5 → 0.8.7

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 (248) hide show
  1. package/lib/module/components/button/AnimatedThemedPressable.js +13 -3
  2. package/lib/module/components/button/AnimatedThemedPressable.js.map +1 -1
  3. package/lib/module/components/button/ThemedButton.js +84 -23
  4. package/lib/module/components/button/ThemedButton.js.map +1 -1
  5. package/lib/module/components/button/ThemedIconButton.js +62 -16
  6. package/lib/module/components/button/ThemedIconButton.js.map +1 -1
  7. package/lib/module/components/button/ThemedIconTextButton.js +118 -29
  8. package/lib/module/components/button/ThemedIconTextButton.js.map +1 -1
  9. package/lib/module/components/button/ThemedPressable.js +13 -3
  10. package/lib/module/components/button/ThemedPressable.js.map +1 -1
  11. package/lib/module/components/icon/ThemedIcon.js +56 -15
  12. package/lib/module/components/icon/ThemedIcon.js.map +1 -1
  13. package/lib/module/components/list/List.js +131 -39
  14. package/lib/module/components/list/List.js.map +1 -1
  15. package/lib/module/components/loading/ThemedLoading.js +50 -13
  16. package/lib/module/components/loading/ThemedLoading.js.map +1 -1
  17. package/lib/module/components/overlay/actionSheet/ActionSheet.js +64 -19
  18. package/lib/module/components/overlay/actionSheet/ActionSheet.js.map +1 -1
  19. package/lib/module/components/overlay/actionSheet/ActionSheet.web.js +76 -0
  20. package/lib/module/components/overlay/actionSheet/ActionSheet.web.js.map +1 -0
  21. package/lib/module/components/overlay/actionSheet/ActionSheetContentGesture.js +19 -8
  22. package/lib/module/components/overlay/actionSheet/ActionSheetContentGesture.js.map +1 -1
  23. package/lib/module/components/overlay/actionSheet/ActionSheetHeader.js +87 -31
  24. package/lib/module/components/overlay/actionSheet/ActionSheetHeader.js.map +1 -1
  25. package/lib/module/components/overlay/actionSheet/ActionSheetHeader.web.js +113 -0
  26. package/lib/module/components/overlay/actionSheet/ActionSheetHeader.web.js.map +1 -0
  27. package/lib/module/components/overlay/actionSheet/ActionSheetListView.js +69 -28
  28. package/lib/module/components/overlay/actionSheet/ActionSheetListView.js.map +1 -1
  29. package/lib/module/components/overlay/actionSheet/ActionSheetListViewContent.js +39 -14
  30. package/lib/module/components/overlay/actionSheet/ActionSheetListViewContent.js.map +1 -1
  31. package/lib/module/components/overlay/actionSheet/ActionSheetOptionList.js +58 -25
  32. package/lib/module/components/overlay/actionSheet/ActionSheetOptionList.js.map +1 -1
  33. package/lib/module/components/overlay/actionSheet/ActionSheetOptionListItem.js +45 -21
  34. package/lib/module/components/overlay/actionSheet/ActionSheetOptionListItem.js.map +1 -1
  35. package/lib/module/components/overlay/actionSheet/ActionSheetOptions.js +75 -32
  36. package/lib/module/components/overlay/actionSheet/ActionSheetOptions.js.map +1 -1
  37. package/lib/module/components/overlay/actionSheet/ActionSheetScrollView.js +72 -30
  38. package/lib/module/components/overlay/actionSheet/ActionSheetScrollView.js.map +1 -1
  39. package/lib/module/components/overlay/actionSheet/ActionSheetScrollViewContent.js +45 -18
  40. package/lib/module/components/overlay/actionSheet/ActionSheetScrollViewContent.js.map +1 -1
  41. package/lib/module/components/overlay/actionSheet/ActionSheetWrap.js +152 -36
  42. package/lib/module/components/overlay/actionSheet/ActionSheetWrap.js.map +1 -1
  43. package/lib/module/components/overlay/alert/Alert.js +142 -51
  44. package/lib/module/components/overlay/alert/Alert.js.map +1 -1
  45. package/lib/module/components/overlay/alert/AlertButton.js +62 -26
  46. package/lib/module/components/overlay/alert/AlertButton.js.map +1 -1
  47. package/lib/module/components/overlay/alert/AlertButtons.js +58 -23
  48. package/lib/module/components/overlay/alert/AlertButtons.js.map +1 -1
  49. package/lib/module/components/overlay/alert/AlertContent.js +76 -17
  50. package/lib/module/components/overlay/alert/AlertContent.js.map +1 -1
  51. package/lib/module/components/overlay/alert/AlertWrap.js +125 -43
  52. package/lib/module/components/overlay/alert/AlertWrap.js.map +1 -1
  53. package/lib/module/components/overlay/modal/ThemedLoadingModal.js +96 -21
  54. package/lib/module/components/overlay/modal/ThemedLoadingModal.js.map +1 -1
  55. package/lib/module/components/overlay/modal/ThemedModal.js +76 -23
  56. package/lib/module/components/overlay/modal/ThemedModal.js.map +1 -1
  57. package/lib/module/components/overlay/toast/ThemedToast.js +339 -90
  58. package/lib/module/components/overlay/toast/ThemedToast.js.map +1 -1
  59. package/lib/module/components/provider/GestureProvider.js +15 -3
  60. package/lib/module/components/provider/GestureProvider.js.map +1 -1
  61. package/lib/module/components/provider/InsetsProvider.js +15 -3
  62. package/lib/module/components/provider/InsetsProvider.js.map +1 -1
  63. package/lib/module/components/provider/ReactNativeTemplateProviders.js +23 -11
  64. package/lib/module/components/provider/ReactNativeTemplateProviders.js.map +1 -1
  65. package/lib/module/components/provider/ThemeProvider.js +15 -3
  66. package/lib/module/components/provider/ThemeProvider.js.map +1 -1
  67. package/lib/module/components/separator/ThemedSeparator.js +53 -14
  68. package/lib/module/components/separator/ThemedSeparator.js.map +1 -1
  69. package/lib/module/components/slider/Slider.js +625 -137
  70. package/lib/module/components/slider/Slider.js.map +1 -1
  71. package/lib/module/components/slider/ThemedSlider.js +178 -54
  72. package/lib/module/components/slider/ThemedSlider.js.map +1 -1
  73. package/lib/module/components/slider/ThemedSlider.web.js +206 -0
  74. package/lib/module/components/slider/ThemedSlider.web.js.map +1 -0
  75. package/lib/module/components/slider/ThemedSliderStepIndicator.js +40 -15
  76. package/lib/module/components/slider/ThemedSliderStepIndicator.js.map +1 -1
  77. package/lib/module/components/switch/ThemedSwitch.js +81 -21
  78. package/lib/module/components/switch/ThemedSwitch.js.map +1 -1
  79. package/lib/module/components/text/ThemedIconText.js +124 -35
  80. package/lib/module/components/text/ThemedIconText.js.map +1 -1
  81. package/lib/module/components/text/ThemedText.js +15 -3
  82. package/lib/module/components/text/ThemedText.js.map +1 -1
  83. package/lib/module/components/view/AnimatedThemedView.js +42 -11
  84. package/lib/module/components/view/AnimatedThemedView.js.map +1 -1
  85. package/lib/module/components/view/ThemedScreenWrap.js +144 -39
  86. package/lib/module/components/view/ThemedScreenWrap.js.map +1 -1
  87. package/lib/module/components/view/ThemedScreenWrap.web.js +111 -32
  88. package/lib/module/components/view/ThemedScreenWrap.web.js.map +1 -1
  89. package/lib/module/components/view/ThemedScrollView.js +126 -38
  90. package/lib/module/components/view/ThemedScrollView.js.map +1 -1
  91. package/lib/module/components/view/ThemedView.js +33 -10
  92. package/lib/module/components/view/ThemedView.js.map +1 -1
  93. package/lib/module/hooks/button.js +263 -84
  94. package/lib/module/hooks/button.js.map +1 -1
  95. package/lib/module/hooks/list.js +50 -10
  96. package/lib/module/hooks/list.js.map +1 -1
  97. package/lib/module/hooks/overlay.js +575 -187
  98. package/lib/module/hooks/overlay.js.map +1 -1
  99. package/lib/module/hooks/react.js +90 -27
  100. package/lib/module/hooks/react.js.map +1 -1
  101. package/lib/module/hooks/reanimated.js.map +1 -1
  102. package/lib/module/hooks/style.js +43 -18
  103. package/lib/module/hooks/style.js.map +1 -1
  104. package/lib/module/hooks/switch.js +182 -43
  105. package/lib/module/hooks/switch.js.map +1 -1
  106. package/lib/module/hooks/theme.js +17 -8
  107. package/lib/module/hooks/theme.js.map +1 -1
  108. package/lib/module/hooks/view.js +56 -14
  109. package/lib/module/hooks/view.js.map +1 -1
  110. package/lib/module/index.js +2 -2
  111. package/lib/module/index.js.map +1 -1
  112. package/lib/module/utils/reanimated/func.js +60 -10
  113. package/lib/module/utils/reanimated/func.js.map +1 -1
  114. package/lib/typescript/src/components/overlay/actionSheet/ActionSheet.web.d.ts +5 -0
  115. package/lib/typescript/src/components/overlay/actionSheet/ActionSheet.web.d.ts.map +1 -0
  116. package/lib/typescript/src/components/overlay/actionSheet/ActionSheetContentGesture.d.ts +0 -2
  117. package/lib/typescript/src/components/overlay/actionSheet/ActionSheetContentGesture.d.ts.map +1 -1
  118. package/lib/typescript/src/components/overlay/actionSheet/ActionSheetHeader.d.ts +0 -2
  119. package/lib/typescript/src/components/overlay/actionSheet/ActionSheetHeader.d.ts.map +1 -1
  120. package/lib/typescript/src/components/overlay/actionSheet/ActionSheetHeader.web.d.ts +4 -0
  121. package/lib/typescript/src/components/overlay/actionSheet/ActionSheetHeader.web.d.ts.map +1 -0
  122. package/lib/typescript/src/components/overlay/actionSheet/ActionSheetListView.d.ts +0 -2
  123. package/lib/typescript/src/components/overlay/actionSheet/ActionSheetListView.d.ts.map +1 -1
  124. package/lib/typescript/src/components/overlay/actionSheet/ActionSheetListViewContent.d.ts +0 -2
  125. package/lib/typescript/src/components/overlay/actionSheet/ActionSheetListViewContent.d.ts.map +1 -1
  126. package/lib/typescript/src/components/overlay/actionSheet/ActionSheetOptionList.d.ts +0 -2
  127. package/lib/typescript/src/components/overlay/actionSheet/ActionSheetOptionList.d.ts.map +1 -1
  128. package/lib/typescript/src/components/overlay/actionSheet/ActionSheetOptionListItem.d.ts +0 -2
  129. package/lib/typescript/src/components/overlay/actionSheet/ActionSheetOptionListItem.d.ts.map +1 -1
  130. package/lib/typescript/src/components/overlay/actionSheet/ActionSheetOptions.d.ts +0 -2
  131. package/lib/typescript/src/components/overlay/actionSheet/ActionSheetOptions.d.ts.map +1 -1
  132. package/lib/typescript/src/components/overlay/actionSheet/ActionSheetScrollView.d.ts +0 -2
  133. package/lib/typescript/src/components/overlay/actionSheet/ActionSheetScrollView.d.ts.map +1 -1
  134. package/lib/typescript/src/components/overlay/actionSheet/ActionSheetScrollViewContent.d.ts +0 -2
  135. package/lib/typescript/src/components/overlay/actionSheet/ActionSheetScrollViewContent.d.ts.map +1 -1
  136. package/lib/typescript/src/components/overlay/actionSheet/ActionSheetWrap.d.ts +0 -2
  137. package/lib/typescript/src/components/overlay/actionSheet/ActionSheetWrap.d.ts.map +1 -1
  138. package/lib/typescript/src/components/slider/Slider.d.ts +3 -2
  139. package/lib/typescript/src/components/slider/Slider.d.ts.map +1 -1
  140. package/lib/typescript/src/components/slider/ThemedSlider.d.ts.map +1 -1
  141. package/lib/typescript/src/components/slider/ThemedSlider.web.d.ts +5 -0
  142. package/lib/typescript/src/components/slider/ThemedSlider.web.d.ts.map +1 -0
  143. package/lib/typescript/src/components/slider/ThemedSliderStepIndicator.d.ts +3 -2
  144. package/lib/typescript/src/components/slider/ThemedSliderStepIndicator.d.ts.map +1 -1
  145. package/lib/typescript/src/components/view/AnimatedView.d.ts +0 -2
  146. package/lib/typescript/src/components/view/AnimatedView.d.ts.map +1 -1
  147. package/lib/typescript/src/hooks/overlay.d.ts +0 -27
  148. package/lib/typescript/src/hooks/overlay.d.ts.map +1 -1
  149. package/lib/typescript/src/hooks/switch.d.ts +1 -20
  150. package/lib/typescript/src/hooks/switch.d.ts.map +1 -1
  151. package/lib/typescript/src/types/list.d.ts +1 -10
  152. package/lib/typescript/src/types/list.d.ts.map +1 -1
  153. package/lib/typescript/src/types/overlay.d.ts +1 -31
  154. package/lib/typescript/src/types/overlay.d.ts.map +1 -1
  155. package/lib/typescript/src/utils/overlay/const.d.ts +0 -33
  156. package/lib/typescript/src/utils/overlay/const.d.ts.map +1 -1
  157. package/lib/typescript/src/utils/reanimated/func.d.ts +1 -5
  158. package/lib/typescript/src/utils/reanimated/func.d.ts.map +1 -1
  159. package/lib/typescript/src/utils/switch/const.d.ts +1 -2
  160. package/lib/typescript/src/utils/switch/const.d.ts.map +1 -1
  161. package/package.json +14 -15
  162. package/src/components/button/AnimatedPressable.tsx +0 -7
  163. package/src/components/button/AnimatedThemedPressable.tsx +0 -12
  164. package/src/components/button/ThemedButton.tsx +0 -45
  165. package/src/components/button/ThemedIconButton.tsx +0 -33
  166. package/src/components/button/ThemedIconTextButton.tsx +0 -56
  167. package/src/components/button/ThemedPressable.tsx +0 -12
  168. package/src/components/icon/ThemedIcon.tsx +0 -31
  169. package/src/components/list/List.tsx +0 -55
  170. package/src/components/loading/ThemedLoading.tsx +0 -29
  171. package/src/components/overlay/actionSheet/ActionSheet.tsx +0 -31
  172. package/src/components/overlay/actionSheet/ActionSheetContentGesture.tsx +0 -15
  173. package/src/components/overlay/actionSheet/ActionSheetHeader.tsx +0 -72
  174. package/src/components/overlay/actionSheet/ActionSheetListView.tsx +0 -54
  175. package/src/components/overlay/actionSheet/ActionSheetListViewContent.tsx +0 -32
  176. package/src/components/overlay/actionSheet/ActionSheetOptionList.tsx +0 -51
  177. package/src/components/overlay/actionSheet/ActionSheetOptionListItem.tsx +0 -43
  178. package/src/components/overlay/actionSheet/ActionSheetOptions.tsx +0 -61
  179. package/src/components/overlay/actionSheet/ActionSheetScrollView.tsx +0 -57
  180. package/src/components/overlay/actionSheet/ActionSheetScrollViewContent.tsx +0 -38
  181. package/src/components/overlay/actionSheet/ActionSheetWrap.tsx +0 -75
  182. package/src/components/overlay/alert/Alert.tsx +0 -86
  183. package/src/components/overlay/alert/AlertButton.tsx +0 -41
  184. package/src/components/overlay/alert/AlertButtons.tsx +0 -32
  185. package/src/components/overlay/alert/AlertContent.tsx +0 -60
  186. package/src/components/overlay/alert/AlertWrap.tsx +0 -93
  187. package/src/components/overlay/modal/ThemedLoadingModal.tsx +0 -47
  188. package/src/components/overlay/modal/ThemedModal.tsx +0 -42
  189. package/src/components/overlay/toast/ThemedToast.tsx +0 -160
  190. package/src/components/provider/GestureProvider.tsx +0 -9
  191. package/src/components/provider/InsetsProvider.tsx +0 -11
  192. package/src/components/provider/ReactNativeTemplateProviders.tsx +0 -20
  193. package/src/components/provider/ThemeProvider.tsx +0 -8
  194. package/src/components/separator/ThemedSeparator.tsx +0 -24
  195. package/src/components/slider/Slider.tsx +0 -229
  196. package/src/components/slider/ThemedSlider.tsx +0 -103
  197. package/src/components/slider/ThemedSliderStepIndicator.tsx +0 -24
  198. package/src/components/switch/ThemedSwitch.tsx +0 -49
  199. package/src/components/text/Text.tsx +0 -7
  200. package/src/components/text/ThemedIconText.tsx +0 -58
  201. package/src/components/text/ThemedText.tsx +0 -7
  202. package/src/components/view/AnimatedThemedView.tsx +0 -18
  203. package/src/components/view/AnimatedView.tsx +0 -7
  204. package/src/components/view/Box.tsx +0 -7
  205. package/src/components/view/ThemedScreenWrap.tsx +0 -48
  206. package/src/components/view/ThemedScreenWrap.web.tsx +0 -41
  207. package/src/components/view/ThemedScrollView.tsx +0 -54
  208. package/src/components/view/ThemedView.tsx +0 -19
  209. package/src/hooks/button.ts +0 -152
  210. package/src/hooks/list.ts +0 -42
  211. package/src/hooks/overlay.ts +0 -471
  212. package/src/hooks/react.ts +0 -34
  213. package/src/hooks/reanimated.ts +0 -6
  214. package/src/hooks/separator.ts +0 -29
  215. package/src/hooks/style.ts +0 -79
  216. package/src/hooks/switch.ts +0 -119
  217. package/src/hooks/theme.ts +0 -65
  218. package/src/hooks/view.ts +0 -28
  219. package/src/index.ts +0 -59
  220. package/src/test/utils/const.ts +0 -9
  221. package/src/test/utils/func.ts +0 -55
  222. package/src/test/utils/testingLib.tsx +0 -17
  223. package/src/types/button.ts +0 -50
  224. package/src/types/global.d.ts +0 -5
  225. package/src/types/icon.ts +0 -21
  226. package/src/types/list.ts +0 -61
  227. package/src/types/loading.ts +0 -14
  228. package/src/types/overlay.ts +0 -216
  229. package/src/types/provider.ts +0 -6
  230. package/src/types/react.ts +0 -8
  231. package/src/types/reanimated.ts +0 -11
  232. package/src/types/separator.ts +0 -28
  233. package/src/types/slider.ts +0 -59
  234. package/src/types/style.ts +0 -26
  235. package/src/types/switch.ts +0 -31
  236. package/src/types/text.ts +0 -25
  237. package/src/types/theme.ts +0 -39
  238. package/src/types/view.ts +0 -58
  239. package/src/utils/button/const.ts +0 -10
  240. package/src/utils/overlay/const.ts +0 -77
  241. package/src/utils/overlay/func.ts +0 -107
  242. package/src/utils/reanimated/func.ts +0 -39
  243. package/src/utils/slider/const.ts +0 -23
  244. package/src/utils/style/const.ts +0 -4
  245. package/src/utils/style/func.ts +0 -37
  246. package/src/utils/switch/const.ts +0 -2
  247. package/src/utils/theme/const.ts +0 -189
  248. package/src/utils/theme/restyle.ts +0 -87
@@ -1,60 +0,0 @@
1
- import type { FC } from 'react';
2
- import type { AlertProps } from '../../../types/overlay';
3
- import ThemedText from '../../text/ThemedText';
4
-
5
- const AlertContent: FC<
6
- Pick<
7
- AlertProps,
8
- 'title' | 'titleTextProps' | 'description' | 'descriptionTextProps'
9
- >
10
- > = ({
11
- title,
12
- titleTextProps: {
13
- textVariant: titleTextVariant,
14
- textFontSize: titleTextFontSize,
15
- textFontWeight: titleTextFontWeight,
16
- textColor: titleTextColor,
17
- textStyle: titleTextStyle,
18
- textProps: titleTextProps,
19
- } = {},
20
- description,
21
- descriptionTextProps: {
22
- textVariant: descriptionTextVariant,
23
- textFontSize: descriptionTextFontSize,
24
- textFontWeight: descriptionTextFontWeight,
25
- textColor: descriptionTextColor,
26
- textStyle: descriptionTextStyle,
27
- textProps: descriptionTextProps,
28
- } = {},
29
- }) => {
30
- return (
31
- <>
32
- <ThemedText
33
- textAlign={'center'}
34
- fontWeight={titleTextFontWeight ?? 'bold'}
35
- variant={titleTextVariant}
36
- fontSize={titleTextFontSize}
37
- color={titleTextColor}
38
- style={titleTextStyle}
39
- {...titleTextProps}
40
- >
41
- {title}
42
- </ThemedText>
43
- {!!description && (
44
- <ThemedText
45
- textAlign={'center'}
46
- variant={descriptionTextVariant ?? 'textS'}
47
- fontSize={descriptionTextFontSize}
48
- fontWeight={descriptionTextFontWeight}
49
- color={descriptionTextColor}
50
- style={descriptionTextStyle}
51
- {...descriptionTextProps}
52
- >
53
- {description}
54
- </ThemedText>
55
- )}
56
- </>
57
- );
58
- };
59
-
60
- export default AlertContent;
@@ -1,93 +0,0 @@
1
- import { useEffect, type FC } from 'react';
2
- import type { ViewStyle } from 'react-native';
3
- import { useAnimatedStyle, type SharedValue } from 'react-native-reanimated';
4
- import type { AlertProps } from '../../../types/overlay';
5
- import type { AnimationSharedValue } from '../../../types/reanimated';
6
- import type { PropsWithRequiredChildren } from '../../../types/view';
7
- import { overlayMaxWidthPercent } from '../../../utils/overlay/const';
8
- import { getAlertContext } from '../../../utils/overlay/func';
9
- import { updateSharedValWithSpring } from '../../../utils/reanimated/func';
10
- import AnimatedThemedView from '../../view/AnimatedThemedView';
11
- import ThemedModal from '../modal/ThemedModal';
12
-
13
- const AlertWrap: FC<
14
- PropsWithRequiredChildren<
15
- Pick<
16
- AlertProps,
17
- | 'customShowAnimation'
18
- | 'wrapProps'
19
- | 'title'
20
- | 'description'
21
- | 'buttons'
22
- | 'dismissable'
23
- > & {
24
- visible: boolean;
25
- showSharedVal: AnimationSharedValue;
26
- }
27
- >
28
- > = ({
29
- customShowAnimation,
30
- wrapProps,
31
- title,
32
- description,
33
- buttons,
34
- dismissable,
35
- visible,
36
- showSharedVal,
37
- children,
38
- }) => {
39
- const animatedStyle = useAnimatedStyle<ViewStyle>(
40
- () => ({
41
- transform: [{ scale: showSharedVal.get() }],
42
- }),
43
- [showSharedVal]
44
- );
45
- useEffect(() => {
46
- if (!visible) {
47
- return;
48
- }
49
-
50
- if (customShowAnimation) {
51
- customShowAnimation(showSharedVal, 1);
52
- } else {
53
- updateSharedValWithSpring(showSharedVal as SharedValue<number>, 1, {
54
- stiffness: 1800,
55
- damping: 200,
56
- mass: 20,
57
- });
58
- }
59
- }, [
60
- customShowAnimation,
61
- title,
62
- description,
63
- buttons,
64
- visible,
65
- showSharedVal,
66
- ]);
67
-
68
- const { onDismiss } = getAlertContext();
69
- const modalOnDismiss = () => {
70
- onDismiss?.();
71
- };
72
-
73
- return (
74
- <ThemedModal
75
- visible={visible}
76
- onDismiss={modalOnDismiss}
77
- dismissable={dismissable}
78
- >
79
- <AnimatedThemedView
80
- width={overlayMaxWidthPercent}
81
- padding={'l'}
82
- gap={'m'}
83
- backgroundColor={'background'}
84
- animatedStyle={animatedStyle}
85
- {...wrapProps}
86
- >
87
- {children}
88
- </AnimatedThemedView>
89
- </ThemedModal>
90
- );
91
- };
92
-
93
- export default AlertWrap;
@@ -1,47 +0,0 @@
1
- import type { FC } from 'react';
2
- import type { ThemedLoadingModalProps } from '../../../types/overlay';
3
- import { overlayMaxWidthPercent } from '../../../utils/overlay/const';
4
- import ThemedLoading from '../../loading/ThemedLoading';
5
- import ThemedText from '../../text/ThemedText';
6
- import ThemedModal from './ThemedModal';
7
-
8
- const ThemedLoadingModal: FC<ThemedLoadingModalProps> = ({
9
- loadingSize,
10
- loadingColor,
11
- loadingProps,
12
- text,
13
- textVariant,
14
- textFontSize,
15
- textFontWeight,
16
- textColor = 'textOverlay',
17
- textStyle,
18
- textProps,
19
- ...props
20
- }) => {
21
- return (
22
- <ThemedModal {...props}>
23
- <ThemedLoading
24
- size={loadingSize}
25
- color={loadingColor}
26
- {...loadingProps}
27
- />
28
- {!!text && (
29
- <ThemedText
30
- textAlign={'center'}
31
- maxWidth={overlayMaxWidthPercent}
32
- marginTop={'m'}
33
- variant={textVariant}
34
- fontSize={textFontSize}
35
- fontWeight={textFontWeight}
36
- color={textColor}
37
- style={textStyle}
38
- {...textProps}
39
- >
40
- {text}
41
- </ThemedText>
42
- )}
43
- </ThemedModal>
44
- );
45
- };
46
-
47
- export default ThemedLoadingModal;
@@ -1,42 +0,0 @@
1
- import type { FC } from 'react';
2
- import { Modal, StyleSheet } from 'react-native';
3
- import type { ThemedModalProps } from '../../../types/overlay';
4
- import ThemedPressable from '../../button/ThemedPressable';
5
- import GestureProvider from '../../provider/GestureProvider';
6
- import ThemedView from '../../view/ThemedView';
7
-
8
- const ThemedModal: FC<ThemedModalProps> = ({
9
- contentWrapProps,
10
- onDismiss,
11
- dismissable = true,
12
- children,
13
- ...props
14
- }) => {
15
- return (
16
- <Modal
17
- animationType={'fade'}
18
- transparent={true}
19
- statusBarTranslucent={true}
20
- {...props}
21
- >
22
- <GestureProvider>
23
- <ThemedView
24
- alignItems={'center'}
25
- justifyContent={'center'}
26
- backgroundColor={'backgroundOverlay'}
27
- style={StyleSheet.absoluteFill}
28
- {...contentWrapProps}
29
- >
30
- <ThemedPressable
31
- onPress={onDismiss ?? null}
32
- disabled={!dismissable}
33
- style={StyleSheet.absoluteFill}
34
- />
35
- {children}
36
- </ThemedView>
37
- </GestureProvider>
38
- </Modal>
39
- );
40
- };
41
-
42
- export default ThemedModal;
@@ -1,160 +0,0 @@
1
- import { useEffect, type FC } from 'react';
2
- import {
3
- interpolate,
4
- useAnimatedStyle,
5
- withTiming,
6
- } from 'react-native-reanimated';
7
- import { scheduleOnRN } from 'react-native-worklets';
8
- import { useAnimationSharedVal } from '../../../hooks/reanimated';
9
- import { useInsetsStyle } from '../../../hooks/style';
10
- import type { ThemedToastProps } from '../../../types/overlay';
11
- import type { AnimatedThemedViewProps } from '../../../types/view';
12
- import {
13
- OverlayDismissResultType,
14
- overlayMaxWidthPercent,
15
- ToastDuration,
16
- ToastType,
17
- } from '../../../utils/overlay/const';
18
- import ThemedText from '../../text/ThemedText';
19
- import AnimatedThemedView from '../../view/AnimatedThemedView';
20
-
21
- const ThemedToast: FC<ThemedToastProps> = ({
22
- type = ToastType.Bottom,
23
- duration = ToastDuration.Short,
24
- onDismiss,
25
- top: propsTop,
26
- bottom: propsBottom,
27
- left: propsLeft,
28
- right: propsRight,
29
- insetsPadding,
30
- insetPaddingTop,
31
- insetPaddingBottom,
32
- insetPaddingLeft,
33
- insetPaddingRight,
34
- text,
35
- textVariant = 'textS',
36
- textFontSize,
37
- textFontWeight,
38
- textColor = 'textOverlay',
39
- textStyle,
40
- textProps,
41
- ...props
42
- }) => {
43
- const showSharedVal = useAnimationSharedVal();
44
- const { paddingTop, paddingBottom, paddingLeft, paddingRight } =
45
- useInsetsStyle({
46
- insets: true,
47
- insetsPadding: insetsPadding ?? 'm',
48
- insetPaddingTop,
49
- insetPaddingBottom,
50
- insetPaddingLeft,
51
- insetPaddingRight,
52
- });
53
- const animatedStyle = useAnimatedStyle(() => {
54
- let outputY = 0;
55
- switch (type) {
56
- case ToastType.Top:
57
- case ToastType.TopLeft:
58
- case ToastType.TopRight:
59
- if (paddingTop) {
60
- outputY = -(paddingTop as number) * 2;
61
- }
62
- break;
63
- case ToastType.Bottom:
64
- case ToastType.BottomLeft:
65
- case ToastType.BottomRight:
66
- if (paddingBottom) {
67
- outputY = (paddingBottom as number) * 2;
68
- }
69
- break;
70
- default:
71
- break;
72
- }
73
-
74
- return {
75
- opacity: showSharedVal.value,
76
- transform: [
77
- { translateY: interpolate(showSharedVal.value, [0, 1], [outputY, 0]) },
78
- ],
79
- };
80
- }, [type, showSharedVal, paddingTop, paddingBottom]);
81
- useEffect(() => {
82
- showSharedVal.set(withTiming(1));
83
- const timeout = setTimeout(() => {
84
- showSharedVal.set(
85
- withTiming(0, undefined, () => {
86
- if (onDismiss) {
87
- scheduleOnRN(onDismiss, {
88
- resultType: OverlayDismissResultType.Toast,
89
- type,
90
- text,
91
- duration,
92
- });
93
- }
94
- })
95
- );
96
- }, duration);
97
-
98
- return () => {
99
- clearTimeout(timeout);
100
- };
101
- }, [text]);
102
-
103
- const top: AnimatedThemedViewProps['top'] = [
104
- ToastType.Top,
105
- ToastType.TopLeft,
106
- ToastType.TopRight,
107
- ].includes(type)
108
- ? (propsTop ?? paddingTop)
109
- : undefined;
110
- const bottom: AnimatedThemedViewProps['bottom'] = [
111
- ToastType.Bottom,
112
- ToastType.BottomLeft,
113
- ToastType.BottomRight,
114
- ].includes(type)
115
- ? (propsBottom ?? paddingBottom)
116
- : undefined;
117
- const left: AnimatedThemedViewProps['left'] = [
118
- ToastType.TopLeft,
119
- ToastType.BottomLeft,
120
- ].includes(type)
121
- ? (propsLeft ?? paddingLeft)
122
- : undefined;
123
- const right: AnimatedThemedViewProps['right'] = [
124
- ToastType.TopRight,
125
- ToastType.BottomRight,
126
- ].includes(type)
127
- ? (propsRight ?? paddingRight)
128
- : undefined;
129
-
130
- return (
131
- <AnimatedThemedView
132
- position={'absolute'}
133
- top={top}
134
- bottom={bottom}
135
- left={left}
136
- right={right}
137
- alignSelf={'center'}
138
- maxWidth={overlayMaxWidthPercent}
139
- paddingVertical={'xxs'}
140
- paddingHorizontal={'s'}
141
- backgroundColor={'backgroundOverlay'}
142
- animatedStyle={animatedStyle}
143
- {...props}
144
- >
145
- <ThemedText
146
- numberOfLines={1}
147
- variant={textVariant}
148
- fontSize={textFontSize}
149
- fontWeight={textFontWeight}
150
- color={textColor}
151
- style={textStyle}
152
- {...textProps}
153
- >
154
- {text}
155
- </ThemedText>
156
- </AnimatedThemedView>
157
- );
158
- };
159
-
160
- export default ThemedToast;
@@ -1,9 +0,0 @@
1
- import type { FC } from 'react';
2
- import { GestureHandlerRootView } from 'react-native-gesture-handler';
3
- import type { GestureHandlerRootViewProps } from 'react-native-gesture-handler/lib/typescript/components/GestureHandlerRootView';
4
-
5
- const GestureProvider: FC<GestureHandlerRootViewProps> = (props) => (
6
- <GestureHandlerRootView {...props} />
7
- );
8
-
9
- export default GestureProvider;
@@ -1,11 +0,0 @@
1
- import type { FC } from 'react';
2
- import {
3
- SafeAreaProvider,
4
- type SafeAreaProviderProps,
5
- } from 'react-native-safe-area-context';
6
-
7
- const InsetsProvider: FC<SafeAreaProviderProps> = (props) => (
8
- <SafeAreaProvider {...props} />
9
- );
10
-
11
- export default InsetsProvider;
@@ -1,20 +0,0 @@
1
- import type { FC } from 'react';
2
- import type { ReactNativeTemplateProvidersProps } from '../../types/provider';
3
- import GestureProvider from './GestureProvider';
4
- import InsetsProvider from './InsetsProvider';
5
- import ThemeProvider from './ThemeProvider';
6
-
7
- const ReactNativeTemplateProviders: FC<ReactNativeTemplateProvidersProps> = ({
8
- theme,
9
- children,
10
- }) => {
11
- return (
12
- <GestureProvider>
13
- <InsetsProvider>
14
- <ThemeProvider theme={theme}>{children}</ThemeProvider>
15
- </InsetsProvider>
16
- </GestureProvider>
17
- );
18
- };
19
-
20
- export default ReactNativeTemplateProviders;
@@ -1,8 +0,0 @@
1
- import { ThemeProvider as RestyleThemeProvider } from '@shopify/restyle';
2
- import type { ComponentProps, FC } from 'react';
3
-
4
- const ThemeProvider: FC<ComponentProps<typeof RestyleThemeProvider>> = (
5
- props
6
- ) => <RestyleThemeProvider {...props} />;
7
-
8
- export default ThemeProvider;
@@ -1,24 +0,0 @@
1
- import { type FC } from 'react';
2
- import type { ThemedSeparatorProps } from '../../types/separator';
3
- import { BorderSize } from '../../utils/theme/const';
4
- import ThemedView from '../view/ThemedView';
5
-
6
- const ThemedSeparator: FC<ThemedSeparatorProps> = ({
7
- size = BorderSize.S,
8
- vertical = false,
9
- backgroundColor = 'separator',
10
- bg,
11
- ...props
12
- }) => {
13
- return (
14
- <ThemedView
15
- alignSelf={'stretch'}
16
- width={vertical ? size : undefined}
17
- height={vertical ? undefined : size}
18
- backgroundColor={bg ?? backgroundColor}
19
- {...props}
20
- />
21
- );
22
- };
23
-
24
- export default ThemedSeparator;