@jobber/components-native 0.116.2-large-chec-aaeb9fd.2 → 0.116.3

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.
Files changed (86) hide show
  1. package/dist/package.json +5 -5
  2. package/dist/src/Checkbox/Checkbox.test.js +5 -1
  3. package/dist/src/ContentOverlay/hooks/useViewLayoutHeight.test.js +0 -24
  4. package/dist/src/Form/Form.js +3 -3
  5. package/dist/src/FormField/FormField.test.js +5 -1
  6. package/dist/src/InputFieldWrapper/InputFieldWrapper.style.js +1 -7
  7. package/dist/src/InputText/InputText.js +1 -5
  8. package/dist/src/InputText/InputText.test.js +5 -1
  9. package/dist/src/Select/Select.style.js +2 -23
  10. package/dist/src/Typography/Typography.js +2 -2
  11. package/dist/src/primitives/Select/SelectPrimitive.js +2 -6
  12. package/dist/src/utils/types.js +1 -0
  13. package/dist/tsconfig.build.tsbuildinfo +1 -1
  14. package/dist/tsconfig.json +4 -0
  15. package/dist/types/src/ActionItem/components/ActionItemContainer.style.d.ts +1 -1
  16. package/dist/types/src/Banner/Banner.style.d.ts +2 -2
  17. package/dist/types/src/Button/Button.style.d.ts +2 -2
  18. package/dist/types/src/Button/components/InternalButtonLoading/InternalButtonLoading.style.d.ts +9 -4
  19. package/dist/types/src/ButtonGroup/ButtonGroup.style.d.ts +1 -1
  20. package/dist/types/src/Card/Card.style.d.ts +1 -1
  21. package/dist/types/src/Checkbox/Checkbox.style.d.ts +2 -2
  22. package/dist/types/src/Checkbox/CheckboxGroup.style.d.ts +1 -1
  23. package/dist/types/src/ContentOverlay/BottomSheetKeyboardAwareScrollView.d.ts +2 -7
  24. package/dist/types/src/ContentOverlay/ContentOverlay.style.d.ts +1 -1
  25. package/dist/types/src/Disclosure/Disclosure.style.d.ts +1 -1
  26. package/dist/types/src/Divider/DividerHorizontal.style.d.ts +1 -1
  27. package/dist/types/src/Divider/DividerVertical.style.d.ts +1 -1
  28. package/dist/types/src/ErrorMessageWrapper/ErrorMessageWrapper.style.d.ts +4 -4
  29. package/dist/types/src/ErrorMessageWrapper/context/types.d.ts +3 -2
  30. package/dist/types/src/Flex/Flex.styles.d.ts +4 -4
  31. package/dist/types/src/Form/Form.style.d.ts +1 -1
  32. package/dist/types/src/Form/components/FormActionBar/FormActionBar.style.d.ts +1 -1
  33. package/dist/types/src/Form/components/FormBody/FormBody.style.d.ts +1 -1
  34. package/dist/types/src/Form/components/FormMask/FormMask.style.d.ts +2 -2
  35. package/dist/types/src/Form/components/FormMessage/components/InternalFormMessage/InternalFormMessage.style.d.ts +1 -1
  36. package/dist/types/src/Form/hooks/useFormViewRefs.d.ts +2 -2
  37. package/dist/types/src/FormatFile/components/FileView/FileView.style.d.ts +5 -5
  38. package/dist/types/src/FormatFile/components/MediaView/MediaView.style.d.ts +4 -4
  39. package/dist/types/src/FormatFile/components/ProgressBar/ProgressBar.style.d.ts +2 -2
  40. package/dist/types/src/Glimmer/Glimmer.shape.style.d.ts +3 -3
  41. package/dist/types/src/Glimmer/Glimmer.style.d.ts +4 -4
  42. package/dist/types/src/InputFieldWrapper/CommonInputStyles.style.d.ts +3 -3
  43. package/dist/types/src/InputFieldWrapper/InputFieldWrapper.style.d.ts +4 -106
  44. package/dist/types/src/InputFieldWrapper/components/ClearAction/ClearAction.style.d.ts +1 -1
  45. package/dist/types/src/InputPressable/InputPressable.d.ts +3 -3
  46. package/dist/types/src/InputPressable/InputPressable.style.d.ts +11 -21
  47. package/dist/types/src/InputSearch/InputSearch.style.d.ts +3 -3
  48. package/dist/types/src/InputText/InputText.d.ts +2 -2
  49. package/dist/types/src/InputText/context/InputAccessoriesProvider.style.d.ts +8 -17
  50. package/dist/types/src/InputTime/InputTime.style.d.ts +3 -3
  51. package/dist/types/src/ProgressBar/ProgressBar.size.style.d.ts +2 -2
  52. package/dist/types/src/ProgressBar/ProgressBar.style.d.ts +4 -4
  53. package/dist/types/src/ProgressIndicator/ProgressIndicator.size.style.d.ts +2 -2
  54. package/dist/types/src/ProgressIndicator/ProgressIndicator.style.d.ts +5 -5
  55. package/dist/types/src/Select/Select.style.d.ts +12 -29
  56. package/dist/types/src/Select/components/SelectDefaultPicker/SelectDefaultPicker.style.d.ts +4 -4
  57. package/dist/types/src/Switch/Switch.styles.d.ts +1 -1
  58. package/dist/types/src/TextList/TextList.style.d.ts +1 -1
  59. package/dist/types/src/Toast/Toast.styles.d.ts +1 -1
  60. package/dist/types/src/Typography/Typography.style.d.ts +1 -3
  61. package/dist/types/src/utils/types.d.ts +3 -0
  62. package/package.json +5 -5
  63. package/src/Checkbox/Checkbox.test.tsx +5 -1
  64. package/src/ContentOverlay/BottomSheetKeyboardAwareScrollView.tsx +9 -1
  65. package/src/ContentOverlay/ContentOverlay.tsx +2 -1
  66. package/src/ContentOverlay/hooks/useViewLayoutHeight.test.ts +3 -27
  67. package/src/ErrorMessageWrapper/ErrorMessageWrapper.tsx +2 -1
  68. package/src/ErrorMessageWrapper/context/ErrorMessageProvider.tsx +4 -3
  69. package/src/ErrorMessageWrapper/context/types.ts +3 -2
  70. package/src/Flex/Flex.styles.tsx +1 -1
  71. package/src/Form/Form.tsx +1 -1
  72. package/src/Form/components/FormActionBar/FormActionBar.tsx +2 -2
  73. package/src/Form/hooks/useFormViewRefs.ts +3 -3
  74. package/src/FormField/FormField.test.tsx +5 -1
  75. package/src/InputFieldWrapper/CommonInputStyles.style.ts +6 -5
  76. package/src/InputFieldWrapper/InputFieldWrapper.style.ts +32 -8
  77. package/src/InputPressable/InputPressable.style.ts +11 -1
  78. package/src/InputPressable/InputPressable.tsx +5 -3
  79. package/src/InputText/InputText.test.tsx +5 -1
  80. package/src/InputText/InputText.tsx +8 -8
  81. package/src/InputText/context/InputAccessoriesProvider.style.tsx +8 -2
  82. package/src/Select/Select.style.ts +31 -25
  83. package/src/Typography/Typography.style.ts +2 -1
  84. package/src/Typography/Typography.tsx +2 -2
  85. package/src/primitives/Select/SelectPrimitive.tsx +7 -6
  86. package/src/utils/types.ts +4 -0
@@ -1,6 +1,6 @@
1
- export declare const styles: {
1
+ export declare const styles: Readonly<{
2
2
  container: {
3
- width: "100%";
3
+ width: string;
4
4
  justifyContent: "center";
5
5
  };
6
- };
6
+ }>;
@@ -1,4 +1,4 @@
1
- export declare const sizeStyles: {
1
+ export declare const sizeStyles: Readonly<{
2
2
  smaller: {
3
3
  height: number;
4
4
  };
@@ -8,4 +8,4 @@ export declare const sizeStyles: {
8
8
  base: {
9
9
  height: number;
10
10
  };
11
- };
11
+ }>;
@@ -7,21 +7,21 @@ export declare const useStyles: () => {
7
7
  };
8
8
  progressBarInner: {
9
9
  backgroundColor: string;
10
- width: "100%";
11
- height: "100%";
10
+ width: string;
11
+ height: string;
12
12
  position: "absolute";
13
13
  left: number;
14
14
  top: number;
15
15
  borderRadius: number;
16
16
  };
17
17
  progressInner: {
18
- height: "100%";
18
+ height: string;
19
19
  borderRadius: number;
20
20
  };
21
21
  step: {
22
22
  flex: number;
23
23
  marginRight: number;
24
- height: "100%";
24
+ height: string;
25
25
  borderRadius: number;
26
26
  borderColor: string;
27
27
  };
@@ -5,7 +5,7 @@ type Size = NonNullable<ProgressIndicatorProps["size"]>;
5
5
  * mobile `ProgressBar` sizing.
6
6
  */
7
7
  export declare const sizeHeights: Record<Size, number>;
8
- export declare const sizeStyles: {
8
+ export declare const sizeStyles: Readonly<{
9
9
  smaller: {
10
10
  height: number;
11
11
  };
@@ -15,5 +15,5 @@ export declare const sizeStyles: {
15
15
  base: {
16
16
  height: number;
17
17
  };
18
- };
18
+ }>;
19
19
  export {};
@@ -13,30 +13,30 @@
13
13
  */
14
14
  export declare const useStyles: () => {
15
15
  continuous: {
16
- width: "100%";
16
+ width: string;
17
17
  flexDirection: "row";
18
18
  overflow: "hidden";
19
19
  backgroundColor: string;
20
20
  };
21
21
  fill: {
22
- height: "100%";
22
+ height: string;
23
23
  backgroundColor: string;
24
24
  };
25
25
  pending: {
26
- height: "100%";
26
+ height: string;
27
27
  position: "absolute";
28
28
  left: number;
29
29
  top: number;
30
30
  backgroundColor: string;
31
31
  };
32
32
  stepped: {
33
- width: "100%";
33
+ width: string;
34
34
  flexDirection: "row";
35
35
  gap: number;
36
36
  };
37
37
  segment: {
38
38
  flex: number;
39
- height: "100%";
39
+ height: string;
40
40
  backgroundColor: string;
41
41
  };
42
42
  segmentFilled: {
@@ -1,29 +1,12 @@
1
- export declare const useStyles: () => {
2
- container: import("react-native").ViewStyle;
3
- input: import("react-native").ViewStyle;
4
- value: {
5
- flexGrow: number;
6
- flexShrink: number;
7
- };
8
- icon: {
9
- position: "absolute";
10
- bottom: "50%";
11
- right: number;
12
- flexGrow: number;
13
- flexShrink: number;
14
- };
15
- invalid: {
16
- color: string;
17
- borderColor: string;
18
- };
19
- errorMessageWrapperIcon: {
20
- flex: number;
21
- flexBasis: "auto";
22
- paddingTop: number;
23
- paddingRight: number;
24
- };
25
- messageWrapper: {
26
- paddingTop: number;
27
- flexDirection: "row";
28
- };
29
- };
1
+ import type { TextStyle, ViewStyle } from "react-native";
2
+ interface Styles {
3
+ container: ViewStyle;
4
+ input: ViewStyle;
5
+ value: ViewStyle;
6
+ icon: ViewStyle;
7
+ invalid: TextStyle;
8
+ errorMessageWrapperIcon: ViewStyle;
9
+ messageWrapper: ViewStyle;
10
+ }
11
+ export declare const useStyles: () => Styles;
12
+ export {};
@@ -1,4 +1,4 @@
1
- export declare const styles: {
1
+ export declare const styles: Readonly<{
2
2
  overlay: {
3
3
  flex: number;
4
4
  };
@@ -21,10 +21,10 @@ export declare const styles: {
21
21
  position: "absolute";
22
22
  top: number;
23
23
  left: number;
24
- width: "100%";
25
- height: "100%";
24
+ width: string;
25
+ height: string;
26
26
  color: string;
27
27
  backgroundColor: string;
28
28
  opacity: number;
29
29
  };
30
- };
30
+ }>;
@@ -5,7 +5,7 @@ export declare const useStyles: () => {
5
5
  };
6
6
  row: {
7
7
  flexDirection: "row";
8
- width: "100%";
8
+ width: string;
9
9
  };
10
10
  label: {
11
11
  flex: number;
@@ -1,6 +1,6 @@
1
1
  export declare const useStyles: () => {
2
2
  details: {
3
- width: "100%";
3
+ width: string;
4
4
  flexDirection: "column";
5
5
  };
6
6
  detail: {
@@ -7,7 +7,7 @@ export declare const useStyles: () => {
7
7
  toast: {
8
8
  flexDirection: "row";
9
9
  justifyContent: "space-between";
10
- width: "100%";
10
+ width: string;
11
11
  maxWidth: number;
12
12
  paddingVertical: number;
13
13
  backgroundColor: string;
@@ -11,6 +11,4 @@ export declare const getTypographyStyles: (tokens: AtlantisThemeContextValue["to
11
11
  * @deprecated Use useTypographyStyles instead
12
12
  */
13
13
  export declare const typographyStyles: Record<string, TextStyle>;
14
- export declare const useTypographyStyles: () => {
15
- [index: string]: TextStyle;
16
- };
14
+ export declare const useTypographyStyles: () => ReturnType<typeof getTypographyStyles>;
@@ -0,0 +1,3 @@
1
+ import type { ComponentRef } from "react";
2
+ import type { View } from "react-native";
3
+ export type ViewRef = ComponentRef<typeof View>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jobber/components-native",
3
- "version": "0.116.2-large-chec-aaeb9fd.2+aaeb9fde",
3
+ "version": "0.116.3",
4
4
  "license": "MIT",
5
5
  "description": "React Native implementation of Atlantis",
6
6
  "repository": {
@@ -65,7 +65,7 @@
65
65
  "lodash": "^4.18.1",
66
66
  "react-hook-form": "^7.52.0",
67
67
  "react-intl": "^7.1.11",
68
- "react-native-keyboard-controller": "^1.20.7",
68
+ "react-native-keyboard-controller": "^1.22.5",
69
69
  "react-native-toast-message": "^2.1.6",
70
70
  "react-native-uuid": "^2.0.4",
71
71
  "ts-xor": "^1.1.0"
@@ -94,7 +94,7 @@
94
94
  "react-dom": "19.1.1",
95
95
  "react-native": "^0.82.1",
96
96
  "react-native-gesture-handler": "^2.29.1",
97
- "react-native-keyboard-controller": "^1.12.0",
97
+ "react-native-keyboard-controller": "^1.22.5",
98
98
  "react-native-modal-datetime-picker": "^18.0.0",
99
99
  "react-native-reanimated": "4.2.3",
100
100
  "react-native-safe-area-context": "^5.4.0",
@@ -118,12 +118,12 @@
118
118
  "react-intl": "^6 || ^7",
119
119
  "react-native": ">=0.79.5",
120
120
  "react-native-gesture-handler": ">=2.22.0",
121
- "react-native-keyboard-controller": "^1.20.7",
121
+ "react-native-keyboard-controller": "^1.22.5",
122
122
  "react-native-modal-datetime-picker": " >=13.0.0",
123
123
  "react-native-reanimated": "^4.0.0",
124
124
  "react-native-safe-area-context": "^5.4.0",
125
125
  "react-native-screens": ">=4.18.0",
126
126
  "react-native-svg": ">=12.0.0"
127
127
  },
128
- "gitHead": "aaeb9fdef9e69599b84e28de7ed82ed5ac7f26f7"
128
+ "gitHead": "0655334acf3dab6b70b4ef6bebbd7030d63ec5a4"
129
129
  }
@@ -127,7 +127,11 @@ describe("Checkbox with FormProvider", () => {
127
127
  accessibilityLabel={accessibilityLabel}
128
128
  />
129
129
  <Button
130
- onPress={formMethods.handleSubmit(values => mockOnSubmit(values))}
130
+ onPress={() => {
131
+ void formMethods.handleSubmit(values => {
132
+ mockOnSubmit(values);
133
+ })();
134
+ }}
131
135
  title={saveButtonText}
132
136
  accessibilityLabel={saveButtonText}
133
137
  />
@@ -1,4 +1,9 @@
1
1
  import { memo } from "react";
2
+ import type {
3
+ NamedExoticComponent,
4
+ PropsWithoutRef,
5
+ RefAttributes,
6
+ } from "react";
2
7
  import type { KeyboardAwareScrollViewProps } from "react-native-keyboard-controller";
3
8
  import { KeyboardAwareScrollView } from "react-native-keyboard-controller";
4
9
  import {
@@ -26,7 +31,10 @@ const BottomSheetScrollViewComponent = createBottomSheetScrollableComponent<
26
31
  KeyboardAwareScrollViewProps
27
32
  >(SCROLLABLE_TYPE.SCROLLVIEW, AnimatedScrollView);
28
33
 
29
- const BottomSheetKeyboardAwareScrollView = memo(BottomSheetScrollViewComponent);
34
+ const BottomSheetKeyboardAwareScrollView: NamedExoticComponent<
35
+ PropsWithoutRef<KeyboardAwareScrollViewProps> &
36
+ RefAttributes<BottomSheetScrollViewMethods>
37
+ > = memo(BottomSheetScrollViewComponent);
30
38
 
31
39
  BottomSheetKeyboardAwareScrollView.displayName =
32
40
  "BottomSheetKeyboardAwareScrollView";
@@ -40,6 +40,7 @@ import {
40
40
  AtlantisThemeContextProvider,
41
41
  useAtlantisTheme,
42
42
  } from "../AtlantisThemeContext";
43
+ import type { ViewRef } from "../utils/types";
43
44
 
44
45
  /**
45
46
  * Signals whether keyboard handling inside a ContentOverlay is delegated to
@@ -125,7 +126,7 @@ export function ContentOverlay({
125
126
  const topInset = insets.top || tokens["space-larger"];
126
127
 
127
128
  const [showHeaderShadow, setShowHeaderShadow] = useState<boolean>(false);
128
- const overlayHeader = useRef<View>(null);
129
+ const overlayHeader = useRef<ViewRef>(null);
129
130
  const scrollViewRef = useRef<
130
131
  BottomSheetScrollViewMethods & { scrollTop?: number }
131
132
  >(null);
@@ -1,5 +1,5 @@
1
1
  import { act, renderHook } from "@testing-library/react-native";
2
- import type { LayoutChangeEvent, NativeMethods } from "react-native";
2
+ import type { LayoutChangeEvent } from "react-native";
3
3
  import { useViewLayoutHeight } from "./useViewLayoutHeight";
4
4
 
5
5
  describe("useViewLayoutHeight", () => {
@@ -11,7 +11,7 @@ describe("useViewLayoutHeight", () => {
11
11
  });
12
12
  it("should handle layout change event", async () => {
13
13
  const expectedHeight = 100;
14
- const layoutChangeEvent: LayoutChangeEvent = {
14
+ const layoutChangeEvent = {
15
15
  nativeEvent: {
16
16
  layout: {
17
17
  height: expectedHeight,
@@ -20,31 +20,7 @@ describe("useViewLayoutHeight", () => {
20
20
  y: 0,
21
21
  },
22
22
  },
23
- currentTarget: 0 as unknown as NativeMethods,
24
- target: 0 as unknown as NativeMethods,
25
- bubbles: false,
26
- cancelable: false,
27
- defaultPrevented: false,
28
- eventPhase: 0,
29
- isTrusted: false,
30
- preventDefault: function (): void {
31
- throw new Error("Function not implemented.");
32
- },
33
- isDefaultPrevented: function (): boolean {
34
- throw new Error("Function not implemented.");
35
- },
36
- stopPropagation: function (): void {
37
- throw new Error("Function not implemented.");
38
- },
39
- isPropagationStopped: function (): boolean {
40
- throw new Error("Function not implemented.");
41
- },
42
- persist: function (): void {
43
- throw new Error("Function not implemented.");
44
- },
45
- timeStamp: 0,
46
- type: "",
47
- };
23
+ } as LayoutChangeEvent;
48
24
  const { result } = renderHook(() => useViewLayoutHeight());
49
25
  await act(async () => {
50
26
  result.current.handleLayout(layoutChangeEvent);
@@ -7,6 +7,7 @@ import { useErrorMessageContext } from "./context";
7
7
  import { useStyles } from "./ErrorMessageWrapper.style";
8
8
  import { Icon } from "../Icon";
9
9
  import { Text } from "../Text";
10
+ import type { ViewRef } from "../utils/types";
10
11
 
11
12
  type WrapForTypes = "card" | "default";
12
13
 
@@ -38,7 +39,7 @@ export function ErrorMessageWrapper({
38
39
  const errorMessageContext = useErrorMessageContext();
39
40
  const register = errorMessageContext?.register;
40
41
  const unregister = errorMessageContext?.unregister;
41
- const a11yMessageRef = useRef<View>(null);
42
+ const a11yMessageRef = useRef<ViewRef>(null);
42
43
  const { current: id } = useRef(uuid.v4());
43
44
 
44
45
  const hasErrorMessage = Boolean(message);
@@ -1,6 +1,6 @@
1
1
  import type { ReactNode, RefObject } from "react";
2
2
  import React, { useState } from "react";
3
- import type { NativeMethods, View } from "react-native";
3
+ import type { NativeMethods } from "react-native";
4
4
  import { AccessibilityInfo, findNodeHandle } from "react-native";
5
5
  import { ErrorMessageContext } from "./ErrorMessageContext";
6
6
  import type {
@@ -8,6 +8,7 @@ import type {
8
8
  ErrorMessageContextProps,
9
9
  ErrorMessageContextRegisterParams,
10
10
  } from "./types";
11
+ import type { ViewRef } from "../../utils/types";
11
12
 
12
13
  interface ErrorMessageProviderProps {
13
14
  readonly children: ReactNode;
@@ -49,13 +50,13 @@ export function ErrorMessageProvider({ children }: ErrorMessageProviderProps) {
49
50
  }
50
51
  }
51
52
 
52
- function getMeasure(ref: RefObject<View | null>) {
53
+ function getMeasure(ref: RefObject<ViewRef | null>) {
53
54
  return function measure(...args: Parameters<NativeMethods["measureLayout"]>) {
54
55
  ref.current?.measureLayout(...args);
55
56
  };
56
57
  }
57
58
 
58
- function getAccessibilityFocus(ref: RefObject<View | null>) {
59
+ function getAccessibilityFocus(ref: RefObject<ViewRef | null>) {
59
60
  return function accessibilityFocus() {
60
61
  const reactTag = findNodeHandle(ref.current);
61
62
  reactTag &&
@@ -1,5 +1,6 @@
1
1
  import type { RefObject } from "react";
2
- import type { NativeMethods, View } from "react-native";
2
+ import type { NativeMethods } from "react-native";
3
+ import type { ViewRef } from "../../utils/types";
3
4
 
4
5
  interface Methods {
5
6
  /**
@@ -50,7 +51,7 @@ type ElementID = Element["id"];
50
51
  export interface ErrorMessageContextRegisterParams {
51
52
  readonly id: ElementID;
52
53
  readonly hasErrorMessage: Methods["hasErrorMessage"];
53
- readonly ref: RefObject<View | null>;
54
+ readonly ref: RefObject<ViewRef | null>;
54
55
  }
55
56
 
56
57
  export interface ErrorMessageContextProps {
@@ -20,7 +20,7 @@ export const columnStyles: Record<ColumnKeys, ViewStyle> = StyleSheet.create({
20
20
  },
21
21
  });
22
22
 
23
- export const gapStyles = StyleSheet.create(
23
+ export const gapStyles: Record<Spacing, ViewStyle> = StyleSheet.create(
24
24
  spacing.reduce((gapObj, space) => {
25
25
  let paddingLeft = 0;
26
26
  if (space !== "none") paddingLeft = staticTokens[`space-${space}`];
package/src/Form/Form.tsx CHANGED
@@ -122,7 +122,7 @@ function InternalForm<T extends FieldValues, S>({
122
122
 
123
123
  useScrollToError({
124
124
  formState: formMethods.formState,
125
- refNode: findNodeHandle(scrollViewRef.current),
125
+ refNode: findNodeHandle(scrollViewRef.current) ?? null,
126
126
  setFocus: formMethods.setFocus,
127
127
  scrollTo: scrollViewRef.current?.scrollTo,
128
128
  });
@@ -1,5 +1,5 @@
1
1
  import React, { type ReactElement } from "react";
2
- import type { LayoutChangeEvent } from "react-native";
2
+ import type { LayoutChangeEvent, StyleProp, ViewStyle } from "react-native";
3
3
  import { StyleSheet } from "react-native";
4
4
  import Reanimated from "react-native-reanimated";
5
5
  import { useStyles } from "./FormActionBar.style";
@@ -35,7 +35,7 @@ export function FormActionBar({
35
35
  }: FormActionBarProps) {
36
36
  const styles = useStyles();
37
37
 
38
- const buttonStyle = StyleSheet.flatten([
38
+ const buttonStyle: StyleProp<ViewStyle> = StyleSheet.flatten([
39
39
  styles.saveButton,
40
40
  {
41
41
  position:
@@ -1,17 +1,17 @@
1
1
  import type { RefObject } from "react";
2
2
  import { useCallback, useRef } from "react";
3
- import type { View } from "react-native";
4
3
  import type { KeyboardAwareScrollViewRef } from "react-native-keyboard-controller";
4
+ import type { ViewRef } from "../../utils/types";
5
5
 
6
6
  interface UseFormViewRefsReturn {
7
7
  readonly scrollViewRef: RefObject<KeyboardAwareScrollViewRef | null>;
8
- readonly bottomViewRef: RefObject<View | null>;
8
+ readonly bottomViewRef: RefObject<ViewRef | null>;
9
9
  readonly scrollToTop: () => void;
10
10
  }
11
11
 
12
12
  export function useFormViewRefs(): UseFormViewRefsReturn {
13
13
  const scrollViewRef = useRef<KeyboardAwareScrollViewRef>(null);
14
- const bottomViewRef = useRef<View>(null);
14
+ const bottomViewRef = useRef<ViewRef>(null);
15
15
  const scrollToTop = useCallback(() => {
16
16
  scrollViewRef.current?.scrollTo({ x: 0, y: 0, animated: true });
17
17
  }, [scrollViewRef]);
@@ -21,7 +21,11 @@ describe("when a component is wrapped in a FormField within a Form", () => {
21
21
  <FormProvider {...formMethods}>
22
22
  {children}
23
23
  <Button
24
- onPress={formMethods.handleSubmit(values => mockOnSubmit(values))}
24
+ onPress={() => {
25
+ void formMethods.handleSubmit(values => {
26
+ mockOnSubmit(values);
27
+ })();
28
+ }}
25
29
  title={saveButtonText}
26
30
  accessibilityLabel={saveButtonText}
27
31
  />
@@ -50,16 +50,17 @@ export const createCommonInputTokens = (
50
50
  /**
51
51
  * @deprecated Use useCommonInputStyles instead
52
52
  */
53
- export const commonInputStyles = StyleSheet.create(
54
- createCommonInputTokens(staticTokens),
55
- );
53
+ export const commonInputStyles: ReturnType<typeof createCommonInputTokens> =
54
+ StyleSheet.create(createCommonInputTokens(staticTokens));
56
55
 
57
56
  export const getCommonInputStyles = (
58
57
  tokens: AtlantisThemeContextValue["tokens"],
59
- ) => {
58
+ ): ReturnType<typeof createCommonInputTokens> => {
60
59
  return createCommonInputTokens(tokens);
61
60
  };
62
61
 
63
- export const useCommonInputStyles = buildThemedStyles(tokens => {
62
+ export const useCommonInputStyles: () => ReturnType<
63
+ typeof getCommonInputStyles
64
+ > = buildThemedStyles(tokens => {
64
65
  return getCommonInputStyles(tokens);
65
66
  });
@@ -1,19 +1,43 @@
1
- import { StyleSheet } from "react-native";
1
+ import type { ViewStyle } from "react-native";
2
2
  import { getCommonInputStyles } from "./CommonInputStyles.style";
3
3
  import { buildThemedStyles } from "../AtlantisThemeContext";
4
4
  import { getTypographyStyles } from "../Typography";
5
5
 
6
- export const useStyles = buildThemedStyles(tokens => {
6
+ type Styles = Record<
7
+ | "container"
8
+ | "field"
9
+ | "inputContainer"
10
+ | "inputFocused"
11
+ | "inputInvalid"
12
+ | "label"
13
+ | "miniLabel"
14
+ | "miniLabelShowClearAction"
15
+ | "disabled"
16
+ | "fieldAffix"
17
+ | "fieldAffixMiniLabel"
18
+ | "prefixIcon"
19
+ | "prefixLabel"
20
+ | "suffixIcon"
21
+ | "suffixLabel"
22
+ | "suffixIconMargin"
23
+ | "suffixLabelMargin"
24
+ | "inputEndContainer"
25
+ | "toolbar"
26
+ | "loadingSpinner"
27
+ | "loadingGlimmers"
28
+ | "loadingGlimmersHasValue",
29
+ ViewStyle
30
+ >;
31
+
32
+ export const useStyles: () => Styles = buildThemedStyles(tokens => {
7
33
  const commonInputStyles = getCommonInputStyles(tokens);
8
34
  const typographyStyles = getTypographyStyles(tokens);
9
35
 
10
36
  return {
11
- container: StyleSheet.flatten([
12
- commonInputStyles.container,
13
- {
14
- flexDirection: "column",
15
- },
16
- ]),
37
+ container: {
38
+ ...commonInputStyles.container,
39
+ flexDirection: "column",
40
+ },
17
41
 
18
42
  field: {
19
43
  flexDirection: "row",
@@ -1,7 +1,17 @@
1
+ import type { TextStyle, ViewStyle } from "react-native";
1
2
  import { buildThemedStyles } from "../AtlantisThemeContext";
2
3
  import { getTypographyStyles } from "../Typography";
3
4
 
4
- export const useStyles = buildThemedStyles(tokens => {
5
+ interface Styles {
6
+ pressable: ViewStyle;
7
+ inputPressableStyles: TextStyle;
8
+ inputEmpty: TextStyle;
9
+ inputDisabled: TextStyle;
10
+ inputInvalid: ViewStyle;
11
+ withoutMiniLabel: TextStyle;
12
+ }
13
+
14
+ export const useStyles: () => Styles = buildThemedStyles(tokens => {
5
15
  const typographyStyles = getTypographyStyles(tokens);
6
16
 
7
17
  return {
@@ -1,4 +1,4 @@
1
- import type { Ref } from "react";
1
+ import type { ComponentRef, Ref } from "react";
2
2
  import React, { forwardRef } from "react";
3
3
  import type { IconNames } from "@jobber/design";
4
4
  import type { FieldError } from "react-hook-form";
@@ -105,8 +105,10 @@ export interface InputPressableProps {
105
105
  readonly onClear?: () => void;
106
106
  }
107
107
 
108
- export type InputPressableRef = NativeText;
109
- export const InputPressable = forwardRef(InputPressableInternal);
108
+ export type InputPressableRef = ComponentRef<typeof NativeText>;
109
+ export const InputPressable: React.ForwardRefExoticComponent<
110
+ InputPressableProps & React.RefAttributes<InputPressableRef>
111
+ > = forwardRef<InputPressableRef, InputPressableProps>(InputPressableInternal);
110
112
 
111
113
  export function InputPressableInternal(
112
114
  {
@@ -646,7 +646,11 @@ describe("InputText", () => {
646
646
  accessibilityLabel={inputAccessibilityLabel}
647
647
  />
648
648
  <Button
649
- onPress={formMethods.handleSubmit(values => mockOnSubmit(values))}
649
+ onPress={() => {
650
+ void formMethods.handleSubmit(values => {
651
+ mockOnSubmit(values);
652
+ })();
653
+ }}
650
654
  title={saveButtonText}
651
655
  accessibilityLabel={saveButtonText}
652
656
  />