@jobber/components-native 0.91.3-JOB-142285-bc02eef.1 → 0.91.4
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/dist/package.json +2 -2
- package/dist/src/ButtonGroup/ButtonGroup.js +1 -1
- package/dist/src/Chip/Chip.style.js +1 -1
- package/dist/src/ContentOverlay/ContentOverlay.js +3 -5
- package/dist/src/Menu/Menu.js +2 -2
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/dist/types/src/ButtonGroup/components/SecondaryActionSheet/SecondaryActionSheet.d.ts +1 -1
- package/dist/types/src/ContentOverlay/UNSAFE_WrappedModalize.d.ts +1 -1
- package/dist/types/src/ErrorMessageWrapper/context/types.d.ts +1 -1
- package/dist/types/src/Form/context/AtlantisFormContext.d.ts +1 -1
- package/dist/types/src/Form/context/types.d.ts +2 -2
- package/dist/types/src/Form/hooks/useFormViewRefs.d.ts +2 -2
- package/dist/types/src/Form/hooks/useInternalForm.d.ts +3 -3
- package/dist/types/src/Form/types.d.ts +3 -3
- package/dist/types/src/FormatFile/components/FormatFileBottomSheet/FormatFileBottomSheet.d.ts +1 -1
- package/dist/types/src/Menu/types.d.ts +6 -2
- package/package.json +2 -2
- package/src/ButtonGroup/ButtonGroup.tsx +1 -1
- package/src/ButtonGroup/components/SecondaryActionSheet/SecondaryActionSheet.tsx +1 -1
- package/src/Chip/Chip.style.ts +1 -1
- package/src/ContentOverlay/ContentOverlay.tsx +2 -3
- package/src/ErrorMessageWrapper/context/ErrorMessageProvider.tsx +2 -2
- package/src/ErrorMessageWrapper/context/types.ts +1 -1
- package/src/Form/context/types.ts +2 -2
- package/src/Form/hooks/useFormViewRefs.ts +4 -5
- package/src/Form/hooks/useInternalForm.ts +3 -3
- package/src/Form/types.ts +3 -3
- package/src/FormatFile/components/FormatFileBottomSheet/FormatFileBottomSheet.tsx +1 -1
- package/src/Menu/Menu.tsx +2 -2
- package/src/Menu/types.ts +7 -2
package/dist/types/src/ButtonGroup/components/SecondaryActionSheet/SecondaryActionSheet.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ import type { ButtonGroupSecondaryActionProps } from "../../types";
|
|
|
4
4
|
import type { BottomSheetRef } from "../../../BottomSheet/BottomSheet";
|
|
5
5
|
interface SecondaryActionSheetProps {
|
|
6
6
|
readonly actions: ButtonGroupSecondaryActionProps[];
|
|
7
|
-
readonly secondaryActionsRef: RefObject<BottomSheetRef>;
|
|
7
|
+
readonly secondaryActionsRef: RefObject<BottomSheetRef | null>;
|
|
8
8
|
readonly showCancel?: boolean;
|
|
9
9
|
readonly heading?: string;
|
|
10
10
|
readonly onOpenBottomSheet?: () => void;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import type { IHandles } from "react-native-modalize/lib/options";
|
|
3
|
-
export declare const UNSAFE_WrappedModalize: React.ForwardRefExoticComponent<Omit<import("react-native-modalize/lib/options").IProps<any> & React.RefAttributes<
|
|
3
|
+
export declare const UNSAFE_WrappedModalize: React.ForwardRefExoticComponent<Omit<import("react-native-modalize/lib/options").IProps<any> & React.RefAttributes<any>, "ref"> & React.RefAttributes<IHandles | undefined>>;
|
|
@@ -43,7 +43,7 @@ type ElementID = Element["id"];
|
|
|
43
43
|
export interface ErrorMessageContextRegisterParams {
|
|
44
44
|
readonly id: ElementID;
|
|
45
45
|
readonly hasErrorMessage: Methods["hasErrorMessage"];
|
|
46
|
-
readonly ref: RefObject<View>;
|
|
46
|
+
readonly ref: RefObject<View | null>;
|
|
47
47
|
}
|
|
48
48
|
export interface ErrorMessageContextProps {
|
|
49
49
|
/**
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { AtlantisFormContextProps } from "./types";
|
|
2
2
|
export declare const atlantisFormContextDefaultValues: {
|
|
3
|
-
useConfirmBeforeBack: () => import("react").
|
|
3
|
+
useConfirmBeforeBack: () => import("react").RefObject<() => undefined>;
|
|
4
4
|
useInternalFormLocalCache: () => {
|
|
5
5
|
setLocalCache: () => undefined;
|
|
6
6
|
removeLocalCache: () => undefined;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { RefObject } from "react";
|
|
2
2
|
import type { DeepPartial, FieldValues, UseFormReturn } from "react-hook-form";
|
|
3
3
|
export interface UseConfirmBeforeBackProps {
|
|
4
4
|
alwaysPreventBack: boolean;
|
|
@@ -16,7 +16,7 @@ interface LocalCacheOptions {
|
|
|
16
16
|
readonly id?: string | string[];
|
|
17
17
|
}
|
|
18
18
|
export interface AtlantisFormContextProps {
|
|
19
|
-
useConfirmBeforeBack: (props: UseConfirmBeforeBackProps) =>
|
|
19
|
+
useConfirmBeforeBack: (props: UseConfirmBeforeBackProps) => RefObject<() => void>;
|
|
20
20
|
useInternalFormLocalCache: <TData extends FieldValues>(formMethods: UseFormReturn<TData>, cacheKey?: string, options?: LocalCacheOptions) => {
|
|
21
21
|
setLocalCache: (data: DeepPartial<TData>) => void;
|
|
22
22
|
removeLocalCache: () => void;
|
|
@@ -2,8 +2,8 @@ import type { RefObject } from "react";
|
|
|
2
2
|
import type { View } from "react-native";
|
|
3
3
|
import type { KeyboardAwareScrollView } from "react-native-keyboard-aware-scroll-view";
|
|
4
4
|
interface UseFormViewRefsReturn {
|
|
5
|
-
readonly scrollViewRef: RefObject<KeyboardAwareScrollView>;
|
|
6
|
-
readonly bottomViewRef: RefObject<View>;
|
|
5
|
+
readonly scrollViewRef: RefObject<KeyboardAwareScrollView | null>;
|
|
6
|
+
readonly bottomViewRef: RefObject<View | null>;
|
|
7
7
|
readonly scrollToTop: () => void;
|
|
8
8
|
}
|
|
9
9
|
export declare function useFormViewRefs(): UseFormViewRefsReturn;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import type { DeepPartial, FieldValues, UseFormHandleSubmit, UseFormReturn } from "react-hook-form";
|
|
2
|
-
import type {
|
|
2
|
+
import type { RefObject } from "react";
|
|
3
3
|
import type { KeyboardAwareScrollView } from "react-native-keyboard-aware-scroll-view";
|
|
4
4
|
import type { InternalFormProps } from "../types";
|
|
5
5
|
type UseInternalFormProps<T extends FieldValues, SubmitResponseType> = Pick<InternalFormProps<T, SubmitResponseType>, "mode" | "reValidateMode" | "initialValues" | "formRef" | "localCacheKey" | "localCacheExclude" | "localCacheId" | "UNSAFE_allowDiscardLocalCacheWhenOffline"> & {
|
|
6
|
-
scrollViewRef?: RefObject<KeyboardAwareScrollView>;
|
|
6
|
+
scrollViewRef?: RefObject<KeyboardAwareScrollView | null>;
|
|
7
7
|
readonly saveButtonHeight: number;
|
|
8
8
|
readonly messageBannerHeight: number;
|
|
9
9
|
};
|
|
@@ -12,7 +12,7 @@ interface UseInternalForm<T extends FieldValues> {
|
|
|
12
12
|
readonly handleSubmit: UseFormHandleSubmit<T>;
|
|
13
13
|
readonly isSubmitting: boolean;
|
|
14
14
|
readonly isDirty: boolean;
|
|
15
|
-
readonly removeListenerRef:
|
|
15
|
+
readonly removeListenerRef: RefObject<() => void>;
|
|
16
16
|
readonly setLocalCache: (data: DeepPartial<T>) => void;
|
|
17
17
|
}
|
|
18
18
|
export declare function useInternalForm<T extends FieldValues, SubmitResponseType>({ mode, reValidateMode, initialValues, formRef, localCacheKey, localCacheId, scrollViewRef, saveButtonHeight, messageBannerHeight, UNSAFE_allowDiscardLocalCacheWhenOffline, }: UseInternalFormProps<T, SubmitResponseType>): UseInternalForm<T>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ReactElement, RefObject } from "react";
|
|
2
2
|
import type { ControllerProps, DefaultValues, FieldPath, FieldValues, Mode, UseFormReturn } from "react-hook-form";
|
|
3
3
|
import type { IconNames } from "@jobber/design";
|
|
4
4
|
import type { KeyboardAwareScrollView } from "react-native-keyboard-aware-scroll-view";
|
|
@@ -37,7 +37,7 @@ interface FormNoticeMessage {
|
|
|
37
37
|
message: string;
|
|
38
38
|
}
|
|
39
39
|
export type FormRef<T extends FieldValues = FieldValues> = (UseFormReturn<T> & {
|
|
40
|
-
scrollViewRef?: RefObject<KeyboardAwareScrollView>;
|
|
40
|
+
scrollViewRef?: RefObject<KeyboardAwareScrollView | null>;
|
|
41
41
|
saveButtonHeight?: number;
|
|
42
42
|
messageBannerHeight?: number;
|
|
43
43
|
}) | undefined;
|
|
@@ -97,7 +97,7 @@ export interface FormProps<T extends FieldValues, SubmitResponseType> {
|
|
|
97
97
|
/**
|
|
98
98
|
* ref object to access react hook form methods and state
|
|
99
99
|
*/
|
|
100
|
-
formRef?:
|
|
100
|
+
formRef?: RefObject<FormRef<T> | undefined>;
|
|
101
101
|
/**
|
|
102
102
|
* Label to be displayed for the save button
|
|
103
103
|
*/
|
package/dist/types/src/FormatFile/components/FormatFileBottomSheet/FormatFileBottomSheet.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import React from "react";
|
|
|
3
3
|
import type { BottomSheetRef } from "../../../BottomSheet/BottomSheet";
|
|
4
4
|
export type BottomSheetOptionsSuffix = "receipt" | "image" | "file" | "video";
|
|
5
5
|
interface FormatFileBottomSheetProps {
|
|
6
|
-
readonly bottomSheetRef: RefObject<BottomSheetRef>;
|
|
6
|
+
readonly bottomSheetRef: RefObject<BottomSheetRef | null>;
|
|
7
7
|
readonly onPreviewPress?: () => void;
|
|
8
8
|
readonly onRemovePress?: () => void;
|
|
9
9
|
readonly bottomSheetOptionsSuffix?: BottomSheetOptionsSuffix;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { IconColorNames, IconNames } from "@jobber/design";
|
|
2
1
|
import type { ReactElement } from "react";
|
|
2
|
+
import type { IconColorNames, IconNames } from "@jobber/design";
|
|
3
3
|
import type { TextAlign } from "../Typography";
|
|
4
4
|
export interface MenuOptionProps {
|
|
5
5
|
readonly label: string;
|
|
@@ -13,9 +13,13 @@ export interface MenuOptionProps {
|
|
|
13
13
|
export interface MenuOptionInternalProps extends MenuOptionProps {
|
|
14
14
|
setOpen: (bool: boolean) => void;
|
|
15
15
|
}
|
|
16
|
+
export interface CustomActivatorProps {
|
|
17
|
+
readonly onPress?: () => void;
|
|
18
|
+
readonly onLongPress?: () => void;
|
|
19
|
+
}
|
|
16
20
|
export interface MenuProps {
|
|
17
21
|
readonly menuOptions?: MenuOptionProps[];
|
|
18
|
-
readonly customActivator?: ReactElement
|
|
22
|
+
readonly customActivator?: ReactElement<CustomActivatorProps>;
|
|
19
23
|
}
|
|
20
24
|
export interface OverlayProp {
|
|
21
25
|
setOpen: (bool: boolean) => void;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jobber/components-native",
|
|
3
|
-
"version": "0.91.
|
|
3
|
+
"version": "0.91.4",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "React Native implementation of Atlantis",
|
|
6
6
|
"repository": {
|
|
@@ -94,5 +94,5 @@
|
|
|
94
94
|
"react-native-safe-area-context": "^5.4.0",
|
|
95
95
|
"react-native-svg": ">=12.0.0"
|
|
96
96
|
},
|
|
97
|
-
"gitHead": "
|
|
97
|
+
"gitHead": "953deb18e2cf5a920ab5e23295e15aefd3865c0f"
|
|
98
98
|
}
|
|
@@ -48,7 +48,7 @@ export function ButtonGroup({
|
|
|
48
48
|
}: ButtonGroupProps) {
|
|
49
49
|
const { t } = useAtlantisI18n();
|
|
50
50
|
const { handlePress } = usePreventTapWhenOffline();
|
|
51
|
-
const secondaryActionsRef = useRef<BottomSheetRef>();
|
|
51
|
+
const secondaryActionsRef = useRef<BottomSheetRef>(null);
|
|
52
52
|
const { primaryActions, secondaryActions } = getActions(children);
|
|
53
53
|
const styles = useStyles();
|
|
54
54
|
|
|
@@ -9,7 +9,7 @@ import { BottomSheet } from "../../../BottomSheet/BottomSheet";
|
|
|
9
9
|
|
|
10
10
|
interface SecondaryActionSheetProps {
|
|
11
11
|
readonly actions: ButtonGroupSecondaryActionProps[];
|
|
12
|
-
readonly secondaryActionsRef: RefObject<BottomSheetRef>;
|
|
12
|
+
readonly secondaryActionsRef: RefObject<BottomSheetRef | null>;
|
|
13
13
|
readonly showCancel?: boolean;
|
|
14
14
|
readonly heading?: string;
|
|
15
15
|
readonly onOpenBottomSheet?: () => void;
|
package/src/Chip/Chip.style.ts
CHANGED
|
@@ -12,7 +12,7 @@ export const useStyles = buildThemedStyles(tokens => {
|
|
|
12
12
|
justifyContent: "center",
|
|
13
13
|
marginHorizontal: tokens["space-smaller"],
|
|
14
14
|
marginTop: tokens["space-small"],
|
|
15
|
-
paddingHorizontal: tokens["space-
|
|
15
|
+
paddingHorizontal: tokens["space-small"],
|
|
16
16
|
},
|
|
17
17
|
iconLeft: {
|
|
18
18
|
marginHorizontal: tokens["space-smallest"],
|
|
@@ -71,9 +71,9 @@ function ContentOverlayInternal(
|
|
|
71
71
|
const shouldShowDismiss =
|
|
72
72
|
showDismiss || isScreenReaderEnabled || isFullScreenOrTopPosition;
|
|
73
73
|
const [showHeaderShadow, setShowHeaderShadow] = useState<boolean>(false);
|
|
74
|
-
const overlayHeader = useRef<View>();
|
|
74
|
+
const overlayHeader = useRef<View>(null);
|
|
75
75
|
|
|
76
|
-
const internalRef = useRef<Modalize>();
|
|
76
|
+
const internalRef = useRef<Modalize>(null);
|
|
77
77
|
const [modalizeMethods, setModalizeMethods] = useState<ContentOverlayRef>();
|
|
78
78
|
const callbackInternalRef = useCallback((instance: Modalize) => {
|
|
79
79
|
if (instance && !internalRef.current) {
|
|
@@ -244,7 +244,6 @@ function ContentOverlayInternal(
|
|
|
244
244
|
{shouldShowDismiss && (
|
|
245
245
|
<View
|
|
246
246
|
style={styles.dismissButton}
|
|
247
|
-
// @ts-expect-error tsc-ci
|
|
248
247
|
ref={overlayHeader}
|
|
249
248
|
accessibilityLabel={accessibilityLabel || closeOverlayA11YLabel}
|
|
250
249
|
accessible={true}
|
|
@@ -49,13 +49,13 @@ export function ErrorMessageProvider({ children }: ErrorMessageProviderProps) {
|
|
|
49
49
|
}
|
|
50
50
|
}
|
|
51
51
|
|
|
52
|
-
function getMeasure(ref: RefObject<View>) {
|
|
52
|
+
function getMeasure(ref: RefObject<View | null>) {
|
|
53
53
|
return function measure(...args: Parameters<NativeMethods["measureLayout"]>) {
|
|
54
54
|
ref.current?.measureLayout(...args);
|
|
55
55
|
};
|
|
56
56
|
}
|
|
57
57
|
|
|
58
|
-
function getAccessibilityFocus(ref: RefObject<View>) {
|
|
58
|
+
function getAccessibilityFocus(ref: RefObject<View | null>) {
|
|
59
59
|
return function accessibilityFocus() {
|
|
60
60
|
const reactTag = findNodeHandle(ref.current);
|
|
61
61
|
reactTag &&
|
|
@@ -50,7 +50,7 @@ type ElementID = Element["id"];
|
|
|
50
50
|
export interface ErrorMessageContextRegisterParams {
|
|
51
51
|
readonly id: ElementID;
|
|
52
52
|
readonly hasErrorMessage: Methods["hasErrorMessage"];
|
|
53
|
-
readonly ref: RefObject<View>;
|
|
53
|
+
readonly ref: RefObject<View | null>;
|
|
54
54
|
}
|
|
55
55
|
|
|
56
56
|
export interface ErrorMessageContextProps {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { RefObject } from "react";
|
|
2
2
|
import type { DeepPartial, FieldValues, UseFormReturn } from "react-hook-form";
|
|
3
3
|
|
|
4
4
|
export interface UseConfirmBeforeBackProps {
|
|
@@ -21,7 +21,7 @@ interface LocalCacheOptions {
|
|
|
21
21
|
export interface AtlantisFormContextProps {
|
|
22
22
|
useConfirmBeforeBack: (
|
|
23
23
|
props: UseConfirmBeforeBackProps,
|
|
24
|
-
) =>
|
|
24
|
+
) => RefObject<() => void>;
|
|
25
25
|
useInternalFormLocalCache: <TData extends FieldValues>(
|
|
26
26
|
formMethods: UseFormReturn<TData>,
|
|
27
27
|
cacheKey?: string,
|
|
@@ -4,15 +4,14 @@ import type { View } from "react-native";
|
|
|
4
4
|
import type { KeyboardAwareScrollView } from "react-native-keyboard-aware-scroll-view";
|
|
5
5
|
|
|
6
6
|
interface UseFormViewRefsReturn {
|
|
7
|
-
readonly scrollViewRef: RefObject<KeyboardAwareScrollView>;
|
|
8
|
-
readonly bottomViewRef: RefObject<View>;
|
|
7
|
+
readonly scrollViewRef: RefObject<KeyboardAwareScrollView | null>;
|
|
8
|
+
readonly bottomViewRef: RefObject<View | null>;
|
|
9
9
|
readonly scrollToTop: () => void;
|
|
10
10
|
}
|
|
11
11
|
|
|
12
12
|
export function useFormViewRefs(): UseFormViewRefsReturn {
|
|
13
|
-
const scrollViewRef
|
|
14
|
-
|
|
15
|
-
const bottomViewRef: RefObject<View> = useRef<View>(null);
|
|
13
|
+
const scrollViewRef = useRef<KeyboardAwareScrollView>(null);
|
|
14
|
+
const bottomViewRef = useRef<View>(null);
|
|
16
15
|
const scrollToTop = useCallback(() => {
|
|
17
16
|
scrollViewRef.current?.scrollToPosition(0, 0);
|
|
18
17
|
}, [scrollViewRef]);
|
|
@@ -5,7 +5,7 @@ import type {
|
|
|
5
5
|
UseFormReturn,
|
|
6
6
|
} from "react-hook-form";
|
|
7
7
|
import { useForm } from "react-hook-form";
|
|
8
|
-
import type {
|
|
8
|
+
import type { RefObject } from "react";
|
|
9
9
|
import type { KeyboardAwareScrollView } from "react-native-keyboard-aware-scroll-view";
|
|
10
10
|
import { useAtlantisContext } from "../../AtlantisContext";
|
|
11
11
|
import { useAtlantisFormContext } from "../context/AtlantisFormContext";
|
|
@@ -22,7 +22,7 @@ type UseInternalFormProps<T extends FieldValues, SubmitResponseType> = Pick<
|
|
|
22
22
|
| "localCacheId"
|
|
23
23
|
| "UNSAFE_allowDiscardLocalCacheWhenOffline"
|
|
24
24
|
> & {
|
|
25
|
-
scrollViewRef?: RefObject<KeyboardAwareScrollView>;
|
|
25
|
+
scrollViewRef?: RefObject<KeyboardAwareScrollView | null>;
|
|
26
26
|
readonly saveButtonHeight: number;
|
|
27
27
|
readonly messageBannerHeight: number;
|
|
28
28
|
};
|
|
@@ -32,7 +32,7 @@ interface UseInternalForm<T extends FieldValues> {
|
|
|
32
32
|
readonly handleSubmit: UseFormHandleSubmit<T>;
|
|
33
33
|
readonly isSubmitting: boolean;
|
|
34
34
|
readonly isDirty: boolean;
|
|
35
|
-
readonly removeListenerRef:
|
|
35
|
+
readonly removeListenerRef: RefObject<() => void>;
|
|
36
36
|
readonly setLocalCache: (data: DeepPartial<T>) => void;
|
|
37
37
|
}
|
|
38
38
|
|
package/src/Form/types.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ReactElement, RefObject } from "react";
|
|
2
2
|
import type {
|
|
3
3
|
ControllerProps,
|
|
4
4
|
DefaultValues,
|
|
@@ -54,7 +54,7 @@ interface FormNoticeMessage {
|
|
|
54
54
|
|
|
55
55
|
export type FormRef<T extends FieldValues = FieldValues> =
|
|
56
56
|
| (UseFormReturn<T> & {
|
|
57
|
-
scrollViewRef?: RefObject<KeyboardAwareScrollView>;
|
|
57
|
+
scrollViewRef?: RefObject<KeyboardAwareScrollView | null>;
|
|
58
58
|
saveButtonHeight?: number;
|
|
59
59
|
messageBannerHeight?: number;
|
|
60
60
|
})
|
|
@@ -127,7 +127,7 @@ export interface FormProps<T extends FieldValues, SubmitResponseType> {
|
|
|
127
127
|
/**
|
|
128
128
|
* ref object to access react hook form methods and state
|
|
129
129
|
*/
|
|
130
|
-
formRef?:
|
|
130
|
+
formRef?: RefObject<FormRef<T> | undefined>;
|
|
131
131
|
|
|
132
132
|
/**
|
|
133
133
|
* Label to be displayed for the save button
|
|
@@ -9,7 +9,7 @@ import { useAtlantisI18n } from "../../../hooks/useAtlantisI18n";
|
|
|
9
9
|
export type BottomSheetOptionsSuffix = "receipt" | "image" | "file" | "video";
|
|
10
10
|
|
|
11
11
|
interface FormatFileBottomSheetProps {
|
|
12
|
-
readonly bottomSheetRef: RefObject<BottomSheetRef>;
|
|
12
|
+
readonly bottomSheetRef: RefObject<BottomSheetRef | null>;
|
|
13
13
|
readonly onPreviewPress?: () => void;
|
|
14
14
|
readonly onRemovePress?: () => void;
|
|
15
15
|
readonly bottomSheetOptionsSuffix?: BottomSheetOptionsSuffix;
|
package/src/Menu/Menu.tsx
CHANGED
|
@@ -23,8 +23,8 @@ import { useAtlantisTheme } from "../AtlantisThemeContext";
|
|
|
23
23
|
export function Menu({ menuOptions, customActivator }: MenuProps) {
|
|
24
24
|
const [open, setOpen] = useState<boolean>(false);
|
|
25
25
|
const [menuPosition, setMenuPosition] = useState<object>();
|
|
26
|
-
const activatorLayout = useRef<LayoutRectangle>();
|
|
27
|
-
const menuButtonRef = useRef<View
|
|
26
|
+
const activatorLayout = useRef<LayoutRectangle>(null);
|
|
27
|
+
const menuButtonRef = useRef<View>(null);
|
|
28
28
|
const screenInfo = useScreenInformation();
|
|
29
29
|
|
|
30
30
|
const { t } = useAtlantisI18n();
|
package/src/Menu/types.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { IconColorNames, IconNames } from "@jobber/design";
|
|
2
1
|
import type { ReactElement } from "react";
|
|
2
|
+
import type { IconColorNames, IconNames } from "@jobber/design";
|
|
3
3
|
import type { TextAlign } from "../Typography";
|
|
4
4
|
|
|
5
5
|
export interface MenuOptionProps {
|
|
@@ -16,9 +16,14 @@ export interface MenuOptionInternalProps extends MenuOptionProps {
|
|
|
16
16
|
setOpen: (bool: boolean) => void;
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
+
export interface CustomActivatorProps {
|
|
20
|
+
readonly onPress?: () => void;
|
|
21
|
+
readonly onLongPress?: () => void;
|
|
22
|
+
}
|
|
23
|
+
|
|
19
24
|
export interface MenuProps {
|
|
20
25
|
readonly menuOptions?: MenuOptionProps[];
|
|
21
|
-
readonly customActivator?: ReactElement
|
|
26
|
+
readonly customActivator?: ReactElement<CustomActivatorProps>;
|
|
22
27
|
}
|
|
23
28
|
|
|
24
29
|
export interface OverlayProp {
|