@jobber/components-native 0.43.17 → 0.43.18

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/README.md CHANGED
@@ -46,6 +46,46 @@ transformIgnorePatterns: [
46
46
  ],
47
47
  ```
48
48
 
49
+ Also update the Jest config as to include the `jestSetup.js`
50
+
51
+ ```json
52
+ setupFiles: [
53
+ ...
54
+ "./node_modules/@jobber/components-native/jestSetup.js",
55
+ ...
56
+ ],
57
+ ```
58
+
59
+ You will also need to create a mock for the Form component
60
+
61
+ ```jsx
62
+ jest.mock("./dist/src/Form", () => {
63
+ const { Form, AtlantisFormContext, ...Actual } =
64
+ jest.requireActual("./dist/src/Form");
65
+ const useConfirmBeforeBack = jest.fn(() => jest.fn());
66
+ const useInternalFormLocalCache = jest.fn(() => ({
67
+ setLocalCache: jest.fn(),
68
+ removeLocalCache: jest.fn(),
69
+ }));
70
+ // Or
71
+ const useConfirmBeforeBack = require("<path-to-your>/useConfirmBeforeBackHook");
72
+ const useInternalFormLocalCache = require("<path-to-your>/useInternalFormLocalCacheHook");
73
+ return {
74
+ ...Actual,
75
+ AtlantisFormContext: AtlantisFormContext,
76
+ Form: ({ children, ...props }) => {
77
+ return (
78
+ <AtlantisFormContext.Provider
79
+ value={{ useConfirmBeforeBack, useInternalFormLocalCache }}
80
+ >
81
+ <Form {...props}>{children}</Form>
82
+ </AtlantisFormContext.Provider>
83
+ );
84
+ },
85
+ };
86
+ });
87
+ ```
88
+
49
89
  ## Further Reading
50
90
 
51
91
  More information on Atlantis can be found at
@@ -1,9 +1,9 @@
1
1
  import React from "react";
2
- import { StyleSheet, View } from "react-native";
2
+ import { StyleSheet } from "react-native";
3
3
  import Reanimated from "react-native-reanimated";
4
4
  import { styles } from "./FormActionBar.style";
5
5
  import { FormSaveButton } from "../FormSaveButton";
6
- const ReanimatedView = Reanimated.createAnimatedComponent(View);
6
+ const ReanimatedView = Reanimated.View;
7
7
  export function FormActionBar({ keyboardHeight, submit, isFormSubmitting, saveButtonLabel, renderStickySection, setSaveButtonHeight, secondaryActions, setSecondaryActionLoading, }) {
8
8
  const buttonStyle = StyleSheet.flatten([
9
9
  styles.saveButton,
@@ -1,6 +1,6 @@
1
1
  import { useCallback, useState } from "react";
2
2
  import { Keyboard, Platform, } from "react-native";
3
- import { useIsScreenReaderEnabled } from "../../../hooks/useIsScreenReaderEnabled";
3
+ import { useIsScreenReaderEnabled } from "../../../hooks";
4
4
  import { useErrorMessageContext } from "../../../ErrorMessageWrapper";
5
5
  export function useScrollToError({ formState: { errors, isValid, submitCount }, refNode, setFocus, scrollToPosition, }) {
6
6
  const [submitCounter, setSubmitCounter] = useState(submitCount);