@teamturing/react-native-kit 1.7.0 → 1.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/commonjs/component/Icon/Icons.js +14 -0
- package/lib/commonjs/component/Icon/Icons.js.map +1 -1
- package/lib/commonjs/component/dialog/CommonDialog.js +42 -0
- package/lib/commonjs/component/dialog/CommonDialog.js.map +1 -1
- package/lib/commonjs/component/dialog/DialogProvider.js +1 -51
- package/lib/commonjs/component/dialog/DialogProvider.js.map +1 -1
- package/lib/module/component/Icon/Icons.js +2 -0
- package/lib/module/component/Icon/Icons.js.map +1 -1
- package/lib/module/component/dialog/CommonDialog.js +39 -0
- package/lib/module/component/dialog/CommonDialog.js.map +1 -1
- package/lib/module/component/dialog/DialogProvider.js +0 -48
- package/lib/module/component/dialog/DialogProvider.js.map +1 -1
- package/lib/typescript/commonjs/src/component/Icon/Icons.d.ts +2 -0
- package/lib/typescript/commonjs/src/component/Icon/Icons.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/component/TextField/BaseTextField.d.ts +2 -2
- package/lib/typescript/commonjs/src/component/dialog/CommonDialog.d.ts +9 -0
- package/lib/typescript/commonjs/src/component/dialog/CommonDialog.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/component/dialog/DialogProvider.d.ts +1 -27
- package/lib/typescript/commonjs/src/component/dialog/DialogProvider.d.ts.map +1 -1
- package/lib/typescript/module/src/component/Icon/Icons.d.ts +2 -0
- package/lib/typescript/module/src/component/Icon/Icons.d.ts.map +1 -1
- package/lib/typescript/module/src/component/TextField/BaseTextField.d.ts +2 -2
- package/lib/typescript/module/src/component/dialog/CommonDialog.d.ts +9 -0
- package/lib/typescript/module/src/component/dialog/CommonDialog.d.ts.map +1 -1
- package/lib/typescript/module/src/component/dialog/DialogProvider.d.ts +1 -27
- package/lib/typescript/module/src/component/dialog/DialogProvider.d.ts.map +1 -1
- package/package.json +3 -3
- package/src/component/Icon/Icons.tsx +2 -0
- package/src/component/dialog/CommonDialog.tsx +46 -0
- package/src/component/dialog/DialogProvider.tsx +1 -61
|
@@ -1,34 +1,14 @@
|
|
|
1
1
|
import { useCallback, useRef } from 'react';
|
|
2
2
|
|
|
3
3
|
import { createCtx } from '../../util';
|
|
4
|
-
import { AppEvent } from '../../util/AppEvent';
|
|
5
4
|
|
|
6
5
|
import type { CommonBottomSheetDialogRef, CommonBottomSheetDialogOpenParams } from './CommonBottomSheetDialog';
|
|
7
|
-
import type
|
|
6
|
+
import { type CommonDialogRef } from './CommonDialog';
|
|
8
7
|
import type { LottieDialogRef, LottieDialogShowParams } from './LottieDialog';
|
|
9
8
|
import type { ToastDialogRef } from './ToastDialog';
|
|
10
9
|
|
|
11
|
-
type HandleErrorWithCommonDialogOption = {
|
|
12
|
-
title: string;
|
|
13
|
-
body: string;
|
|
14
|
-
hideErrorReportButton: boolean;
|
|
15
|
-
buttonText: string;
|
|
16
|
-
};
|
|
17
|
-
let defaultHandleErrorWithCommonDialogOption: HandleErrorWithCommonDialogOption = {
|
|
18
|
-
title: '오류가 발생했습니다',
|
|
19
|
-
body: '잠시 후에 다시 시도해주세요',
|
|
20
|
-
hideErrorReportButton: false,
|
|
21
|
-
buttonText: '확인',
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
export function setDefaultErrorWithCommonDialogOption(option: Partial<HandleErrorWithCommonDialogOption>) {
|
|
25
|
-
defaultHandleErrorWithCommonDialogOption = { ...defaultHandleErrorWithCommonDialogOption, ...option };
|
|
26
|
-
}
|
|
27
|
-
|
|
28
10
|
export const [useDialogContext, DialogProvider, DialogConsumer, useDialogContextSafely] = createCtx(() => {
|
|
29
11
|
const commonDialog = useRef<CommonDialogRef>(null);
|
|
30
|
-
const openCommon = useCallback((params: CommonDialogOpenParams) => commonDialog.current?.open(params), []);
|
|
31
|
-
const closeCommon = useCallback((type?: string) => commonDialog.current?.close(type), []);
|
|
32
12
|
|
|
33
13
|
const commonBottomSheetDialog = useRef<CommonBottomSheetDialogRef>(null);
|
|
34
14
|
const openCommonBottomSheet = useCallback(
|
|
@@ -38,8 +18,6 @@ export const [useDialogContext, DialogProvider, DialogConsumer, useDialogContext
|
|
|
38
18
|
const closeCommonBottomSheet = useCallback((type?: string) => commonBottomSheetDialog.current?.close(type), []);
|
|
39
19
|
|
|
40
20
|
const toastDialog = useRef<ToastDialogRef>(null);
|
|
41
|
-
const showSuccessToast = useCallback((text: string) => toastDialog.current?.show('success', text), []);
|
|
42
|
-
const showWarningToast = useCallback((text: string) => toastDialog.current?.show('warning', text), []);
|
|
43
21
|
|
|
44
22
|
const lottieDialog = useRef<LottieDialogRef>(null);
|
|
45
23
|
const showLottie = useCallback((params: LottieDialogShowParams) => lottieDialog.current?.show(params), []);
|
|
@@ -47,49 +25,11 @@ export const [useDialogContext, DialogProvider, DialogConsumer, useDialogContext
|
|
|
47
25
|
// const birthInputDialog = useRef<BirthInputDialogRef>(null);
|
|
48
26
|
// const openBirthInput = useCallback((params: BirthInputDialogParams) => birthInputDialog.current?.open(params), []);
|
|
49
27
|
|
|
50
|
-
const handleErrorWithCommonDialogOptions = useCallback(
|
|
51
|
-
(options: Partial<HandleErrorWithCommonDialogOption> = defaultHandleErrorWithCommonDialogOption) => {
|
|
52
|
-
const { title, body, hideErrorReportButton, buttonText } = {
|
|
53
|
-
...defaultHandleErrorWithCommonDialogOption,
|
|
54
|
-
...options,
|
|
55
|
-
};
|
|
56
|
-
openCommon({
|
|
57
|
-
iconName: 'exclamation_point_in_circle',
|
|
58
|
-
imageSize: '64',
|
|
59
|
-
title: title,
|
|
60
|
-
body: body,
|
|
61
|
-
buttons: [
|
|
62
|
-
{
|
|
63
|
-
title: buttonText,
|
|
64
|
-
},
|
|
65
|
-
hideErrorReportButton
|
|
66
|
-
? null
|
|
67
|
-
: {
|
|
68
|
-
title: '오류 제보하기',
|
|
69
|
-
onPress: () => AppEvent.emitEvent('NAVIGATE_BUG_REPORT'),
|
|
70
|
-
},
|
|
71
|
-
],
|
|
72
|
-
buttonType: 'vertical-primary-text',
|
|
73
|
-
});
|
|
74
|
-
},
|
|
75
|
-
[openCommon],
|
|
76
|
-
);
|
|
77
|
-
const handleErrorWithCommonDialog = useCallback(
|
|
78
|
-
() => handleErrorWithCommonDialogOptions(),
|
|
79
|
-
[handleErrorWithCommonDialogOptions],
|
|
80
|
-
);
|
|
81
|
-
|
|
82
28
|
return {
|
|
83
29
|
commonDialog,
|
|
84
30
|
toastDialog,
|
|
85
31
|
lottieDialog,
|
|
86
|
-
closeCommon,
|
|
87
|
-
handleErrorWithCommonDialog,
|
|
88
|
-
handleErrorWithCommonDialogOptions,
|
|
89
|
-
openCommon,
|
|
90
32
|
showLottie,
|
|
91
|
-
showSuccessToast,
|
|
92
|
-
showWarningToast,
|
|
93
33
|
commonBottomSheetDialog,
|
|
94
34
|
openCommonBottomSheet,
|
|
95
35
|
closeCommonBottomSheet,
|