@jobber/components-native 0.63.0 → 0.65.0

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jobber/components-native",
3
- "version": "0.63.0",
3
+ "version": "0.65.0",
4
4
  "license": "MIT",
5
5
  "description": "React Native implementation of Atlantis",
6
6
  "repository": {
@@ -36,7 +36,7 @@
36
36
  "build:clean": "rm -rf ./dist"
37
37
  },
38
38
  "dependencies": {
39
- "@jobber/design": "^0.56.4",
39
+ "@jobber/design": "^0.57.0",
40
40
  "@jobber/hooks": "^2.9.4",
41
41
  "@react-native-clipboard/clipboard": "^1.11.2",
42
42
  "@react-native-picker/picker": "^2.4.10",
@@ -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": "15034baa004c4a11f17338b96d6f2678f3183d56"
87
+ "gitHead": "3eb2d707a233210b3d0612acf0baf25e7291cb53"
88
88
  }
@@ -28,7 +28,7 @@ function getActionIconColour(actionIconColour) {
28
28
  }
29
29
  function getActionIcon(icon) {
30
30
  if (icon === "edit") {
31
- return "arrowRight";
31
+ return "longArrowRight";
32
32
  }
33
33
  else if (icon === "editpencil") {
34
34
  return "edit";
@@ -1,5 +1,5 @@
1
1
  import React, { useCallback, useRef, useState } from "react";
2
- import { Pressable, View, useWindowDimensions, } from "react-native";
2
+ import { Keyboard, Platform, Pressable, View, useWindowDimensions, } from "react-native";
3
3
  import { Portal } from "react-native-portalize";
4
4
  import { useSafeAreaFrame } from "react-native-safe-area-context";
5
5
  import { styles } from "./Menu.style";
@@ -23,7 +23,7 @@ export function Menu({ menuOptions, customActivator }) {
23
23
  setMenuPosition(findViewpoint(screenInfo, activatorLayout.current));
24
24
  }
25
25
  }, [screenInfo, activatorLayout]);
26
- const activatorOnPress = (onPress) => {
26
+ const openMenu = () => {
27
27
  var _a;
28
28
  (_a = menuButtonRef.current) === null || _a === void 0 ? void 0 : _a.measureInWindow((x, y, width, height) => {
29
29
  activatorLayout.current = {
@@ -34,9 +34,20 @@ export function Menu({ menuOptions, customActivator }) {
34
34
  };
35
35
  findMenuLayout();
36
36
  setOpen(true);
37
- onPress && onPress();
38
37
  });
39
38
  };
39
+ const activatorOnPress = (onPress) => {
40
+ onPress && onPress();
41
+ if (Platform.OS === "ios" && Keyboard.isVisible()) {
42
+ // On iOS, the keyboard height causes problems with the menu positioning logic.
43
+ // Wait until the keyboard is fully hidden before we show the menu.
44
+ onKeyboardDidHide(openMenu);
45
+ Keyboard.dismiss();
46
+ }
47
+ else {
48
+ openMenu();
49
+ }
50
+ };
40
51
  return (React.createElement(React.Fragment, null,
41
52
  React.createElement(View, { ref: ref => {
42
53
  menuButtonRef.current = ref;
@@ -64,3 +75,9 @@ function useScreenInformation() {
64
75
  const { height: windowHeight } = useSafeAreaFrame();
65
76
  return { headerHeight, windowWidth, windowHeight };
66
77
  }
78
+ function onKeyboardDidHide(callback) {
79
+ const listener = Keyboard.addListener("keyboardDidHide", () => {
80
+ listener.remove();
81
+ callback();
82
+ });
83
+ }
@@ -2,5 +2,5 @@ import { StyleSheet } from "react-native";
2
2
  import { tokens } from "../utils/design";
3
3
  const menuWidth = 208;
4
4
  export const styles = StyleSheet.create({
5
- menu: Object.assign({ position: "absolute", backgroundColor: tokens["color-surface"], paddingHorizontal: tokens["space-small"], paddingVertical: tokens["space-small"] + tokens["space-smallest"], borderRadius: tokens["radius-larger"], width: menuWidth }, tokens["shadow-high"]),
5
+ menu: Object.assign({ position: "absolute", backgroundColor: tokens["color-surface"], paddingHorizontal: tokens["space-small"], paddingVertical: tokens["space-small"] + tokens["space-smallest"], borderRadius: tokens["radius-base"], width: menuWidth }, tokens["shadow-high"]),
6
6
  });
@@ -59,12 +59,7 @@ function getLeftPosition(pos, activatorLayout, windowWidth, menuHorizontalPaddin
59
59
  pos.right = 0;
60
60
  }
61
61
  else {
62
- pos.right =
63
- windowWidth -
64
- activatorLayout.x -
65
- activatorLayout.width +
66
- activatorLayout.width / 2 -
67
- menuHorizontalPadding;
62
+ pos.right = windowWidth - activatorLayout.x - activatorLayout.width;
68
63
  }
69
64
  }
70
65
  function getRightPosition(pos, activatorLayout, windowWidth, menuPadding, menuWidth) {
@@ -79,6 +74,6 @@ function getRightPosition(pos, activatorLayout, windowWidth, menuPadding, menuWi
79
74
  pos.left = 0;
80
75
  }
81
76
  else {
82
- pos.left = activatorLayout.x + activatorLayout.width / 2 - menuPadding;
77
+ pos.left = activatorLayout.x;
83
78
  }
84
79
  }