@jobber/components-native 0.67.3 → 0.67.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jobber/components-native",
3
- "version": "0.67.3",
3
+ "version": "0.67.4",
4
4
  "license": "MIT",
5
5
  "description": "React Native implementation of Atlantis",
6
6
  "repository": {
@@ -84,5 +84,5 @@
84
84
  "react-native-safe-area-context": "^4.5.2",
85
85
  "react-native-svg": ">=12.0.0"
86
86
  },
87
- "gitHead": "d589b2ab8c2f8e23a879f1fd3db475f035721749"
87
+ "gitHead": "e1c7ea3e923799f684c8cccf4e9f6f245cdf2497"
88
88
  }
@@ -2,10 +2,13 @@ import React from "react";
2
2
  import { fireEvent, render, waitFor } from "@testing-library/react-native";
3
3
  import { Host } from "react-native-portalize";
4
4
  import { FormProvider, useForm } from "react-hook-form";
5
+ import { Keyboard } from "react-native";
5
6
  import { InputDate } from "./InputDate";
6
7
  import { Button } from "../Button";
7
8
  import * as atlantisContext from "../AtlantisContext/AtlantisContext";
8
9
 
10
+ const keyboardDismissSpy = jest.spyOn(Keyboard, "dismiss");
11
+
9
12
  describe("InputDate", () => {
10
13
  describe("Visuals", () => {
11
14
  const placeholder = "Start time";
@@ -134,6 +137,11 @@ describe("InputDate", () => {
134
137
  fireEvent.press(screen.getByLabelText("Confirm"));
135
138
  expect(handleChange).toHaveBeenCalledWith(expect.any(Date));
136
139
  });
140
+
141
+ it("should dismiss the keyboard when the date picker is opened", () => {
142
+ renderDatePicker();
143
+ expect(keyboardDismissSpy).toHaveBeenCalled();
144
+ });
137
145
  });
138
146
  const mockOnSubmit = jest.fn();
139
147
  const saveButtonText = "Submit";
@@ -1,6 +1,6 @@
1
1
  import React, { useMemo, useState } from "react";
2
2
  import DateTimePicker from "react-native-modal-datetime-picker";
3
- import { Platform } from "react-native";
3
+ import { Keyboard, Platform } from "react-native";
4
4
  import { FieldError, UseControllerProps } from "react-hook-form";
5
5
  import { XOR } from "ts-xor";
6
6
  import { Clearable } from "@jobber/hooks";
@@ -204,6 +204,7 @@ function InternalInputDate({
204
204
  );
205
205
 
206
206
  function showDatePicker() {
207
+ Keyboard.dismiss();
207
208
  setShowPicker(true);
208
209
  }
209
210
 
@@ -2,10 +2,12 @@ import React from "react";
2
2
  import { fireEvent, render, waitFor } from "@testing-library/react-native";
3
3
  import { Host } from "react-native-portalize";
4
4
  import { FormProvider, useForm } from "react-hook-form";
5
+ import { Keyboard } from "react-native";
5
6
  import { InputTime } from "./InputTime";
6
7
  import * as atlantisContext from "../AtlantisContext/AtlantisContext";
7
8
  import { Button } from "../Button";
8
9
 
10
+ const keyboardDismissSpy = jest.spyOn(Keyboard, "dismiss");
9
11
  afterEach(() => {
10
12
  jest.spyOn(atlantisContext, "useAtlantisContext").mockRestore();
11
13
  });
@@ -102,6 +104,7 @@ describe("With emptyValueLabel", () => {
102
104
  });
103
105
  });
104
106
 
107
+ // eslint-disable-next-line max-statements
105
108
  describe("Time picker", () => {
106
109
  const placeholder = "Tap me";
107
110
  const handleChange = jest.fn();
@@ -143,6 +146,11 @@ describe("Time picker", () => {
143
146
  expect(handleChange).toHaveBeenCalledWith(expect.any(Date));
144
147
  });
145
148
 
149
+ it("should dismiss the keyboard when the time picker is opened", () => {
150
+ renderTimePicker();
151
+ expect(keyboardDismissSpy).toHaveBeenCalled();
152
+ });
153
+
146
154
  it("should be a time picker", () => {
147
155
  const screen = renderTimePicker();
148
156
  expect(screen.getByTestId("inputTime-Picker").props.mode).toBe("time");
@@ -2,7 +2,7 @@ import React, { useMemo, useState } from "react";
2
2
  import { FieldError, UseControllerProps } from "react-hook-form";
3
3
  import { XOR } from "ts-xor";
4
4
  import DateTimePicker from "react-native-modal-datetime-picker";
5
- import { View } from "react-native";
5
+ import { Keyboard, View } from "react-native";
6
6
  import { Clearable } from "@jobber/hooks";
7
7
  import { styles } from "./InputTime.style";
8
8
  import { getTimeZoneOffsetInMinutes, roundUpToNearestMinutes } from "./utils";
@@ -182,6 +182,7 @@ function InternalInputTime({
182
182
  );
183
183
 
184
184
  function showDatePicker() {
185
+ Keyboard.dismiss();
185
186
  setShowPicker(true);
186
187
  }
187
188