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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (144) hide show
  1. package/lib/module/components/overlay/actionSheet/ActionSheet.web.js +31 -0
  2. package/lib/module/components/overlay/actionSheet/ActionSheet.web.js.map +1 -0
  3. package/lib/module/components/overlay/actionSheet/ActionSheetHeader.web.js +57 -0
  4. package/lib/module/components/overlay/actionSheet/ActionSheetHeader.web.js.map +1 -0
  5. package/lib/module/components/overlay/actionSheet/ActionSheetListView.js +1 -1
  6. package/lib/module/components/overlay/actionSheet/ActionSheetListView.js.map +1 -1
  7. package/lib/module/components/overlay/actionSheet/ActionSheetOptions.js +1 -1
  8. package/lib/module/components/overlay/actionSheet/ActionSheetOptions.js.map +1 -1
  9. package/lib/module/components/overlay/actionSheet/ActionSheetScrollView.js +1 -1
  10. package/lib/module/components/overlay/actionSheet/ActionSheetScrollView.js.map +1 -1
  11. package/lib/module/components/slider/ThemedSlider.web.js +82 -0
  12. package/lib/module/components/slider/ThemedSlider.web.js.map +1 -0
  13. package/lib/module/index.js +2 -2
  14. package/lib/module/index.js.map +1 -1
  15. package/lib/typescript/src/components/overlay/actionSheet/ActionSheet.web.d.ts +5 -0
  16. package/lib/typescript/src/components/overlay/actionSheet/ActionSheet.web.d.ts.map +1 -0
  17. package/lib/typescript/src/components/overlay/actionSheet/ActionSheetContentGesture.d.ts +0 -2
  18. package/lib/typescript/src/components/overlay/actionSheet/ActionSheetContentGesture.d.ts.map +1 -1
  19. package/lib/typescript/src/components/overlay/actionSheet/ActionSheetHeader.d.ts +0 -2
  20. package/lib/typescript/src/components/overlay/actionSheet/ActionSheetHeader.d.ts.map +1 -1
  21. package/lib/typescript/src/components/overlay/actionSheet/ActionSheetHeader.web.d.ts +4 -0
  22. package/lib/typescript/src/components/overlay/actionSheet/ActionSheetHeader.web.d.ts.map +1 -0
  23. package/lib/typescript/src/components/overlay/actionSheet/ActionSheetListView.d.ts +0 -2
  24. package/lib/typescript/src/components/overlay/actionSheet/ActionSheetListView.d.ts.map +1 -1
  25. package/lib/typescript/src/components/overlay/actionSheet/ActionSheetListViewContent.d.ts +0 -2
  26. package/lib/typescript/src/components/overlay/actionSheet/ActionSheetListViewContent.d.ts.map +1 -1
  27. package/lib/typescript/src/components/overlay/actionSheet/ActionSheetOptionList.d.ts +0 -2
  28. package/lib/typescript/src/components/overlay/actionSheet/ActionSheetOptionList.d.ts.map +1 -1
  29. package/lib/typescript/src/components/overlay/actionSheet/ActionSheetOptionListItem.d.ts +0 -2
  30. package/lib/typescript/src/components/overlay/actionSheet/ActionSheetOptionListItem.d.ts.map +1 -1
  31. package/lib/typescript/src/components/overlay/actionSheet/ActionSheetOptions.d.ts +0 -2
  32. package/lib/typescript/src/components/overlay/actionSheet/ActionSheetOptions.d.ts.map +1 -1
  33. package/lib/typescript/src/components/overlay/actionSheet/ActionSheetScrollView.d.ts +0 -2
  34. package/lib/typescript/src/components/overlay/actionSheet/ActionSheetScrollView.d.ts.map +1 -1
  35. package/lib/typescript/src/components/overlay/actionSheet/ActionSheetScrollViewContent.d.ts +0 -2
  36. package/lib/typescript/src/components/overlay/actionSheet/ActionSheetScrollViewContent.d.ts.map +1 -1
  37. package/lib/typescript/src/components/overlay/actionSheet/ActionSheetWrap.d.ts +0 -2
  38. package/lib/typescript/src/components/overlay/actionSheet/ActionSheetWrap.d.ts.map +1 -1
  39. package/lib/typescript/src/components/slider/ThemedSlider.web.d.ts +5 -0
  40. package/lib/typescript/src/components/slider/ThemedSlider.web.d.ts.map +1 -0
  41. package/lib/typescript/src/components/view/AnimatedView.d.ts +0 -2
  42. package/lib/typescript/src/components/view/AnimatedView.d.ts.map +1 -1
  43. package/lib/typescript/src/hooks/overlay.d.ts +0 -27
  44. package/lib/typescript/src/hooks/overlay.d.ts.map +1 -1
  45. package/lib/typescript/src/hooks/switch.d.ts +1 -20
  46. package/lib/typescript/src/hooks/switch.d.ts.map +1 -1
  47. package/lib/typescript/src/types/list.d.ts +1 -10
  48. package/lib/typescript/src/types/list.d.ts.map +1 -1
  49. package/lib/typescript/src/types/overlay.d.ts +1 -31
  50. package/lib/typescript/src/types/overlay.d.ts.map +1 -1
  51. package/lib/typescript/src/utils/overlay/const.d.ts +0 -33
  52. package/lib/typescript/src/utils/overlay/const.d.ts.map +1 -1
  53. package/lib/typescript/src/utils/reanimated/func.d.ts +1 -5
  54. package/lib/typescript/src/utils/reanimated/func.d.ts.map +1 -1
  55. package/lib/typescript/src/utils/switch/const.d.ts +1 -2
  56. package/lib/typescript/src/utils/switch/const.d.ts.map +1 -1
  57. package/package.json +1 -2
  58. package/src/components/button/AnimatedPressable.tsx +0 -7
  59. package/src/components/button/AnimatedThemedPressable.tsx +0 -12
  60. package/src/components/button/ThemedButton.tsx +0 -45
  61. package/src/components/button/ThemedIconButton.tsx +0 -33
  62. package/src/components/button/ThemedIconTextButton.tsx +0 -56
  63. package/src/components/button/ThemedPressable.tsx +0 -12
  64. package/src/components/icon/ThemedIcon.tsx +0 -31
  65. package/src/components/list/List.tsx +0 -55
  66. package/src/components/loading/ThemedLoading.tsx +0 -29
  67. package/src/components/overlay/actionSheet/ActionSheet.tsx +0 -31
  68. package/src/components/overlay/actionSheet/ActionSheetContentGesture.tsx +0 -15
  69. package/src/components/overlay/actionSheet/ActionSheetHeader.tsx +0 -72
  70. package/src/components/overlay/actionSheet/ActionSheetListView.tsx +0 -54
  71. package/src/components/overlay/actionSheet/ActionSheetListViewContent.tsx +0 -32
  72. package/src/components/overlay/actionSheet/ActionSheetOptionList.tsx +0 -51
  73. package/src/components/overlay/actionSheet/ActionSheetOptionListItem.tsx +0 -43
  74. package/src/components/overlay/actionSheet/ActionSheetOptions.tsx +0 -61
  75. package/src/components/overlay/actionSheet/ActionSheetScrollView.tsx +0 -57
  76. package/src/components/overlay/actionSheet/ActionSheetScrollViewContent.tsx +0 -38
  77. package/src/components/overlay/actionSheet/ActionSheetWrap.tsx +0 -75
  78. package/src/components/overlay/alert/Alert.tsx +0 -86
  79. package/src/components/overlay/alert/AlertButton.tsx +0 -41
  80. package/src/components/overlay/alert/AlertButtons.tsx +0 -32
  81. package/src/components/overlay/alert/AlertContent.tsx +0 -60
  82. package/src/components/overlay/alert/AlertWrap.tsx +0 -93
  83. package/src/components/overlay/modal/ThemedLoadingModal.tsx +0 -47
  84. package/src/components/overlay/modal/ThemedModal.tsx +0 -42
  85. package/src/components/overlay/toast/ThemedToast.tsx +0 -160
  86. package/src/components/provider/GestureProvider.tsx +0 -9
  87. package/src/components/provider/InsetsProvider.tsx +0 -11
  88. package/src/components/provider/ReactNativeTemplateProviders.tsx +0 -20
  89. package/src/components/provider/ThemeProvider.tsx +0 -8
  90. package/src/components/separator/ThemedSeparator.tsx +0 -24
  91. package/src/components/slider/Slider.tsx +0 -229
  92. package/src/components/slider/ThemedSlider.tsx +0 -103
  93. package/src/components/slider/ThemedSliderStepIndicator.tsx +0 -24
  94. package/src/components/switch/ThemedSwitch.tsx +0 -49
  95. package/src/components/text/Text.tsx +0 -7
  96. package/src/components/text/ThemedIconText.tsx +0 -58
  97. package/src/components/text/ThemedText.tsx +0 -7
  98. package/src/components/view/AnimatedThemedView.tsx +0 -18
  99. package/src/components/view/AnimatedView.tsx +0 -7
  100. package/src/components/view/Box.tsx +0 -7
  101. package/src/components/view/ThemedScreenWrap.tsx +0 -48
  102. package/src/components/view/ThemedScreenWrap.web.tsx +0 -41
  103. package/src/components/view/ThemedScrollView.tsx +0 -54
  104. package/src/components/view/ThemedView.tsx +0 -19
  105. package/src/hooks/button.ts +0 -152
  106. package/src/hooks/list.ts +0 -42
  107. package/src/hooks/overlay.ts +0 -471
  108. package/src/hooks/react.ts +0 -34
  109. package/src/hooks/reanimated.ts +0 -6
  110. package/src/hooks/separator.ts +0 -29
  111. package/src/hooks/style.ts +0 -79
  112. package/src/hooks/switch.ts +0 -119
  113. package/src/hooks/theme.ts +0 -65
  114. package/src/hooks/view.ts +0 -28
  115. package/src/index.ts +0 -59
  116. package/src/test/utils/const.ts +0 -9
  117. package/src/test/utils/func.ts +0 -55
  118. package/src/test/utils/testingLib.tsx +0 -17
  119. package/src/types/button.ts +0 -50
  120. package/src/types/global.d.ts +0 -5
  121. package/src/types/icon.ts +0 -21
  122. package/src/types/list.ts +0 -61
  123. package/src/types/loading.ts +0 -14
  124. package/src/types/overlay.ts +0 -216
  125. package/src/types/provider.ts +0 -6
  126. package/src/types/react.ts +0 -8
  127. package/src/types/reanimated.ts +0 -11
  128. package/src/types/separator.ts +0 -28
  129. package/src/types/slider.ts +0 -59
  130. package/src/types/style.ts +0 -26
  131. package/src/types/switch.ts +0 -31
  132. package/src/types/text.ts +0 -25
  133. package/src/types/theme.ts +0 -39
  134. package/src/types/view.ts +0 -58
  135. package/src/utils/button/const.ts +0 -10
  136. package/src/utils/overlay/const.ts +0 -77
  137. package/src/utils/overlay/func.ts +0 -107
  138. package/src/utils/reanimated/func.ts +0 -39
  139. package/src/utils/slider/const.ts +0 -23
  140. package/src/utils/style/const.ts +0 -4
  141. package/src/utils/style/func.ts +0 -37
  142. package/src/utils/switch/const.ts +0 -2
  143. package/src/utils/theme/const.ts +0 -189
  144. package/src/utils/theme/restyle.ts +0 -87
@@ -1,119 +0,0 @@
1
- import { useEffect } from 'react';
2
- import {
3
- interpolate,
4
- interpolateColor,
5
- useAnimatedStyle,
6
- type SharedValue,
7
- } from 'react-native-reanimated';
8
- import type { PressableOnPress } from '../types/button';
9
- import type { AnimationValue } from '../types/reanimated';
10
- import type { ThemedSwitchProps } from '../types/switch';
11
- import { updateSharedValWithTiming } from '../utils/reanimated/func';
12
- import { switchAnimationDuration } from '../utils/switch/const';
13
- import { BorderSize, SwitchSize } from '../utils/theme/const';
14
- import { useDelayedOnPress } from './button';
15
- import { useAnimationSharedVal } from './reanimated';
16
- import { useThemeColors, useThemeSpacing } from './theme';
17
-
18
- /** @internal */
19
- export function useThemedSwitch(
20
- onPress: ThemedSwitchProps['onPress'],
21
- enabled: ThemedSwitchProps['enabled'] = false,
22
- size: ThemedSwitchProps['size'] = SwitchSize.M,
23
- onPressDelayConfig?: ThemedSwitchProps['onPressDelayConfig'],
24
- customEnableAnimation?: ThemedSwitchProps['customEnableAnimation'],
25
- customDisableAnimation?: ThemedSwitchProps['customDisableAnimation'],
26
- customColors?: ThemedSwitchProps['customColors']
27
- ) {
28
- const { xxxs } = useThemeSpacing();
29
- const colors = useThemeColors();
30
- const enabledSharedVal = useAnimationSharedVal();
31
- const pressableOnPress: PressableOnPress = () => {
32
- onPress(enabledSharedVal.get() > 0.5);
33
- };
34
- const delayedOnPress = useDelayedOnPress(
35
- pressableOnPress,
36
- onPressDelayConfig
37
- );
38
- const handleAnimation = (toVal: AnimationValue, cb?: () => void) => {
39
- if (customEnableAnimation && toVal) {
40
- customEnableAnimation(enabledSharedVal, toVal, cb);
41
- } else if (customDisableAnimation && !toVal) {
42
- customDisableAnimation(enabledSharedVal, toVal, cb);
43
- } else {
44
- updateSharedValWithTiming(
45
- enabledSharedVal as SharedValue<number>,
46
- toVal,
47
- { duration: switchAnimationDuration },
48
- cb
49
- );
50
- }
51
- };
52
- const toggleSwitch: PressableOnPress = (event) => {
53
- handleAnimation(enabledSharedVal.get() > 0.5 ? 0 : 1, () => {
54
- delayedOnPress(event);
55
- });
56
- };
57
- const trackAnimatedStyle = useAnimatedStyle(() => {
58
- const padding = xxxs;
59
- const borderWidth = BorderSize.S;
60
- const borderColor = colors.themePri;
61
-
62
- return {
63
- width: size * 2 + padding * 2 + borderWidth * 2,
64
- padding,
65
- borderWidth,
66
- borderColor: interpolateColor(
67
- enabledSharedVal.get(),
68
- [0, 1],
69
- [
70
- customColors?.border ? colors[customColors.border] : borderColor,
71
- customColors?.borderEnabled
72
- ? colors[customColors.borderEnabled]
73
- : borderColor,
74
- ]
75
- ),
76
- backgroundColor: interpolateColor(
77
- enabledSharedVal.get(),
78
- [0, 1],
79
- [
80
- customColors?.background
81
- ? colors[customColors.background]
82
- : colors.background,
83
- customColors?.backgroundEnabled
84
- ? colors[customColors.backgroundEnabled]
85
- : borderColor,
86
- ]
87
- ),
88
- };
89
- }, [size, customColors, xxxs, colors, enabledSharedVal]);
90
- const thumbAnimatedStyle = useAnimatedStyle(
91
- () => ({
92
- backgroundColor: interpolateColor(
93
- enabledSharedVal.get(),
94
- [0, 1],
95
- [
96
- customColors?.thumb ? colors[customColors.thumb] : colors.themePri,
97
- customColors?.thumbEnabled
98
- ? colors[customColors.thumbEnabled]
99
- : colors.background,
100
- ]
101
- ),
102
- transform: [
103
- { translateX: interpolate(enabledSharedVal.get(), [0, 1], [0, size]) },
104
- ],
105
- }),
106
- [size, customColors, colors, enabledSharedVal]
107
- );
108
- useEffect(() => {
109
- handleAnimation(enabled ? 1 : 0);
110
- }, [enabled]);
111
-
112
- const switchProps = {
113
- toggleSwitch,
114
- trackAnimatedStyle,
115
- thumbAnimatedStyle,
116
- };
117
-
118
- return switchProps;
119
- }
@@ -1,65 +0,0 @@
1
- import {
2
- useResponsiveProp,
3
- useTheme as useRestyleTheme,
4
- type PropValue,
5
- type ResponsiveValue,
6
- } from '@shopify/restyle';
7
- import { useColorScheme, type ColorSchemeName } from 'react-native';
8
- import type { Theme, ThemeBreakpoints } from '../types/theme';
9
- import { darkTheme, lightTheme } from '../utils/theme/const';
10
-
11
- export function useTheme(): Theme {
12
- return useRestyleTheme<Theme>();
13
- }
14
-
15
- export function useThemeColors(): Theme['colors'] {
16
- return useTheme().colors;
17
- }
18
-
19
- export function useThemeSpacing(): Theme['spacing'] {
20
- return useTheme().spacing;
21
- }
22
-
23
- export function useThemeBreakpoints(): Theme['breakpoints'] {
24
- return useTheme().breakpoints;
25
- }
26
-
27
- export function useThemeBreakpointValues<T extends PropValue>(
28
- propValue: ResponsiveValue<T, Theme['breakpoints']>
29
- ) {
30
- return useResponsiveProp(propValue);
31
- }
32
-
33
- export function useThemeBreakpoint() {
34
- const responsiveVal: ResponsiveValue<PropValue, Theme['breakpoints']> = {
35
- smallPhone: 'smallPhone',
36
- phone: 'phone',
37
- smallTablet: 'smallTablet',
38
- tablet: 'tablet',
39
- desktop: 'desktop',
40
- };
41
-
42
- return useThemeBreakpointValues(responsiveVal) as ThemeBreakpoints;
43
- }
44
-
45
- export function useThemeZIndices(): Theme['zIndices'] {
46
- return useTheme().zIndices;
47
- }
48
-
49
- export function useThemeBorderRadii(): Theme['borderRadii'] {
50
- return useTheme().borderRadii;
51
- }
52
-
53
- export function useThemeTextVariants(): Theme['textVariants'] {
54
- return useTheme().textVariants;
55
- }
56
-
57
- export function useIsDarkColorScheme(overrideColorScheme?: ColorSchemeName) {
58
- const colorScheme = useColorScheme();
59
-
60
- return (overrideColorScheme ?? colorScheme) === 'dark';
61
- }
62
-
63
- export function useColorSchemeTheme(overrideColorScheme?: ColorSchemeName) {
64
- return useIsDarkColorScheme(overrideColorScheme) ? darkTheme : lightTheme;
65
- }
package/src/hooks/view.ts DELETED
@@ -1,28 +0,0 @@
1
- import { useRestyle } from '@shopify/restyle';
2
- import { useRef } from 'react';
3
- import type { View } from 'react-native';
4
- import type { AnimatedThemedViewProps, AnimatedViewProps } from '../types/view';
5
- import { animatedThemedViewRestyleFuncs } from '../utils/theme/restyle';
6
-
7
- export function useViewRef() {
8
- return useRef<View>(null);
9
- }
10
-
11
- export function useAnimatedThemedView({
12
- animatedStyle,
13
- ...props
14
- }: AnimatedThemedViewProps) {
15
- const { style, ...restyle } = useRestyle(
16
- animatedThemedViewRestyleFuncs,
17
- props
18
- );
19
-
20
- const animatedThemedViewProps: AnimatedViewProps = {
21
- ...restyle,
22
- style: [style, animatedStyle],
23
- accessible: true,
24
- role: 'group',
25
- };
26
-
27
- return animatedThemedViewProps;
28
- }
package/src/index.ts DELETED
@@ -1,59 +0,0 @@
1
- export { default as AnimatedThemedPressable } from './components/button/AnimatedThemedPressable';
2
- export { default as ThemedButton } from './components/button/ThemedButton';
3
- export { default as ThemedIconButton } from './components/button/ThemedIconButton';
4
- export { default as ThemedIconTextButton } from './components/button/ThemedIconTextButton';
5
- export { default as ThemedPressable } from './components/button/ThemedPressable';
6
- export { default as ThemedIcon } from './components/icon/ThemedIcon';
7
- export { default as List } from './components/list/List';
8
- export { default as ThemedLoading } from './components/loading/ThemedLoading';
9
- export { default as ActionSheet } from './components/overlay/actionSheet/ActionSheet';
10
- export { default as Alert } from './components/overlay/alert/Alert';
11
- export { default as ThemedLoadingModal } from './components/overlay/modal/ThemedLoadingModal';
12
- export { default as ThemedModal } from './components/overlay/modal/ThemedModal';
13
- export { default as ThemedToast } from './components/overlay/toast/ThemedToast';
14
- export { default as GestureProvider } from './components/provider/GestureProvider';
15
- export { default as InsetsProvider } from './components/provider/InsetsProvider';
16
- export { default as ReactNativeTemplateProviders } from './components/provider/ReactNativeTemplateProviders';
17
- export { default as ThemeProvider } from './components/provider/ThemeProvider';
18
- export { default as ThemedSeparator } from './components/separator/ThemedSeparator';
19
- export { default as ThemedSlider } from './components/slider/ThemedSlider';
20
- export { default as ThemedSwitch } from './components/switch/ThemedSwitch';
21
- export { default as ThemedIconText } from './components/text/ThemedIconText';
22
- export { default as ThemedText } from './components/text/ThemedText';
23
- export { default as AnimatedThemedView } from './components/view/AnimatedThemedView';
24
- export { default as ThemedScreenWrap } from './components/view/ThemedScreenWrap';
25
- export { default as ThemedScrollView } from './components/view/ThemedScrollView';
26
- export { default as ThemedView } from './components/view/ThemedView';
27
-
28
- export * from './hooks/button';
29
- export * from './hooks/list';
30
- export * from './hooks/overlay';
31
- export * from './hooks/react';
32
- export * from './hooks/reanimated';
33
- export * from './hooks/separator';
34
- export * from './hooks/style';
35
- export * from './hooks/theme';
36
- export * from './hooks/view';
37
-
38
- export * from './types/button';
39
- export * from './types/icon';
40
- export * from './types/list';
41
- export * from './types/loading';
42
- export * from './types/overlay';
43
- export * from './types/provider';
44
- export * from './types/react';
45
- export * from './types/reanimated';
46
- export * from './types/separator';
47
- export * from './types/slider';
48
- export * from './types/style';
49
- export * from './types/switch';
50
- export * from './types/text';
51
- export * from './types/theme';
52
- export * from './types/view';
53
-
54
- export * from './utils/button/const';
55
- export * from './utils/overlay/const';
56
- export * from './utils/slider/const';
57
- export * from './utils/style/const';
58
- export * from './utils/style/func';
59
- export * from './utils/theme/const';
@@ -1,9 +0,0 @@
1
- import { createElement, type FC } from 'react';
2
- import ReactNativeTemplateProviders from '../../components/provider/ReactNativeTemplateProviders';
3
- import type { ReactNativeTemplateProvidersProps } from '../../types/provider';
4
- import { lightTheme } from '../../utils/theme/const';
5
-
6
- export const wrapper: FC<ReactNativeTemplateProvidersProps> = ({
7
- theme = lightTheme,
8
- children,
9
- }) => createElement(ReactNativeTemplateProviders, { theme, children });
@@ -1,55 +0,0 @@
1
- import { renderHookAsync } from '@testing-library/react-native';
2
- import { useTheme } from '../../hooks/theme';
3
- import { wrapper } from './const';
4
-
5
- async function getTheme() {
6
- return (await renderHookAsync(() => useTheme(), { wrapper })).result.current;
7
- }
8
-
9
- export async function getThemeColors() {
10
- return (await getTheme()).colors;
11
- }
12
-
13
- export async function getThemeSpacing() {
14
- return (await getTheme()).spacing;
15
- }
16
-
17
- export async function getThemeBreakpoints() {
18
- return (await getTheme()).breakpoints;
19
- }
20
-
21
- export async function getThemeZIndices() {
22
- return (await getTheme()).zIndices;
23
- }
24
-
25
- export async function getThemeBorderRadii() {
26
- return (await getTheme()).borderRadii;
27
- }
28
-
29
- export async function getThemeTextVariants() {
30
- return (await getTheme()).textVariants;
31
- }
32
-
33
- export function hexToRgb(hex: string) {
34
- // Remove the '#' if present
35
- const cleanHex = hex.startsWith('#') ? hex.slice(1) : hex;
36
-
37
- let r, g, b;
38
- let a = '1';
39
- if (cleanHex.length === 3) {
40
- r = parseInt(cleanHex.charAt(0) + cleanHex.charAt(0), 16);
41
- g = parseInt(cleanHex.charAt(1) + cleanHex.charAt(1), 16);
42
- b = parseInt(cleanHex.charAt(2) + cleanHex.charAt(2), 16);
43
- } else if (cleanHex.length === 6) {
44
- r = parseInt(cleanHex.substring(0, 2), 16);
45
- g = parseInt(cleanHex.substring(2, 4), 16);
46
- b = parseInt(cleanHex.substring(4, 6), 16);
47
- } else if (cleanHex.length === 8) {
48
- r = parseInt(cleanHex.substring(0, 2), 16);
49
- g = parseInt(cleanHex.substring(2, 4), 16);
50
- b = parseInt(cleanHex.substring(4, 6), 16);
51
- a = (parseInt(cleanHex.substring(6, 8), 16) / 255).toFixed(2); // Convert 0-255 to 0-1
52
- }
53
-
54
- return `rgba(${r}, ${g}, ${b}, ${a})`;
55
- }
@@ -1,17 +0,0 @@
1
- import {
2
- render as testRender,
3
- renderAsync as testRenderAsync,
4
- } from '@testing-library/react-native';
5
- import { wrapper } from './const';
6
-
7
- const customTestRender: typeof testRender = (ui, options) =>
8
- testRender(ui, { wrapper, ...options });
9
-
10
- const customTestRenderAsync: typeof testRenderAsync = async (ui, options) =>
11
- await testRenderAsync(ui, { wrapper, ...options });
12
-
13
- // re-export everything
14
- export * from '@testing-library/react-native';
15
-
16
- // override render method
17
- export { customTestRender as render, customTestRenderAsync as renderAsync };
@@ -1,50 +0,0 @@
1
- import type { ComponentProps, PropsWithChildren } from 'react';
2
- import type {
3
- GestureResponderEvent,
4
- PressableProps as RNPressableProps,
5
- } from 'react-native';
6
- import type { SharedValue } from 'react-native-reanimated';
7
- import type AnimatedPressable from '../components/button/AnimatedPressable';
8
- import type { ButtonScaleRatio, OnPressDelayType } from '../utils/button/const';
9
- import type { CustomThemedIconProps } from './icon';
10
- import type { CustomThemedTextProps, IconTextProps } from './text';
11
- import type { ThemeViewProps } from './theme';
12
- import type { ThemedViewProps, ViewRefObj } from './view';
13
-
14
- export type PressableOnPress = (
15
- event: GestureResponderEvent
16
- ) => void | SharedValue<(event: GestureResponderEvent) => void>;
17
-
18
- export type OnPressDelayConfig<T = OnPressDelayType> = {
19
- type: T;
20
- wait: number;
21
- };
22
-
23
- export type PressableProps = Omit<RNPressableProps, 'onPress'> &
24
- Required<Pick<RNPressableProps, 'onPress'>> & {
25
- scaleRatio?: ButtonScaleRatio | number;
26
- onPressDelayConfig?: OnPressDelayConfig;
27
- ref?: ViewRefObj;
28
- };
29
-
30
- export type ThemedPressableProps = PressableProps & ThemeViewProps;
31
-
32
- export type AnimatedPressableProps = ComponentProps<typeof AnimatedPressable>;
33
-
34
- export type AnimatedThemedPressableProps = Omit<
35
- ThemedPressableProps,
36
- 'ref' | 'scaleRatio'
37
- > &
38
- Omit<AnimatedPressableProps, 'key' | 'style'> & {
39
- animatedStyle?: AnimatedPressableProps['style'];
40
- };
41
-
42
- type ButtonProps = PropsWithChildren<Omit<ThemedPressableProps, 'children'>>;
43
-
44
- export type ThemedButtonProps = ButtonProps & CustomThemedTextProps;
45
-
46
- export type ThemedIconButtonProps = ButtonProps & CustomThemedIconProps;
47
-
48
- export type ThemedIconTextButtonProps = PropsWithChildren<
49
- ButtonProps & IconTextProps & { iconTextProps?: ThemedViewProps }
50
- >;
@@ -1,5 +0,0 @@
1
- import type { lightTheme } from '../utils/theme/const';
2
-
3
- declare global {
4
- type ReactNativeTemplateTheme = typeof lightTheme;
5
- }
package/src/types/icon.ts DELETED
@@ -1,21 +0,0 @@
1
- import type { IconName, IconSize } from '@jamadd/react-native-template-icons';
2
- import type { TextStyle } from 'react-native';
3
- import type { StyleOrStyleProp } from './style';
4
- import type { ThemeBaseProps, ThemeColors } from './theme';
5
-
6
- export type IconProps = {
7
- name: IconName;
8
- size?: IconSize | number;
9
- color?: ThemeColors;
10
- style?: StyleOrStyleProp<TextStyle>;
11
- };
12
-
13
- export type ThemedIconProps = IconProps & ThemeBaseProps;
14
-
15
- export type CustomThemedIconProps = {
16
- iconName: ThemedIconProps['name'];
17
- iconSize?: ThemedIconProps['size'];
18
- iconColor?: ThemedIconProps['color'];
19
- iconStyle?: ThemedIconProps['style'];
20
- iconProps?: Omit<ThemedIconProps, 'name' | 'size' | 'color' | 'style'>;
21
- };
package/src/types/list.ts DELETED
@@ -1,61 +0,0 @@
1
- import type {
2
- FlashListProps,
3
- FlashListRef,
4
- ListRenderItemInfo,
5
- } from '@shopify/flash-list';
6
- import type { ComponentType, FC, RefObject } from 'react';
7
- import type { ViewStyle } from 'react-native';
8
- import type { AnimatedRef } from 'react-native-reanimated';
9
- import type { ThemedSeparatorProps } from './separator';
10
- import type { InsetsStyleConfig } from './style';
11
- import type { ThemeColors } from './theme';
12
- import type { PropsWithRequiredChildren } from './view';
13
-
14
- export type ListRef<T> = FlashListRef<T>;
15
-
16
- export type ListRefObj<T> = RefObject<ListRef<T> | null>;
17
-
18
- export type ListAnimatedRefObj<T> = AnimatedRef<ListRef<T>>;
19
-
20
- export type ListItemProps<T> = ListRenderItemInfo<T>;
21
-
22
- export type ListKeyExtractor<T> = (item: T, index: number) => string;
23
-
24
- export type ListGetItemType<T> = (
25
- item: T,
26
- index: number,
27
- extraData?: any
28
- ) => string | number | undefined;
29
-
30
- export type ListProps<T> = Omit<
31
- FlashListProps<T>,
32
- 'data' | 'renderItem' | 'keyExtractor'
33
- > &
34
- InsetsStyleConfig & {
35
- ref?: ListRefObj<T> | ListAnimatedRefObj<T>;
36
- data: T[];
37
- Item: ComponentType<ListItemProps<T>>;
38
- keyExtractor: ListKeyExtractor<T>;
39
- };
40
-
41
- export type ListItemSeparatorProps = Partial<
42
- Pick<ThemedSeparatorProps, 'size' | 'vertical'> & {
43
- backgroundColor: ThemeColors;
44
- style: Omit<
45
- ThemedSeparatorProps,
46
- 'size' | 'vertical' | 'backgroundColor' | 'bg'
47
- >;
48
- }
49
- >;
50
-
51
- /** @internal */
52
- export type ListItemSeparatorComponent = FC<{
53
- leadingItem?: { type: string };
54
- trailingItem?: { type: string };
55
- }>;
56
-
57
- export type ListCellRendererComponentProps = PropsWithRequiredChildren<{
58
- onLayout: () => void;
59
- index: number;
60
- style: ViewStyle;
61
- }>;
@@ -1,14 +0,0 @@
1
- import type { ActivityIndicatorProps } from 'react-native';
2
- import type { ThemeBaseProps, ThemeColorProps } from './theme';
3
-
4
- export type LoadingProps = Omit<ActivityIndicatorProps, 'color'> & {
5
- color?: ThemeColorProps['color'];
6
- };
7
-
8
- export type ThemedLoadingProps = LoadingProps & ThemeBaseProps;
9
-
10
- export type CustomThemedLoadingProps = {
11
- loadingSize?: ThemedLoadingProps['size'];
12
- loadingColor?: ThemedLoadingProps['color'];
13
- loadingProps?: Omit<ThemedLoadingProps, 'size' | 'color'>;
14
- };