dhre-ui-kit 0.0.63 → 0.0.65
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dhre-ui-kit",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.65",
|
|
4
4
|
"main": "src/index.ts",
|
|
5
5
|
"files": [
|
|
6
6
|
"src",
|
|
@@ -23,6 +23,7 @@
|
|
|
23
23
|
"prepare": "husky"
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
|
+
"@react-native-clipboard/clipboard": "^1.14.2",
|
|
26
27
|
"@react-native-community/blur": "^4.4.1",
|
|
27
28
|
"@testing-library/react-native": "^12.5.1",
|
|
28
29
|
"lint-staged": "^15.2.7",
|
|
@@ -1,11 +1,3 @@
|
|
|
1
|
-
// export type ShowToast = (
|
|
2
|
-
// message: string,
|
|
3
|
-
// duration?: number,
|
|
4
|
-
// isSuccess?: boolean,
|
|
5
|
-
// btnText?: string | null,
|
|
6
|
-
// onBtnPress?: (() => void) | null,
|
|
7
|
-
// ) => void;
|
|
8
|
-
|
|
9
1
|
export interface ToastRef {
|
|
10
2
|
showToast: (
|
|
11
3
|
message: string,
|
|
@@ -24,3 +16,24 @@ export type ShowToast = (
|
|
|
24
16
|
buttonAction?: (() => void) | null,
|
|
25
17
|
) => void;
|
|
26
18
|
export interface ToastProps {}
|
|
19
|
+
// ToastService.interface.ts
|
|
20
|
+
export interface ToastRef {
|
|
21
|
+
showToast: (
|
|
22
|
+
message: string,
|
|
23
|
+
duration?: number,
|
|
24
|
+
isSuccess?: boolean,
|
|
25
|
+
buttonText?: string | null,
|
|
26
|
+
buttonAction?: (() => void) | null,
|
|
27
|
+
) => void;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export interface ToastServiceInterface {
|
|
31
|
+
setRef: (ref: ToastRef | null) => void;
|
|
32
|
+
showToast: (
|
|
33
|
+
message: string,
|
|
34
|
+
duration?: number,
|
|
35
|
+
isSuccess?: boolean,
|
|
36
|
+
buttonText?: string | null,
|
|
37
|
+
buttonAction?: (() => void) | null,
|
|
38
|
+
) => void;
|
|
39
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import {ToastRef, ToastServiceInterface} from './Toast.interface';
|
|
2
|
+
|
|
3
|
+
class ToastService implements ToastServiceInterface {
|
|
4
|
+
private toastRef: ToastRef | null = null;
|
|
5
|
+
|
|
6
|
+
setRef(ref: ToastRef | null) {
|
|
7
|
+
this.toastRef = ref;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
showToast(
|
|
11
|
+
message: string,
|
|
12
|
+
duration: number = 3000,
|
|
13
|
+
isSuccess: boolean = true,
|
|
14
|
+
buttonText: string | null = null,
|
|
15
|
+
buttonAction: (() => void) | null = null,
|
|
16
|
+
) {
|
|
17
|
+
if (this.toastRef) {
|
|
18
|
+
this.toastRef.showToast(
|
|
19
|
+
message,
|
|
20
|
+
duration,
|
|
21
|
+
isSuccess,
|
|
22
|
+
buttonText,
|
|
23
|
+
buttonAction,
|
|
24
|
+
);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
const toastService = new ToastService();
|
|
30
|
+
export default toastService;
|
package/src/index.ts
CHANGED
package/src/utils/deviceUtils.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import {Platform} from 'react-native';
|
|
2
|
+
import Clipboard from '@react-native-clipboard/clipboard';
|
|
2
3
|
|
|
3
4
|
export enum OS {
|
|
4
5
|
ios = 'ios',
|
|
@@ -7,3 +8,7 @@ export enum OS {
|
|
|
7
8
|
|
|
8
9
|
export const isIos = () => Platform.OS === OS.ios;
|
|
9
10
|
export const isAndroid = () => Platform.OS === OS.android;
|
|
11
|
+
|
|
12
|
+
export const copyToClipboard = (textToCopy: string) => {
|
|
13
|
+
Clipboard.setString(textToCopy);
|
|
14
|
+
};
|