@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.
- package/lib/module/components/button/AnimatedThemedPressable.js +13 -3
- package/lib/module/components/button/AnimatedThemedPressable.js.map +1 -1
- package/lib/module/components/button/ThemedButton.js +84 -23
- package/lib/module/components/button/ThemedButton.js.map +1 -1
- package/lib/module/components/button/ThemedIconButton.js +62 -16
- package/lib/module/components/button/ThemedIconButton.js.map +1 -1
- package/lib/module/components/button/ThemedIconTextButton.js +118 -29
- package/lib/module/components/button/ThemedIconTextButton.js.map +1 -1
- package/lib/module/components/button/ThemedPressable.js +13 -3
- package/lib/module/components/button/ThemedPressable.js.map +1 -1
- package/lib/module/components/icon/ThemedIcon.js +56 -15
- package/lib/module/components/icon/ThemedIcon.js.map +1 -1
- package/lib/module/components/list/List.js +131 -39
- package/lib/module/components/list/List.js.map +1 -1
- package/lib/module/components/loading/ThemedLoading.js +50 -13
- package/lib/module/components/loading/ThemedLoading.js.map +1 -1
- package/lib/module/components/overlay/actionSheet/ActionSheet.js +64 -19
- package/lib/module/components/overlay/actionSheet/ActionSheet.js.map +1 -1
- package/lib/module/components/overlay/actionSheet/ActionSheet.web.js +76 -0
- package/lib/module/components/overlay/actionSheet/ActionSheet.web.js.map +1 -0
- package/lib/module/components/overlay/actionSheet/ActionSheetContentGesture.js +19 -8
- package/lib/module/components/overlay/actionSheet/ActionSheetContentGesture.js.map +1 -1
- package/lib/module/components/overlay/actionSheet/ActionSheetHeader.js +87 -31
- package/lib/module/components/overlay/actionSheet/ActionSheetHeader.js.map +1 -1
- package/lib/module/components/overlay/actionSheet/ActionSheetHeader.web.js +113 -0
- package/lib/module/components/overlay/actionSheet/ActionSheetHeader.web.js.map +1 -0
- package/lib/module/components/overlay/actionSheet/ActionSheetListView.js +69 -28
- package/lib/module/components/overlay/actionSheet/ActionSheetListView.js.map +1 -1
- package/lib/module/components/overlay/actionSheet/ActionSheetListViewContent.js +39 -14
- package/lib/module/components/overlay/actionSheet/ActionSheetListViewContent.js.map +1 -1
- package/lib/module/components/overlay/actionSheet/ActionSheetOptionList.js +58 -25
- package/lib/module/components/overlay/actionSheet/ActionSheetOptionList.js.map +1 -1
- package/lib/module/components/overlay/actionSheet/ActionSheetOptionListItem.js +45 -21
- package/lib/module/components/overlay/actionSheet/ActionSheetOptionListItem.js.map +1 -1
- package/lib/module/components/overlay/actionSheet/ActionSheetOptions.js +75 -32
- package/lib/module/components/overlay/actionSheet/ActionSheetOptions.js.map +1 -1
- package/lib/module/components/overlay/actionSheet/ActionSheetScrollView.js +72 -30
- package/lib/module/components/overlay/actionSheet/ActionSheetScrollView.js.map +1 -1
- package/lib/module/components/overlay/actionSheet/ActionSheetScrollViewContent.js +45 -18
- package/lib/module/components/overlay/actionSheet/ActionSheetScrollViewContent.js.map +1 -1
- package/lib/module/components/overlay/actionSheet/ActionSheetWrap.js +152 -36
- package/lib/module/components/overlay/actionSheet/ActionSheetWrap.js.map +1 -1
- package/lib/module/components/overlay/alert/Alert.js +142 -51
- package/lib/module/components/overlay/alert/Alert.js.map +1 -1
- package/lib/module/components/overlay/alert/AlertButton.js +62 -26
- package/lib/module/components/overlay/alert/AlertButton.js.map +1 -1
- package/lib/module/components/overlay/alert/AlertButtons.js +58 -23
- package/lib/module/components/overlay/alert/AlertButtons.js.map +1 -1
- package/lib/module/components/overlay/alert/AlertContent.js +76 -17
- package/lib/module/components/overlay/alert/AlertContent.js.map +1 -1
- package/lib/module/components/overlay/alert/AlertWrap.js +125 -43
- package/lib/module/components/overlay/alert/AlertWrap.js.map +1 -1
- package/lib/module/components/overlay/modal/ThemedLoadingModal.js +96 -21
- package/lib/module/components/overlay/modal/ThemedLoadingModal.js.map +1 -1
- package/lib/module/components/overlay/modal/ThemedModal.js +76 -23
- package/lib/module/components/overlay/modal/ThemedModal.js.map +1 -1
- package/lib/module/components/overlay/toast/ThemedToast.js +339 -90
- package/lib/module/components/overlay/toast/ThemedToast.js.map +1 -1
- package/lib/module/components/provider/GestureProvider.js +15 -3
- package/lib/module/components/provider/GestureProvider.js.map +1 -1
- package/lib/module/components/provider/InsetsProvider.js +15 -3
- package/lib/module/components/provider/InsetsProvider.js.map +1 -1
- package/lib/module/components/provider/ReactNativeTemplateProviders.js +23 -11
- package/lib/module/components/provider/ReactNativeTemplateProviders.js.map +1 -1
- package/lib/module/components/provider/ThemeProvider.js +15 -3
- package/lib/module/components/provider/ThemeProvider.js.map +1 -1
- package/lib/module/components/separator/ThemedSeparator.js +53 -14
- package/lib/module/components/separator/ThemedSeparator.js.map +1 -1
- package/lib/module/components/slider/Slider.js +625 -137
- package/lib/module/components/slider/Slider.js.map +1 -1
- package/lib/module/components/slider/ThemedSlider.js +178 -54
- package/lib/module/components/slider/ThemedSlider.js.map +1 -1
- package/lib/module/components/slider/ThemedSlider.web.js +206 -0
- package/lib/module/components/slider/ThemedSlider.web.js.map +1 -0
- package/lib/module/components/slider/ThemedSliderStepIndicator.js +40 -15
- package/lib/module/components/slider/ThemedSliderStepIndicator.js.map +1 -1
- package/lib/module/components/switch/ThemedSwitch.js +81 -21
- package/lib/module/components/switch/ThemedSwitch.js.map +1 -1
- package/lib/module/components/text/ThemedIconText.js +124 -35
- package/lib/module/components/text/ThemedIconText.js.map +1 -1
- package/lib/module/components/text/ThemedText.js +15 -3
- package/lib/module/components/text/ThemedText.js.map +1 -1
- package/lib/module/components/view/AnimatedThemedView.js +42 -11
- package/lib/module/components/view/AnimatedThemedView.js.map +1 -1
- package/lib/module/components/view/ThemedScreenWrap.js +144 -39
- package/lib/module/components/view/ThemedScreenWrap.js.map +1 -1
- package/lib/module/components/view/ThemedScreenWrap.web.js +111 -32
- package/lib/module/components/view/ThemedScreenWrap.web.js.map +1 -1
- package/lib/module/components/view/ThemedScrollView.js +126 -38
- package/lib/module/components/view/ThemedScrollView.js.map +1 -1
- package/lib/module/components/view/ThemedView.js +33 -10
- package/lib/module/components/view/ThemedView.js.map +1 -1
- package/lib/module/hooks/button.js +263 -84
- package/lib/module/hooks/button.js.map +1 -1
- package/lib/module/hooks/list.js +50 -10
- package/lib/module/hooks/list.js.map +1 -1
- package/lib/module/hooks/overlay.js +575 -187
- package/lib/module/hooks/overlay.js.map +1 -1
- package/lib/module/hooks/react.js +90 -27
- package/lib/module/hooks/react.js.map +1 -1
- package/lib/module/hooks/reanimated.js.map +1 -1
- package/lib/module/hooks/style.js +43 -18
- package/lib/module/hooks/style.js.map +1 -1
- package/lib/module/hooks/switch.js +182 -43
- package/lib/module/hooks/switch.js.map +1 -1
- package/lib/module/hooks/theme.js +17 -8
- package/lib/module/hooks/theme.js.map +1 -1
- package/lib/module/hooks/view.js +56 -14
- package/lib/module/hooks/view.js.map +1 -1
- package/lib/module/index.js +2 -2
- package/lib/module/index.js.map +1 -1
- package/lib/module/utils/reanimated/func.js +60 -10
- package/lib/module/utils/reanimated/func.js.map +1 -1
- package/lib/typescript/src/components/overlay/actionSheet/ActionSheet.web.d.ts +5 -0
- package/lib/typescript/src/components/overlay/actionSheet/ActionSheet.web.d.ts.map +1 -0
- package/lib/typescript/src/components/overlay/actionSheet/ActionSheetContentGesture.d.ts +0 -2
- package/lib/typescript/src/components/overlay/actionSheet/ActionSheetContentGesture.d.ts.map +1 -1
- package/lib/typescript/src/components/overlay/actionSheet/ActionSheetHeader.d.ts +0 -2
- package/lib/typescript/src/components/overlay/actionSheet/ActionSheetHeader.d.ts.map +1 -1
- package/lib/typescript/src/components/overlay/actionSheet/ActionSheetHeader.web.d.ts +4 -0
- package/lib/typescript/src/components/overlay/actionSheet/ActionSheetHeader.web.d.ts.map +1 -0
- package/lib/typescript/src/components/overlay/actionSheet/ActionSheetListView.d.ts +0 -2
- package/lib/typescript/src/components/overlay/actionSheet/ActionSheetListView.d.ts.map +1 -1
- package/lib/typescript/src/components/overlay/actionSheet/ActionSheetListViewContent.d.ts +0 -2
- package/lib/typescript/src/components/overlay/actionSheet/ActionSheetListViewContent.d.ts.map +1 -1
- package/lib/typescript/src/components/overlay/actionSheet/ActionSheetOptionList.d.ts +0 -2
- package/lib/typescript/src/components/overlay/actionSheet/ActionSheetOptionList.d.ts.map +1 -1
- package/lib/typescript/src/components/overlay/actionSheet/ActionSheetOptionListItem.d.ts +0 -2
- package/lib/typescript/src/components/overlay/actionSheet/ActionSheetOptionListItem.d.ts.map +1 -1
- package/lib/typescript/src/components/overlay/actionSheet/ActionSheetOptions.d.ts +0 -2
- package/lib/typescript/src/components/overlay/actionSheet/ActionSheetOptions.d.ts.map +1 -1
- package/lib/typescript/src/components/overlay/actionSheet/ActionSheetScrollView.d.ts +0 -2
- package/lib/typescript/src/components/overlay/actionSheet/ActionSheetScrollView.d.ts.map +1 -1
- package/lib/typescript/src/components/overlay/actionSheet/ActionSheetScrollViewContent.d.ts +0 -2
- package/lib/typescript/src/components/overlay/actionSheet/ActionSheetScrollViewContent.d.ts.map +1 -1
- package/lib/typescript/src/components/overlay/actionSheet/ActionSheetWrap.d.ts +0 -2
- package/lib/typescript/src/components/overlay/actionSheet/ActionSheetWrap.d.ts.map +1 -1
- package/lib/typescript/src/components/slider/Slider.d.ts +3 -2
- package/lib/typescript/src/components/slider/Slider.d.ts.map +1 -1
- package/lib/typescript/src/components/slider/ThemedSlider.d.ts.map +1 -1
- package/lib/typescript/src/components/slider/ThemedSlider.web.d.ts +5 -0
- package/lib/typescript/src/components/slider/ThemedSlider.web.d.ts.map +1 -0
- package/lib/typescript/src/components/slider/ThemedSliderStepIndicator.d.ts +3 -2
- package/lib/typescript/src/components/slider/ThemedSliderStepIndicator.d.ts.map +1 -1
- package/lib/typescript/src/components/view/AnimatedView.d.ts +0 -2
- package/lib/typescript/src/components/view/AnimatedView.d.ts.map +1 -1
- package/lib/typescript/src/hooks/overlay.d.ts +0 -27
- package/lib/typescript/src/hooks/overlay.d.ts.map +1 -1
- package/lib/typescript/src/hooks/switch.d.ts +1 -20
- package/lib/typescript/src/hooks/switch.d.ts.map +1 -1
- package/lib/typescript/src/types/list.d.ts +1 -10
- package/lib/typescript/src/types/list.d.ts.map +1 -1
- package/lib/typescript/src/types/overlay.d.ts +1 -31
- package/lib/typescript/src/types/overlay.d.ts.map +1 -1
- package/lib/typescript/src/utils/overlay/const.d.ts +0 -33
- package/lib/typescript/src/utils/overlay/const.d.ts.map +1 -1
- package/lib/typescript/src/utils/reanimated/func.d.ts +1 -5
- package/lib/typescript/src/utils/reanimated/func.d.ts.map +1 -1
- package/lib/typescript/src/utils/switch/const.d.ts +1 -2
- package/lib/typescript/src/utils/switch/const.d.ts.map +1 -1
- package/package.json +14 -15
- package/src/components/button/AnimatedPressable.tsx +0 -7
- package/src/components/button/AnimatedThemedPressable.tsx +0 -12
- package/src/components/button/ThemedButton.tsx +0 -45
- package/src/components/button/ThemedIconButton.tsx +0 -33
- package/src/components/button/ThemedIconTextButton.tsx +0 -56
- package/src/components/button/ThemedPressable.tsx +0 -12
- package/src/components/icon/ThemedIcon.tsx +0 -31
- package/src/components/list/List.tsx +0 -55
- package/src/components/loading/ThemedLoading.tsx +0 -29
- package/src/components/overlay/actionSheet/ActionSheet.tsx +0 -31
- package/src/components/overlay/actionSheet/ActionSheetContentGesture.tsx +0 -15
- package/src/components/overlay/actionSheet/ActionSheetHeader.tsx +0 -72
- package/src/components/overlay/actionSheet/ActionSheetListView.tsx +0 -54
- package/src/components/overlay/actionSheet/ActionSheetListViewContent.tsx +0 -32
- package/src/components/overlay/actionSheet/ActionSheetOptionList.tsx +0 -51
- package/src/components/overlay/actionSheet/ActionSheetOptionListItem.tsx +0 -43
- package/src/components/overlay/actionSheet/ActionSheetOptions.tsx +0 -61
- package/src/components/overlay/actionSheet/ActionSheetScrollView.tsx +0 -57
- package/src/components/overlay/actionSheet/ActionSheetScrollViewContent.tsx +0 -38
- package/src/components/overlay/actionSheet/ActionSheetWrap.tsx +0 -75
- package/src/components/overlay/alert/Alert.tsx +0 -86
- package/src/components/overlay/alert/AlertButton.tsx +0 -41
- package/src/components/overlay/alert/AlertButtons.tsx +0 -32
- package/src/components/overlay/alert/AlertContent.tsx +0 -60
- package/src/components/overlay/alert/AlertWrap.tsx +0 -93
- package/src/components/overlay/modal/ThemedLoadingModal.tsx +0 -47
- package/src/components/overlay/modal/ThemedModal.tsx +0 -42
- package/src/components/overlay/toast/ThemedToast.tsx +0 -160
- package/src/components/provider/GestureProvider.tsx +0 -9
- package/src/components/provider/InsetsProvider.tsx +0 -11
- package/src/components/provider/ReactNativeTemplateProviders.tsx +0 -20
- package/src/components/provider/ThemeProvider.tsx +0 -8
- package/src/components/separator/ThemedSeparator.tsx +0 -24
- package/src/components/slider/Slider.tsx +0 -229
- package/src/components/slider/ThemedSlider.tsx +0 -103
- package/src/components/slider/ThemedSliderStepIndicator.tsx +0 -24
- package/src/components/switch/ThemedSwitch.tsx +0 -49
- package/src/components/text/Text.tsx +0 -7
- package/src/components/text/ThemedIconText.tsx +0 -58
- package/src/components/text/ThemedText.tsx +0 -7
- package/src/components/view/AnimatedThemedView.tsx +0 -18
- package/src/components/view/AnimatedView.tsx +0 -7
- package/src/components/view/Box.tsx +0 -7
- package/src/components/view/ThemedScreenWrap.tsx +0 -48
- package/src/components/view/ThemedScreenWrap.web.tsx +0 -41
- package/src/components/view/ThemedScrollView.tsx +0 -54
- package/src/components/view/ThemedView.tsx +0 -19
- package/src/hooks/button.ts +0 -152
- package/src/hooks/list.ts +0 -42
- package/src/hooks/overlay.ts +0 -471
- package/src/hooks/react.ts +0 -34
- package/src/hooks/reanimated.ts +0 -6
- package/src/hooks/separator.ts +0 -29
- package/src/hooks/style.ts +0 -79
- package/src/hooks/switch.ts +0 -119
- package/src/hooks/theme.ts +0 -65
- package/src/hooks/view.ts +0 -28
- package/src/index.ts +0 -59
- package/src/test/utils/const.ts +0 -9
- package/src/test/utils/func.ts +0 -55
- package/src/test/utils/testingLib.tsx +0 -17
- package/src/types/button.ts +0 -50
- package/src/types/global.d.ts +0 -5
- package/src/types/icon.ts +0 -21
- package/src/types/list.ts +0 -61
- package/src/types/loading.ts +0 -14
- package/src/types/overlay.ts +0 -216
- package/src/types/provider.ts +0 -6
- package/src/types/react.ts +0 -8
- package/src/types/reanimated.ts +0 -11
- package/src/types/separator.ts +0 -28
- package/src/types/slider.ts +0 -59
- package/src/types/style.ts +0 -26
- package/src/types/switch.ts +0 -31
- package/src/types/text.ts +0 -25
- package/src/types/theme.ts +0 -39
- package/src/types/view.ts +0 -58
- package/src/utils/button/const.ts +0 -10
- package/src/utils/overlay/const.ts +0 -77
- package/src/utils/overlay/func.ts +0 -107
- package/src/utils/reanimated/func.ts +0 -39
- package/src/utils/slider/const.ts +0 -23
- package/src/utils/style/const.ts +0 -4
- package/src/utils/style/func.ts +0 -37
- package/src/utils/switch/const.ts +0 -2
- package/src/utils/theme/const.ts +0 -189
- package/src/utils/theme/restyle.ts +0 -87
|
@@ -1,107 +0,0 @@
|
|
|
1
|
-
import { use as reactUse } from 'react';
|
|
2
|
-
import { getWindowDimensionsHeight } from '../style/func';
|
|
3
|
-
import {
|
|
4
|
-
ActionSheetContext,
|
|
5
|
-
ActionSheetExpandableHeightRatio,
|
|
6
|
-
actionSheetMaxHeightRatio,
|
|
7
|
-
AlertContext,
|
|
8
|
-
} from './const';
|
|
9
|
-
|
|
10
|
-
export function getAlertContext() {
|
|
11
|
-
return reactUse(AlertContext);
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
function getActionSheetExpandableHeightByRatio(
|
|
15
|
-
ratio: ActionSheetExpandableHeightRatio
|
|
16
|
-
) {
|
|
17
|
-
return getWindowDimensionsHeight() * ratio;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
export function getActionSheetMaxHeight(expandable: boolean = false) {
|
|
21
|
-
return expandable
|
|
22
|
-
? getActionSheetExpandableHeightByRatio(
|
|
23
|
-
ActionSheetExpandableHeightRatio.Top
|
|
24
|
-
)
|
|
25
|
-
: getWindowDimensionsHeight() * actionSheetMaxHeightRatio;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
export function getActionSheetHeight(height: number) {
|
|
29
|
-
return Math.min(height, getActionSheetMaxHeight());
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
export function getActionSheetExpandableHeight() {
|
|
33
|
-
return getActionSheetMaxHeight(true);
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
export function getActionSheetExpandableInitHeight() {
|
|
37
|
-
return getActionSheetExpandableHeightByRatio(
|
|
38
|
-
ActionSheetExpandableHeightRatio.Middle
|
|
39
|
-
);
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
function getActionSheetDismiss(height: number, currentHeight: number) {
|
|
43
|
-
return height / 2 < currentHeight;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
function getActionSheetExpandableDismiss(currentHight: number) {
|
|
47
|
-
return (
|
|
48
|
-
currentHight <
|
|
49
|
-
getActionSheetExpandableHeightByRatio(
|
|
50
|
-
ActionSheetExpandableHeightRatio.Bottom
|
|
51
|
-
) /
|
|
52
|
-
2
|
|
53
|
-
);
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
export function getActionSheetSnapHeight(
|
|
57
|
-
height: number,
|
|
58
|
-
currentHeight: number,
|
|
59
|
-
forceDismiss: boolean
|
|
60
|
-
) {
|
|
61
|
-
return forceDismiss || getActionSheetDismiss(height, currentHeight)
|
|
62
|
-
? height
|
|
63
|
-
: 0;
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
export function getActionSheetExpandableSnapHeight(
|
|
67
|
-
currentHight: number,
|
|
68
|
-
forceDismiss: boolean
|
|
69
|
-
) {
|
|
70
|
-
if (forceDismiss || getActionSheetExpandableDismiss(currentHight)) {
|
|
71
|
-
return 0;
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
const height = getWindowDimensionsHeight();
|
|
75
|
-
const topHeight = getActionSheetExpandableHeightByRatio(
|
|
76
|
-
ActionSheetExpandableHeightRatio.Top
|
|
77
|
-
);
|
|
78
|
-
const middleHeight = getActionSheetExpandableHeightByRatio(
|
|
79
|
-
ActionSheetExpandableHeightRatio.Middle
|
|
80
|
-
);
|
|
81
|
-
const bottomHeight = getActionSheetExpandableHeightByRatio(
|
|
82
|
-
ActionSheetExpandableHeightRatio.Bottom
|
|
83
|
-
);
|
|
84
|
-
if (currentHight > middleHeight) {
|
|
85
|
-
return currentHight >
|
|
86
|
-
(height *
|
|
87
|
-
(ActionSheetExpandableHeightRatio.Top +
|
|
88
|
-
ActionSheetExpandableHeightRatio.Middle)) /
|
|
89
|
-
2
|
|
90
|
-
? topHeight
|
|
91
|
-
: middleHeight;
|
|
92
|
-
} else if (currentHight > bottomHeight) {
|
|
93
|
-
return currentHight >
|
|
94
|
-
(height *
|
|
95
|
-
(ActionSheetExpandableHeightRatio.Middle +
|
|
96
|
-
ActionSheetExpandableHeightRatio.Bottom)) /
|
|
97
|
-
2
|
|
98
|
-
? middleHeight
|
|
99
|
-
: bottomHeight;
|
|
100
|
-
} else {
|
|
101
|
-
return bottomHeight;
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
export function getActionSheetContext() {
|
|
106
|
-
return reactUse(ActionSheetContext);
|
|
107
|
-
}
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
SharedValue,
|
|
3
|
-
WithSpringConfig,
|
|
4
|
-
WithTimingConfig,
|
|
5
|
-
} from 'react-native-reanimated';
|
|
6
|
-
import { withSpring, withTiming } from 'react-native-reanimated';
|
|
7
|
-
import { scheduleOnRN } from 'react-native-worklets';
|
|
8
|
-
|
|
9
|
-
/** @internal */
|
|
10
|
-
export function updateSharedValWithTiming(
|
|
11
|
-
sharedVal: SharedValue<number>,
|
|
12
|
-
toVal: number,
|
|
13
|
-
userConfig?: WithTimingConfig,
|
|
14
|
-
cb?: () => void
|
|
15
|
-
) {
|
|
16
|
-
sharedVal.set(
|
|
17
|
-
withTiming(toVal, userConfig, () => {
|
|
18
|
-
if (cb) {
|
|
19
|
-
scheduleOnRN(cb);
|
|
20
|
-
}
|
|
21
|
-
})
|
|
22
|
-
);
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
/** @internal */
|
|
26
|
-
export function updateSharedValWithSpring(
|
|
27
|
-
sharedVal: SharedValue<number>,
|
|
28
|
-
toVal: number,
|
|
29
|
-
userConfig?: WithSpringConfig,
|
|
30
|
-
cb?: () => void
|
|
31
|
-
) {
|
|
32
|
-
sharedVal.set(
|
|
33
|
-
withSpring(toVal, userConfig, () => {
|
|
34
|
-
if (cb) {
|
|
35
|
-
scheduleOnRN(cb);
|
|
36
|
-
}
|
|
37
|
-
})
|
|
38
|
-
);
|
|
39
|
-
}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { BorderSize } from '../theme/const';
|
|
2
|
-
|
|
3
|
-
export enum SliderValueDisplayMode {
|
|
4
|
-
None = 'none',
|
|
5
|
-
Top = 'top',
|
|
6
|
-
Bottom = 'bottom',
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
export enum SliderTrackSize {
|
|
10
|
-
S = 8,
|
|
11
|
-
M = 10,
|
|
12
|
-
L = 12,
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export enum SliderThumbSize {
|
|
16
|
-
S = 20,
|
|
17
|
-
M = 24,
|
|
18
|
-
L = 28,
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
export const sliderThumbDefaultSize = SliderThumbSize.M;
|
|
22
|
-
|
|
23
|
-
export const sliderStepIndicatorDefaultWidth = BorderSize.M;
|
package/src/utils/style/const.ts
DELETED
package/src/utils/style/func.ts
DELETED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import { Dimensions, StyleSheet } from 'react-native';
|
|
2
|
-
import type { Style, StyleOrStyleProp } from '../../types/style';
|
|
3
|
-
|
|
4
|
-
export function createStyleSheet<T extends Record<string, Style>>(styles: T) {
|
|
5
|
-
return StyleSheet.create<T>(styles);
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
export function composeStyles<T extends Style>(
|
|
9
|
-
style1?: StyleOrStyleProp<T>,
|
|
10
|
-
style2?: StyleOrStyleProp<T>
|
|
11
|
-
) {
|
|
12
|
-
return StyleSheet.compose<T, T, T>(style1, style2);
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export function flattenStyle<T extends Style>(style: StyleOrStyleProp<T>) {
|
|
16
|
-
return StyleSheet.flatten<T>(style);
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
export function getWindowDimensions() {
|
|
20
|
-
return Dimensions.get('window');
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
export function getWindowDimensionsWidth() {
|
|
24
|
-
return getWindowDimensions().width;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
export function getWindowDimensionsHeight() {
|
|
28
|
-
return getWindowDimensions().height;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
export function getWindowDimensionsScale() {
|
|
32
|
-
return getWindowDimensions().scale;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
export function getWindowDimensionsFontScale() {
|
|
36
|
-
return getWindowDimensions().fontScale;
|
|
37
|
-
}
|
package/src/utils/theme/const.ts
DELETED
|
@@ -1,189 +0,0 @@
|
|
|
1
|
-
import { createTheme } from '@shopify/restyle';
|
|
2
|
-
import { StyleSheet } from 'react-native';
|
|
3
|
-
|
|
4
|
-
export enum Palette {
|
|
5
|
-
Transparent = 'transparent',
|
|
6
|
-
ThemePri = '#7ccf6b',
|
|
7
|
-
ThemeSec = '#5aa85a',
|
|
8
|
-
ThemePriT = '#7ccf6b80',
|
|
9
|
-
Black = '#000501',
|
|
10
|
-
BlackT = '#00050180',
|
|
11
|
-
White = '#fafafa',
|
|
12
|
-
WhiteT = '#fafafa80',
|
|
13
|
-
Silver = '#c4c4c4',
|
|
14
|
-
Grey = '#7a7a7a',
|
|
15
|
-
Red = '#ff3b30',
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export enum Spacing {
|
|
19
|
-
None = 0,
|
|
20
|
-
XXXS = 2,
|
|
21
|
-
XXS = 4,
|
|
22
|
-
XS = 6,
|
|
23
|
-
S = 10,
|
|
24
|
-
M = 16,
|
|
25
|
-
L = 26,
|
|
26
|
-
XL = 42,
|
|
27
|
-
XXL = 68,
|
|
28
|
-
XXXL = 110,
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
export enum FontSize {
|
|
32
|
-
XS = 12,
|
|
33
|
-
S = 16,
|
|
34
|
-
M = 20,
|
|
35
|
-
L = 24,
|
|
36
|
-
XL = 28,
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
/** @internal */
|
|
40
|
-
const FontLineHeightRatio = 1.4;
|
|
41
|
-
|
|
42
|
-
export enum FontLineHeight {
|
|
43
|
-
XS = FontSize.XS * FontLineHeightRatio,
|
|
44
|
-
S = FontSize.S * FontLineHeightRatio,
|
|
45
|
-
M = FontSize.M * FontLineHeightRatio,
|
|
46
|
-
L = FontSize.L * FontLineHeightRatio,
|
|
47
|
-
XL = FontSize.XL * FontLineHeightRatio,
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
export enum SwitchSize {
|
|
51
|
-
S = 16,
|
|
52
|
-
M = 22,
|
|
53
|
-
L = 28,
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
export enum BorderSize {
|
|
57
|
-
None = 0,
|
|
58
|
-
XS = StyleSheet.hairlineWidth,
|
|
59
|
-
S = 1,
|
|
60
|
-
M = 2,
|
|
61
|
-
L = 4,
|
|
62
|
-
XL = 8,
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
export enum BorderRadius {
|
|
66
|
-
None = 0,
|
|
67
|
-
S = 12,
|
|
68
|
-
M = 24,
|
|
69
|
-
L = 36,
|
|
70
|
-
Round = 9999,
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
export enum ZIndex {
|
|
74
|
-
Base = 0,
|
|
75
|
-
Bottom = 1,
|
|
76
|
-
Middle = 2,
|
|
77
|
-
Top = 3,
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
/** @internal */
|
|
81
|
-
const textVariants = {
|
|
82
|
-
textXS: {
|
|
83
|
-
fontSize: FontSize.XS,
|
|
84
|
-
lineHeight: FontLineHeight.XS,
|
|
85
|
-
color: 'text',
|
|
86
|
-
},
|
|
87
|
-
textS: {
|
|
88
|
-
fontSize: FontSize.S,
|
|
89
|
-
lineHeight: FontLineHeight.S,
|
|
90
|
-
color: 'text',
|
|
91
|
-
},
|
|
92
|
-
textM: {
|
|
93
|
-
fontSize: FontSize.M,
|
|
94
|
-
lineHeight: FontLineHeight.M,
|
|
95
|
-
color: 'text',
|
|
96
|
-
},
|
|
97
|
-
textL: {
|
|
98
|
-
fontSize: FontSize.L,
|
|
99
|
-
lineHeight: FontLineHeight.L,
|
|
100
|
-
color: 'text',
|
|
101
|
-
},
|
|
102
|
-
textXL: {
|
|
103
|
-
fontSize: FontSize.XL,
|
|
104
|
-
lineHeight: FontLineHeight.XL,
|
|
105
|
-
color: 'text',
|
|
106
|
-
},
|
|
107
|
-
};
|
|
108
|
-
|
|
109
|
-
export const lightTheme = createTheme({
|
|
110
|
-
colors: {
|
|
111
|
-
transparent: Palette.Transparent,
|
|
112
|
-
themePri: Palette.ThemePri,
|
|
113
|
-
themeSec: Palette.ThemeSec,
|
|
114
|
-
themePriT: Palette.ThemePriT,
|
|
115
|
-
background: Palette.White,
|
|
116
|
-
backgroundOverlay: Palette.BlackT,
|
|
117
|
-
text: Palette.Black,
|
|
118
|
-
textOverlay: Palette.White,
|
|
119
|
-
textButton: Palette.White,
|
|
120
|
-
border: Palette.Grey,
|
|
121
|
-
separator: Palette.Silver,
|
|
122
|
-
err: Palette.Red,
|
|
123
|
-
},
|
|
124
|
-
spacing: {
|
|
125
|
-
none: Spacing.None,
|
|
126
|
-
xxxs: Spacing.XXXS,
|
|
127
|
-
xxs: Spacing.XXS,
|
|
128
|
-
xs: Spacing.XS,
|
|
129
|
-
s: Spacing.S,
|
|
130
|
-
m: Spacing.M,
|
|
131
|
-
l: Spacing.L,
|
|
132
|
-
xl: Spacing.XL,
|
|
133
|
-
xxl: Spacing.XXL,
|
|
134
|
-
xxxl: Spacing.XXXL,
|
|
135
|
-
},
|
|
136
|
-
breakpoints: {
|
|
137
|
-
smallPhone: 0,
|
|
138
|
-
phone: 300,
|
|
139
|
-
smallTablet: 600,
|
|
140
|
-
tablet: 900,
|
|
141
|
-
desktop: 1200,
|
|
142
|
-
},
|
|
143
|
-
zIndices: {
|
|
144
|
-
base: ZIndex.Base,
|
|
145
|
-
bottom: ZIndex.Bottom,
|
|
146
|
-
middle: ZIndex.Middle,
|
|
147
|
-
top: ZIndex.Top,
|
|
148
|
-
},
|
|
149
|
-
borderRadii: {
|
|
150
|
-
none: BorderRadius.None,
|
|
151
|
-
s: BorderRadius.S,
|
|
152
|
-
m: BorderRadius.M,
|
|
153
|
-
l: BorderRadius.L,
|
|
154
|
-
round: BorderRadius.Round,
|
|
155
|
-
},
|
|
156
|
-
textVariants: {
|
|
157
|
-
...textVariants,
|
|
158
|
-
textXSBold: {
|
|
159
|
-
...textVariants.textXS,
|
|
160
|
-
fontWeight: 'bold',
|
|
161
|
-
},
|
|
162
|
-
textSBold: {
|
|
163
|
-
...textVariants.textS,
|
|
164
|
-
fontWeight: 'bold',
|
|
165
|
-
},
|
|
166
|
-
textMBold: {
|
|
167
|
-
...textVariants.textM,
|
|
168
|
-
fontWeight: 'bold',
|
|
169
|
-
},
|
|
170
|
-
textLBold: {
|
|
171
|
-
...textVariants.textL,
|
|
172
|
-
fontWeight: 'bold',
|
|
173
|
-
},
|
|
174
|
-
textXLBold: {
|
|
175
|
-
...textVariants.textXL,
|
|
176
|
-
fontWeight: 'bold',
|
|
177
|
-
},
|
|
178
|
-
defaults: textVariants.textM,
|
|
179
|
-
},
|
|
180
|
-
});
|
|
181
|
-
|
|
182
|
-
export const darkTheme: typeof lightTheme = {
|
|
183
|
-
...lightTheme,
|
|
184
|
-
colors: {
|
|
185
|
-
...lightTheme.colors,
|
|
186
|
-
background: Palette.Black,
|
|
187
|
-
text: Palette.White,
|
|
188
|
-
},
|
|
189
|
-
};
|
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
/** @internal */
|
|
2
|
-
import {
|
|
3
|
-
backgroundColor,
|
|
4
|
-
backgroundColorShorthand,
|
|
5
|
-
border,
|
|
6
|
-
color,
|
|
7
|
-
composeRestyleFunctions,
|
|
8
|
-
layout,
|
|
9
|
-
opacity,
|
|
10
|
-
position,
|
|
11
|
-
shadow,
|
|
12
|
-
spacing,
|
|
13
|
-
spacingShorthand,
|
|
14
|
-
} from '@shopify/restyle';
|
|
15
|
-
import type {
|
|
16
|
-
AnimatedThemedPressableProps,
|
|
17
|
-
ThemedPressableProps,
|
|
18
|
-
} from '../../types/button';
|
|
19
|
-
import type { IconProps, ThemedIconProps } from '../../types/icon';
|
|
20
|
-
import type { LoadingProps, ThemedLoadingProps } from '../../types/loading';
|
|
21
|
-
import type { InsetsStyleConfig } from '../../types/style';
|
|
22
|
-
import type { Theme } from '../../types/theme';
|
|
23
|
-
import type {
|
|
24
|
-
AnimatedThemedViewProps,
|
|
25
|
-
ThemedScrollViewProps,
|
|
26
|
-
} from '../../types/view';
|
|
27
|
-
|
|
28
|
-
const restyleBaseFuncs = [spacing, spacingShorthand, layout, position];
|
|
29
|
-
|
|
30
|
-
const restyleBackgroundFuncs = [backgroundColor, backgroundColorShorthand];
|
|
31
|
-
|
|
32
|
-
const restyleViewFuncs = [
|
|
33
|
-
...restyleBaseFuncs,
|
|
34
|
-
...restyleBackgroundFuncs,
|
|
35
|
-
opacity,
|
|
36
|
-
border,
|
|
37
|
-
shadow,
|
|
38
|
-
];
|
|
39
|
-
|
|
40
|
-
export const themedPressableRestyleFuncs = composeRestyleFunctions<
|
|
41
|
-
Theme,
|
|
42
|
-
Omit<ThemedPressableProps, 'onPress' | 'scaleRatio' | 'onPressDelayConfig'>
|
|
43
|
-
>(restyleViewFuncs);
|
|
44
|
-
|
|
45
|
-
export const animatedThemedPressableRestyleFuncs = composeRestyleFunctions<
|
|
46
|
-
Theme,
|
|
47
|
-
Omit<
|
|
48
|
-
AnimatedThemedPressableProps,
|
|
49
|
-
'onPress' | 'scaleRatio' | 'onPressDelayConfig' | 'animatedStyle'
|
|
50
|
-
>
|
|
51
|
-
>(restyleViewFuncs);
|
|
52
|
-
|
|
53
|
-
export const themedLoadingRestyleFuncs = composeRestyleFunctions<
|
|
54
|
-
Theme,
|
|
55
|
-
Omit<ThemedLoadingProps, keyof LoadingProps>
|
|
56
|
-
>(restyleBaseFuncs);
|
|
57
|
-
|
|
58
|
-
export const themedLoadingColorRestyleFuncs = composeRestyleFunctions<
|
|
59
|
-
Theme,
|
|
60
|
-
Pick<ThemedLoadingProps, 'color'>
|
|
61
|
-
>([
|
|
62
|
-
// @ts-expect-error
|
|
63
|
-
color,
|
|
64
|
-
]);
|
|
65
|
-
|
|
66
|
-
export const themedIconRestyleFuncs = composeRestyleFunctions<
|
|
67
|
-
Theme,
|
|
68
|
-
Omit<ThemedIconProps, keyof IconProps>
|
|
69
|
-
>(restyleBaseFuncs);
|
|
70
|
-
|
|
71
|
-
export const themedIconColorRestyleFuncs = composeRestyleFunctions<
|
|
72
|
-
Theme,
|
|
73
|
-
Pick<ThemedIconProps, 'color'>
|
|
74
|
-
>([
|
|
75
|
-
// @ts-expect-error
|
|
76
|
-
color,
|
|
77
|
-
]);
|
|
78
|
-
|
|
79
|
-
export const animatedThemedViewRestyleFuncs = composeRestyleFunctions<
|
|
80
|
-
Theme,
|
|
81
|
-
Omit<AnimatedThemedViewProps, 'animatedStyle'>
|
|
82
|
-
>(restyleViewFuncs);
|
|
83
|
-
|
|
84
|
-
export const themedScrollViewRestyleFuncs = composeRestyleFunctions<
|
|
85
|
-
Theme,
|
|
86
|
-
Omit<ThemedScrollViewProps, keyof InsetsStyleConfig | 'ref'>
|
|
87
|
-
>(restyleBaseFuncs);
|