@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,72 +0,0 @@
|
|
|
1
|
-
/** @internal */
|
|
2
|
-
import type { FC } from 'react';
|
|
3
|
-
import { GestureDetector } from 'react-native-gesture-handler';
|
|
4
|
-
import {
|
|
5
|
-
useActionSheetGesture,
|
|
6
|
-
useActionSheetHeaderMinHeight,
|
|
7
|
-
useActionSheetOnDismiss,
|
|
8
|
-
} from '../../../hooks/overlay';
|
|
9
|
-
import type { ThemedIconButtonProps } from '../../../types/button';
|
|
10
|
-
import type { ActionSheetHeaderProps } from '../../../types/overlay';
|
|
11
|
-
import type { ThemedTextProps } from '../../../types/text';
|
|
12
|
-
import {
|
|
13
|
-
actionSheetHeaderIconSize,
|
|
14
|
-
actionSheetHeaderPadding,
|
|
15
|
-
} from '../../../utils/overlay/const';
|
|
16
|
-
import { getActionSheetContext } from '../../../utils/overlay/func';
|
|
17
|
-
import { BorderSize } from '../../../utils/theme/const';
|
|
18
|
-
import ThemedView from '../../view/ThemedView';
|
|
19
|
-
|
|
20
|
-
const ThemedText: FC<ThemedTextProps> =
|
|
21
|
-
require('../../text/ThemedText').default;
|
|
22
|
-
const ThemedIconButton: FC<ThemedIconButtonProps> =
|
|
23
|
-
require('../../button/ThemedIconButton').default;
|
|
24
|
-
|
|
25
|
-
const ActionSheetHeader: FC<ActionSheetHeaderProps> = ({
|
|
26
|
-
headerShowIcon = true,
|
|
27
|
-
headerWrapProps,
|
|
28
|
-
headerTextProps,
|
|
29
|
-
headerIconButtonProps,
|
|
30
|
-
}) => {
|
|
31
|
-
const gesture = useActionSheetGesture();
|
|
32
|
-
const minHeight = useActionSheetHeaderMinHeight();
|
|
33
|
-
const onDismiss = useActionSheetOnDismiss();
|
|
34
|
-
|
|
35
|
-
const { title, headerViewRef } = getActionSheetContext();
|
|
36
|
-
const onIconPress: ThemedIconButtonProps['onPress'] = () => {
|
|
37
|
-
onDismiss();
|
|
38
|
-
};
|
|
39
|
-
|
|
40
|
-
return (
|
|
41
|
-
<GestureDetector gesture={gesture}>
|
|
42
|
-
<ThemedView
|
|
43
|
-
ref={headerViewRef}
|
|
44
|
-
justifyContent={'center'}
|
|
45
|
-
alignItems={'center'}
|
|
46
|
-
minHeight={minHeight}
|
|
47
|
-
padding={actionSheetHeaderPadding}
|
|
48
|
-
borderBottomWidth={BorderSize.S}
|
|
49
|
-
borderColor={'border'}
|
|
50
|
-
{...headerWrapProps}
|
|
51
|
-
>
|
|
52
|
-
{!!title && (
|
|
53
|
-
<ThemedText variant={'textMBold'} {...headerTextProps}>
|
|
54
|
-
{title}
|
|
55
|
-
</ThemedText>
|
|
56
|
-
)}
|
|
57
|
-
{headerShowIcon && (
|
|
58
|
-
<ThemedIconButton
|
|
59
|
-
onPress={onIconPress}
|
|
60
|
-
iconName={'cross'}
|
|
61
|
-
iconSize={actionSheetHeaderIconSize}
|
|
62
|
-
position={'absolute'}
|
|
63
|
-
left={0}
|
|
64
|
-
{...headerIconButtonProps}
|
|
65
|
-
/>
|
|
66
|
-
)}
|
|
67
|
-
</ThemedView>
|
|
68
|
-
</GestureDetector>
|
|
69
|
-
);
|
|
70
|
-
};
|
|
71
|
-
|
|
72
|
-
export default ActionSheetHeader;
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
/** @internal */
|
|
2
|
-
import { type FC } from 'react';
|
|
3
|
-
import {
|
|
4
|
-
useActionSheetListView,
|
|
5
|
-
useActionSheetVisible,
|
|
6
|
-
} from '../../../hooks/overlay';
|
|
7
|
-
import type { ActionSheetListViewProps } from '../../../types/overlay';
|
|
8
|
-
import { ActionSheetContext } from '../../../utils/overlay/const';
|
|
9
|
-
import ActionSheetHeader from './ActionSheetHeader';
|
|
10
|
-
import ActionSheetListViewContent from './ActionSheetListViewContent';
|
|
11
|
-
import ActionSheetWrap from './ActionSheetWrap';
|
|
12
|
-
|
|
13
|
-
const ActionSheetListView: FC<ActionSheetListViewProps> = ({
|
|
14
|
-
title,
|
|
15
|
-
expandable,
|
|
16
|
-
listProps,
|
|
17
|
-
onDismiss,
|
|
18
|
-
dismissable,
|
|
19
|
-
wrapViewProps,
|
|
20
|
-
headerShowIcon,
|
|
21
|
-
headerWrapProps,
|
|
22
|
-
headerTextProps,
|
|
23
|
-
headerIconButtonProps,
|
|
24
|
-
visible,
|
|
25
|
-
}) => {
|
|
26
|
-
const { actionSheetVisible } = useActionSheetVisible(visible);
|
|
27
|
-
const actionSheetContextVal = useActionSheetListView(
|
|
28
|
-
title,
|
|
29
|
-
expandable,
|
|
30
|
-
listProps,
|
|
31
|
-
onDismiss,
|
|
32
|
-
dismissable,
|
|
33
|
-
actionSheetVisible
|
|
34
|
-
);
|
|
35
|
-
|
|
36
|
-
return (
|
|
37
|
-
<ActionSheetContext.Provider value={actionSheetContextVal}>
|
|
38
|
-
<ActionSheetWrap
|
|
39
|
-
visible={actionSheetVisible}
|
|
40
|
-
wrapViewProps={wrapViewProps}
|
|
41
|
-
>
|
|
42
|
-
<ActionSheetHeader
|
|
43
|
-
headerShowIcon={headerShowIcon}
|
|
44
|
-
headerWrapProps={headerWrapProps}
|
|
45
|
-
headerTextProps={headerTextProps}
|
|
46
|
-
headerIconButtonProps={headerIconButtonProps}
|
|
47
|
-
/>
|
|
48
|
-
<ActionSheetListViewContent listProps={listProps} />
|
|
49
|
-
</ActionSheetWrap>
|
|
50
|
-
</ActionSheetContext.Provider>
|
|
51
|
-
);
|
|
52
|
-
};
|
|
53
|
-
|
|
54
|
-
export default ActionSheetListView;
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
/** @internal */
|
|
2
|
-
import { useLayoutEffect, type FC } from 'react';
|
|
3
|
-
import type {
|
|
4
|
-
ActionSheetListViewListRefObj,
|
|
5
|
-
ActionSheetListViewProps,
|
|
6
|
-
} from '../../../types/overlay';
|
|
7
|
-
import { getActionSheetContext } from '../../../utils/overlay/func';
|
|
8
|
-
import List from '../../list/List';
|
|
9
|
-
import ActionSheetContentGesture from './ActionSheetContentGesture';
|
|
10
|
-
|
|
11
|
-
const ActionSheetListViewContent: FC<
|
|
12
|
-
Pick<ActionSheetListViewProps, 'listProps'>
|
|
13
|
-
> = ({ listProps }) => {
|
|
14
|
-
const { contentAnimatedRefObj, setContentHeight } = getActionSheetContext();
|
|
15
|
-
useLayoutEffect(() => {
|
|
16
|
-
const contentHeight = (
|
|
17
|
-
contentAnimatedRefObj as ActionSheetListViewListRefObj
|
|
18
|
-
).current?.getChildContainerDimensions().height;
|
|
19
|
-
setContentHeight?.(contentHeight ?? 0);
|
|
20
|
-
});
|
|
21
|
-
|
|
22
|
-
return (
|
|
23
|
-
<ActionSheetContentGesture>
|
|
24
|
-
<List
|
|
25
|
-
ref={contentAnimatedRefObj as ActionSheetListViewListRefObj}
|
|
26
|
-
{...listProps}
|
|
27
|
-
/>
|
|
28
|
-
</ActionSheetContentGesture>
|
|
29
|
-
);
|
|
30
|
-
};
|
|
31
|
-
|
|
32
|
-
export default ActionSheetListViewContent;
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
/** @internal */
|
|
2
|
-
import { type FC } from 'react';
|
|
3
|
-
import {
|
|
4
|
-
useActionSheetOnDismiss,
|
|
5
|
-
useActionSheetOptItemSize,
|
|
6
|
-
} from '../../../hooks/overlay';
|
|
7
|
-
import type { ListKeyExtractor } from '../../../types/list';
|
|
8
|
-
import type {
|
|
9
|
-
ActionSheetOptionListExtraData,
|
|
10
|
-
ActionSheetOption,
|
|
11
|
-
ActionSheetOptionListRefObj,
|
|
12
|
-
ActionSheetOptionsProps,
|
|
13
|
-
} from '../../../types/overlay';
|
|
14
|
-
import { getActionSheetContext } from '../../../utils/overlay/func';
|
|
15
|
-
import List from '../../list/List';
|
|
16
|
-
import ActionSheetContentGesture from './ActionSheetContentGesture';
|
|
17
|
-
import ActionSheetOptionListItem from './ActionSheetOptionListItem';
|
|
18
|
-
|
|
19
|
-
const ActionSheetOptionList: FC<
|
|
20
|
-
Pick<
|
|
21
|
-
ActionSheetOptionsProps,
|
|
22
|
-
'options' | 'optionListProps' | 'optionListItemProps'
|
|
23
|
-
>
|
|
24
|
-
> = ({ options, optionListProps, optionListItemProps }) => {
|
|
25
|
-
const { insetsStyle } = useActionSheetOptItemSize(optionListProps);
|
|
26
|
-
const onDismiss = useActionSheetOnDismiss();
|
|
27
|
-
|
|
28
|
-
const { contentAnimatedRefObj } = getActionSheetContext();
|
|
29
|
-
const keyExtractor: ListKeyExtractor<ActionSheetOption> = ({ text }, index) =>
|
|
30
|
-
`${text}_${index}`;
|
|
31
|
-
const extraData: ActionSheetOptionListExtraData = {
|
|
32
|
-
optionListItemProps,
|
|
33
|
-
onDismiss,
|
|
34
|
-
};
|
|
35
|
-
|
|
36
|
-
return (
|
|
37
|
-
<ActionSheetContentGesture>
|
|
38
|
-
<List
|
|
39
|
-
ref={contentAnimatedRefObj as ActionSheetOptionListRefObj}
|
|
40
|
-
data={options}
|
|
41
|
-
Item={ActionSheetOptionListItem}
|
|
42
|
-
keyExtractor={keyExtractor}
|
|
43
|
-
extraData={extraData}
|
|
44
|
-
contentContainerStyle={insetsStyle}
|
|
45
|
-
{...optionListProps}
|
|
46
|
-
/>
|
|
47
|
-
</ActionSheetContentGesture>
|
|
48
|
-
);
|
|
49
|
-
};
|
|
50
|
-
|
|
51
|
-
export default ActionSheetOptionList;
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
/** @internal */
|
|
2
|
-
import type { FC } from 'react';
|
|
3
|
-
import type { ThemedButtonProps } from '../../../types/button';
|
|
4
|
-
import type { ListItemProps } from '../../../types/list';
|
|
5
|
-
import type {
|
|
6
|
-
ActionSheetOption,
|
|
7
|
-
ActionSheetOptionListExtraData,
|
|
8
|
-
} from '../../../types/overlay';
|
|
9
|
-
import {
|
|
10
|
-
actionSheetOptionListItemPadding,
|
|
11
|
-
actionSheetOptionListItemTextVariant,
|
|
12
|
-
} from '../../../utils/overlay/const';
|
|
13
|
-
import ThemedButton from '../../button/ThemedButton';
|
|
14
|
-
|
|
15
|
-
const ActionSheetOptionListItem: FC<ListItemProps<ActionSheetOption>> = ({
|
|
16
|
-
item: { text, onPress, props },
|
|
17
|
-
extraData,
|
|
18
|
-
}) => {
|
|
19
|
-
const { optionListItemProps, onDismiss } =
|
|
20
|
-
extraData as ActionSheetOptionListExtraData;
|
|
21
|
-
const onItemPress: ThemedButtonProps['onPress'] = (event) => {
|
|
22
|
-
onPress?.(event);
|
|
23
|
-
onDismiss(text);
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
return (
|
|
27
|
-
<ThemedButton
|
|
28
|
-
onPress={onItemPress}
|
|
29
|
-
alignItems={'flex-start'}
|
|
30
|
-
paddingVertical={actionSheetOptionListItemPadding}
|
|
31
|
-
backgroundColor={'background'}
|
|
32
|
-
text={text}
|
|
33
|
-
textVariant={
|
|
34
|
-
actionSheetOptionListItemTextVariant as ThemedButtonProps['textVariant']
|
|
35
|
-
}
|
|
36
|
-
textColor={'text'}
|
|
37
|
-
{...optionListItemProps}
|
|
38
|
-
{...props}
|
|
39
|
-
/>
|
|
40
|
-
);
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
export default ActionSheetOptionListItem;
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
/** @internal */
|
|
2
|
-
import type { FC } from 'react';
|
|
3
|
-
import {
|
|
4
|
-
useActionSheetOpts,
|
|
5
|
-
useActionSheetVisible,
|
|
6
|
-
} from '../../../hooks/overlay';
|
|
7
|
-
import type { ActionSheetOptionsProps } from '../../../types/overlay';
|
|
8
|
-
import { ActionSheetContext } from '../../../utils/overlay/const';
|
|
9
|
-
import ActionSheetHeader from './ActionSheetHeader';
|
|
10
|
-
import ActionSheetOptionList from './ActionSheetOptionList';
|
|
11
|
-
import ActionSheetWrap from './ActionSheetWrap';
|
|
12
|
-
|
|
13
|
-
const ActionSheetOptions: FC<ActionSheetOptionsProps> = ({
|
|
14
|
-
title,
|
|
15
|
-
expandable,
|
|
16
|
-
options,
|
|
17
|
-
optionListProps,
|
|
18
|
-
optionListItemProps,
|
|
19
|
-
onDismiss,
|
|
20
|
-
dismissable,
|
|
21
|
-
wrapViewProps,
|
|
22
|
-
headerShowIcon,
|
|
23
|
-
headerWrapProps,
|
|
24
|
-
headerTextProps,
|
|
25
|
-
headerIconButtonProps,
|
|
26
|
-
visible,
|
|
27
|
-
}) => {
|
|
28
|
-
const { actionSheetVisible } = useActionSheetVisible(visible);
|
|
29
|
-
const actionSheetContextVal = useActionSheetOpts(
|
|
30
|
-
title,
|
|
31
|
-
expandable,
|
|
32
|
-
options,
|
|
33
|
-
optionListProps,
|
|
34
|
-
onDismiss,
|
|
35
|
-
dismissable,
|
|
36
|
-
actionSheetVisible
|
|
37
|
-
);
|
|
38
|
-
|
|
39
|
-
return (
|
|
40
|
-
<ActionSheetContext.Provider value={actionSheetContextVal}>
|
|
41
|
-
<ActionSheetWrap
|
|
42
|
-
visible={actionSheetVisible}
|
|
43
|
-
wrapViewProps={wrapViewProps}
|
|
44
|
-
>
|
|
45
|
-
<ActionSheetHeader
|
|
46
|
-
headerShowIcon={headerShowIcon}
|
|
47
|
-
headerWrapProps={headerWrapProps}
|
|
48
|
-
headerTextProps={headerTextProps}
|
|
49
|
-
headerIconButtonProps={headerIconButtonProps}
|
|
50
|
-
/>
|
|
51
|
-
<ActionSheetOptionList
|
|
52
|
-
options={options}
|
|
53
|
-
optionListProps={optionListProps}
|
|
54
|
-
optionListItemProps={optionListItemProps}
|
|
55
|
-
/>
|
|
56
|
-
</ActionSheetWrap>
|
|
57
|
-
</ActionSheetContext.Provider>
|
|
58
|
-
);
|
|
59
|
-
};
|
|
60
|
-
|
|
61
|
-
export default ActionSheetOptions;
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
/** @internal */
|
|
2
|
-
import type { FC } from 'react';
|
|
3
|
-
import {
|
|
4
|
-
useActionSheetScrollView,
|
|
5
|
-
useActionSheetVisible,
|
|
6
|
-
} from '../../../hooks/overlay';
|
|
7
|
-
import type { ActionSheetScrollViewProps } from '../../../types/overlay';
|
|
8
|
-
import { ActionSheetContext } from '../../../utils/overlay/const';
|
|
9
|
-
import ActionSheetHeader from './ActionSheetHeader';
|
|
10
|
-
import ActionSheetScrollViewContent from './ActionSheetScrollViewContent';
|
|
11
|
-
import ActionSheetWrap from './ActionSheetWrap';
|
|
12
|
-
|
|
13
|
-
const ActionSheetScrollView: FC<ActionSheetScrollViewProps> = ({
|
|
14
|
-
title,
|
|
15
|
-
expandable,
|
|
16
|
-
scrollViewProps,
|
|
17
|
-
children,
|
|
18
|
-
onDismiss,
|
|
19
|
-
dismissable,
|
|
20
|
-
wrapViewProps,
|
|
21
|
-
headerShowIcon,
|
|
22
|
-
headerWrapProps,
|
|
23
|
-
headerTextProps,
|
|
24
|
-
headerIconButtonProps,
|
|
25
|
-
visible,
|
|
26
|
-
}) => {
|
|
27
|
-
const { actionSheetVisible } = useActionSheetVisible(visible);
|
|
28
|
-
const actionSheetContextVal = useActionSheetScrollView(
|
|
29
|
-
title,
|
|
30
|
-
expandable,
|
|
31
|
-
scrollViewProps,
|
|
32
|
-
onDismiss,
|
|
33
|
-
dismissable,
|
|
34
|
-
actionSheetVisible
|
|
35
|
-
);
|
|
36
|
-
|
|
37
|
-
return (
|
|
38
|
-
<ActionSheetContext.Provider value={actionSheetContextVal}>
|
|
39
|
-
<ActionSheetWrap
|
|
40
|
-
visible={actionSheetVisible}
|
|
41
|
-
wrapViewProps={wrapViewProps}
|
|
42
|
-
>
|
|
43
|
-
<ActionSheetHeader
|
|
44
|
-
headerShowIcon={headerShowIcon}
|
|
45
|
-
headerWrapProps={headerWrapProps}
|
|
46
|
-
headerTextProps={headerTextProps}
|
|
47
|
-
headerIconButtonProps={headerIconButtonProps}
|
|
48
|
-
/>
|
|
49
|
-
<ActionSheetScrollViewContent scrollViewProps={scrollViewProps}>
|
|
50
|
-
{children}
|
|
51
|
-
</ActionSheetScrollViewContent>
|
|
52
|
-
</ActionSheetWrap>
|
|
53
|
-
</ActionSheetContext.Provider>
|
|
54
|
-
);
|
|
55
|
-
};
|
|
56
|
-
|
|
57
|
-
export default ActionSheetScrollView;
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
/** @internal */
|
|
2
|
-
import { type FC } from 'react';
|
|
3
|
-
import type { ActionSheetScrollViewProps } from '../../../types/overlay';
|
|
4
|
-
import type {
|
|
5
|
-
OnContentSizeChange,
|
|
6
|
-
PropsWithRequiredChildren,
|
|
7
|
-
ScrollViewRefObj,
|
|
8
|
-
} from '../../../types/view';
|
|
9
|
-
import { getActionSheetContext } from '../../../utils/overlay/func';
|
|
10
|
-
import ThemedScrollView from '../../view/ThemedScrollView';
|
|
11
|
-
import ActionSheetContentGesture from './ActionSheetContentGesture';
|
|
12
|
-
|
|
13
|
-
const ActionSheetScrollViewContent: FC<
|
|
14
|
-
PropsWithRequiredChildren<Pick<ActionSheetScrollViewProps, 'scrollViewProps'>>
|
|
15
|
-
> = ({ scrollViewProps, children }) => {
|
|
16
|
-
const { contentAnimatedRefObj, setContentHeight } = getActionSheetContext();
|
|
17
|
-
const onContentSizeChange: OnContentSizeChange = (
|
|
18
|
-
width: number,
|
|
19
|
-
height: number
|
|
20
|
-
) => {
|
|
21
|
-
setContentHeight?.(height);
|
|
22
|
-
scrollViewProps?.onContentSizeChange?.(width, height);
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
return (
|
|
26
|
-
<ActionSheetContentGesture>
|
|
27
|
-
<ThemedScrollView
|
|
28
|
-
ref={contentAnimatedRefObj as ScrollViewRefObj}
|
|
29
|
-
{...scrollViewProps}
|
|
30
|
-
onContentSizeChange={onContentSizeChange}
|
|
31
|
-
>
|
|
32
|
-
{children}
|
|
33
|
-
</ThemedScrollView>
|
|
34
|
-
</ActionSheetContentGesture>
|
|
35
|
-
);
|
|
36
|
-
};
|
|
37
|
-
|
|
38
|
-
export default ActionSheetScrollViewContent;
|
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
/** @internal */
|
|
2
|
-
import { type FC } from 'react';
|
|
3
|
-
import { useAnimatedStyle } from 'react-native-reanimated';
|
|
4
|
-
import { useActionSheetOnDismiss } from '../../../hooks/overlay';
|
|
5
|
-
import type {
|
|
6
|
-
ActionSheetWrapProps,
|
|
7
|
-
ThemedModalProps,
|
|
8
|
-
} from '../../../types/overlay';
|
|
9
|
-
import {
|
|
10
|
-
getActionSheetContext,
|
|
11
|
-
getActionSheetMaxHeight,
|
|
12
|
-
} from '../../../utils/overlay/func';
|
|
13
|
-
import AnimatedThemedView from '../../view/AnimatedThemedView';
|
|
14
|
-
import ThemedModal from '../modal/ThemedModal';
|
|
15
|
-
|
|
16
|
-
const ActionSheetWrap: FC<ActionSheetWrapProps> = ({
|
|
17
|
-
wrapViewProps,
|
|
18
|
-
children,
|
|
19
|
-
visible,
|
|
20
|
-
}) => {
|
|
21
|
-
const {
|
|
22
|
-
expandable,
|
|
23
|
-
dismissable,
|
|
24
|
-
translateYSharedVal,
|
|
25
|
-
heightSharedVal,
|
|
26
|
-
expandableHeightSharedVal,
|
|
27
|
-
} = getActionSheetContext();
|
|
28
|
-
const onDismiss = useActionSheetOnDismiss();
|
|
29
|
-
const outerWrapAnimatedStyle = useAnimatedStyle(
|
|
30
|
-
() => ({
|
|
31
|
-
...wrapViewProps?.style,
|
|
32
|
-
height: heightSharedVal?.get() ?? 0,
|
|
33
|
-
transform: [{ translateY: translateYSharedVal?.get() ?? 0 }],
|
|
34
|
-
}),
|
|
35
|
-
[wrapViewProps, translateYSharedVal, heightSharedVal]
|
|
36
|
-
);
|
|
37
|
-
const innerWrapAnimatedStyle = useAnimatedStyle(
|
|
38
|
-
() => ({
|
|
39
|
-
height: expandable
|
|
40
|
-
? (expandableHeightSharedVal?.get() ?? 0)
|
|
41
|
-
: (heightSharedVal?.get() ?? 0),
|
|
42
|
-
}),
|
|
43
|
-
[expandable, heightSharedVal, expandableHeightSharedVal]
|
|
44
|
-
);
|
|
45
|
-
|
|
46
|
-
const contentWrapProps: ThemedModalProps['contentWrapProps'] = {
|
|
47
|
-
justifyContent: 'flex-end',
|
|
48
|
-
};
|
|
49
|
-
const onModalDismiss: ThemedModalProps['onDismiss'] = () => {
|
|
50
|
-
onDismiss();
|
|
51
|
-
};
|
|
52
|
-
|
|
53
|
-
return (
|
|
54
|
-
<ThemedModal
|
|
55
|
-
visible={visible}
|
|
56
|
-
contentWrapProps={contentWrapProps}
|
|
57
|
-
onDismiss={onModalDismiss}
|
|
58
|
-
dismissable={dismissable}
|
|
59
|
-
>
|
|
60
|
-
<AnimatedThemedView
|
|
61
|
-
alignSelf={'stretch'}
|
|
62
|
-
maxHeight={getActionSheetMaxHeight(expandable)}
|
|
63
|
-
overflow={'hidden'}
|
|
64
|
-
{...wrapViewProps}
|
|
65
|
-
animatedStyle={outerWrapAnimatedStyle}
|
|
66
|
-
>
|
|
67
|
-
<AnimatedThemedView animatedStyle={innerWrapAnimatedStyle}>
|
|
68
|
-
{children}
|
|
69
|
-
</AnimatedThemedView>
|
|
70
|
-
</AnimatedThemedView>
|
|
71
|
-
</ThemedModal>
|
|
72
|
-
);
|
|
73
|
-
};
|
|
74
|
-
|
|
75
|
-
export default ActionSheetWrap;
|
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
import { useLayoutEffect, useState, type FC } from 'react';
|
|
2
|
-
import { useAnimationSharedVal } from '../../../hooks/reanimated';
|
|
3
|
-
import type {
|
|
4
|
-
AlertContextVal,
|
|
5
|
-
AlertProps,
|
|
6
|
-
OverlayDismissAlertResult,
|
|
7
|
-
} from '../../../types/overlay';
|
|
8
|
-
import {
|
|
9
|
-
AlertContext,
|
|
10
|
-
overlayDismissResultDefaultText,
|
|
11
|
-
OverlayDismissResultType,
|
|
12
|
-
} from '../../../utils/overlay/const';
|
|
13
|
-
import AlertButtons from './AlertButtons';
|
|
14
|
-
import AlertContent from './AlertContent';
|
|
15
|
-
import AlertWrap from './AlertWrap';
|
|
16
|
-
|
|
17
|
-
const Alert: FC<AlertProps> = ({
|
|
18
|
-
customShowAnimation,
|
|
19
|
-
customHideAnimation,
|
|
20
|
-
wrapProps,
|
|
21
|
-
title,
|
|
22
|
-
titleTextProps,
|
|
23
|
-
description,
|
|
24
|
-
descriptionTextProps,
|
|
25
|
-
buttons,
|
|
26
|
-
buttonsWrapProps,
|
|
27
|
-
buttonProps,
|
|
28
|
-
onDismiss,
|
|
29
|
-
dismissable,
|
|
30
|
-
visible = true,
|
|
31
|
-
}) => {
|
|
32
|
-
const [alertVisible, setAlertVisible] = useState(visible);
|
|
33
|
-
const showSharedVal = useAnimationSharedVal();
|
|
34
|
-
useLayoutEffect(() => {
|
|
35
|
-
setAlertVisible(visible);
|
|
36
|
-
}, [visible]);
|
|
37
|
-
|
|
38
|
-
const handleDismiss = (result?: Partial<OverlayDismissAlertResult>) => {
|
|
39
|
-
const tempResult: OverlayDismissAlertResult = {
|
|
40
|
-
resultType: OverlayDismissResultType.Alert,
|
|
41
|
-
title,
|
|
42
|
-
description,
|
|
43
|
-
text: overlayDismissResultDefaultText,
|
|
44
|
-
};
|
|
45
|
-
onDismiss?.(result ? { ...tempResult, ...result } : tempResult);
|
|
46
|
-
setAlertVisible(false);
|
|
47
|
-
};
|
|
48
|
-
const alertContextVal: AlertContextVal = {
|
|
49
|
-
buttonProps,
|
|
50
|
-
onDismiss: (result) => {
|
|
51
|
-
if (customHideAnimation) {
|
|
52
|
-
customHideAnimation(showSharedVal, 0, () => {
|
|
53
|
-
handleDismiss(result);
|
|
54
|
-
});
|
|
55
|
-
} else {
|
|
56
|
-
showSharedVal.set(0);
|
|
57
|
-
handleDismiss(result);
|
|
58
|
-
}
|
|
59
|
-
},
|
|
60
|
-
};
|
|
61
|
-
|
|
62
|
-
return (
|
|
63
|
-
<AlertContext.Provider value={alertContextVal}>
|
|
64
|
-
<AlertWrap
|
|
65
|
-
customShowAnimation={customShowAnimation}
|
|
66
|
-
wrapProps={wrapProps}
|
|
67
|
-
title={title}
|
|
68
|
-
description={description}
|
|
69
|
-
buttons={buttons}
|
|
70
|
-
dismissable={dismissable}
|
|
71
|
-
visible={alertVisible}
|
|
72
|
-
showSharedVal={showSharedVal}
|
|
73
|
-
>
|
|
74
|
-
<AlertContent
|
|
75
|
-
title={title}
|
|
76
|
-
titleTextProps={titleTextProps}
|
|
77
|
-
description={description}
|
|
78
|
-
descriptionTextProps={descriptionTextProps}
|
|
79
|
-
/>
|
|
80
|
-
<AlertButtons buttons={buttons} buttonsWrapProps={buttonsWrapProps} />
|
|
81
|
-
</AlertWrap>
|
|
82
|
-
</AlertContext.Provider>
|
|
83
|
-
);
|
|
84
|
-
};
|
|
85
|
-
|
|
86
|
-
export default Alert;
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import { type FC } from 'react';
|
|
2
|
-
import type { ThemedButtonProps } from '../../../types/button';
|
|
3
|
-
import type { AlertButtonProps } from '../../../types/overlay';
|
|
4
|
-
import { AlertButtonType } from '../../../utils/overlay/const';
|
|
5
|
-
import { getAlertContext } from '../../../utils/overlay/func';
|
|
6
|
-
import { BorderSize } from '../../../utils/theme/const';
|
|
7
|
-
import ThemedButton from '../../button/ThemedButton';
|
|
8
|
-
|
|
9
|
-
const AlertButton: FC<AlertButtonProps> = ({
|
|
10
|
-
type = AlertButtonType.Primary,
|
|
11
|
-
text,
|
|
12
|
-
onPress,
|
|
13
|
-
props,
|
|
14
|
-
}) => {
|
|
15
|
-
const { buttonProps, onDismiss } = getAlertContext();
|
|
16
|
-
const themedButtonOnPress: ThemedButtonProps['onPress'] = (event) => {
|
|
17
|
-
onPress?.(event);
|
|
18
|
-
onDismiss?.({ type, text });
|
|
19
|
-
};
|
|
20
|
-
const isPrimary = type === AlertButtonType.Primary;
|
|
21
|
-
const isDestructive = type === AlertButtonType.Destructive;
|
|
22
|
-
const backgroundColor = isPrimary ? 'themePri' : 'background';
|
|
23
|
-
|
|
24
|
-
return (
|
|
25
|
-
<ThemedButton
|
|
26
|
-
onPress={themedButtonOnPress}
|
|
27
|
-
flex={1}
|
|
28
|
-
borderWidth={BorderSize.S}
|
|
29
|
-
borderColor={
|
|
30
|
-
type === AlertButtonType.Destructive ? 'err' : backgroundColor
|
|
31
|
-
}
|
|
32
|
-
backgroundColor={backgroundColor}
|
|
33
|
-
text={text}
|
|
34
|
-
textColor={isDestructive ? 'err' : isPrimary ? 'background' : 'themePri'}
|
|
35
|
-
{...buttonProps}
|
|
36
|
-
{...props}
|
|
37
|
-
/>
|
|
38
|
-
);
|
|
39
|
-
};
|
|
40
|
-
|
|
41
|
-
export default AlertButton;
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import type { FC } from 'react';
|
|
2
|
-
import type { AlertButtonsProps } from '../../../types/overlay';
|
|
3
|
-
import ThemedView from '../../view/ThemedView';
|
|
4
|
-
import AlertButton from './AlertButton';
|
|
5
|
-
|
|
6
|
-
const AlertButtons: FC<AlertButtonsProps> = ({ buttons, buttonsWrapProps }) => {
|
|
7
|
-
const alertButtons: NonNullable<AlertButtonsProps['buttons']> = buttons ?? [
|
|
8
|
-
[{ text: 'OK' }],
|
|
9
|
-
];
|
|
10
|
-
|
|
11
|
-
return (
|
|
12
|
-
<ThemedView marginTop={'m'} gap={'s'} {...buttonsWrapProps}>
|
|
13
|
-
{alertButtons.map((row, rowIndex) => (
|
|
14
|
-
<ThemedView
|
|
15
|
-
key={`row_${row[0]?.text}_${rowIndex}`}
|
|
16
|
-
flexDirection={'row'}
|
|
17
|
-
gap={'s'}
|
|
18
|
-
>
|
|
19
|
-
{row.map(({ text, ...props }, buttonIndex) => (
|
|
20
|
-
<AlertButton
|
|
21
|
-
key={`button_${text}_${buttonIndex}`}
|
|
22
|
-
text={text}
|
|
23
|
-
{...props}
|
|
24
|
-
/>
|
|
25
|
-
))}
|
|
26
|
-
</ThemedView>
|
|
27
|
-
))}
|
|
28
|
-
</ThemedView>
|
|
29
|
-
);
|
|
30
|
-
};
|
|
31
|
-
|
|
32
|
-
export default AlertButtons;
|