@jobber/components-native 0.85.1-move-dupli-99be0f8.13 → 0.86.1-JOB-136074-c379982.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 +16 -2
- package/dist/src/Banner/Banner.js +2 -0
- package/dist/src/Banner/components/BannerIcon/BannerIcon.style.js +3 -0
- package/dist/src/Form/Form.js +4 -1
- package/dist/src/InputFieldWrapper/InputFieldWrapper.style.js +1 -1
- package/dist/src/utils/buildConfig/isEdgeToEdgeEnabled.js +18 -0
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/dist/types/src/Banner/components/BannerIcon/BannerIcon.style.d.ts +3 -0
- package/dist/types/src/Banner/types.d.ts +1 -1
- package/dist/types/src/InputFieldWrapper/InputFieldWrapper.style.d.ts +1 -1
- package/dist/types/src/utils/buildConfig/isEdgeToEdgeEnabled.d.ts +1 -0
- package/package.json +16 -2
- package/src/Banner/Banner.test.tsx +12 -0
- package/src/Banner/Banner.tsx +2 -0
- package/src/Banner/components/BannerIcon/BannerIcon.style.ts +3 -0
- package/src/Banner/types.ts +1 -1
- package/src/Form/Form.tsx +6 -0
- package/src/InputFieldWrapper/InputFieldWrapper.style.ts +1 -1
- package/src/types/buildConfig.d.ts +7 -0
- package/src/utils/buildConfig/isEdgeToEdgeEnabled.ts +21 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { IconNames } from "@jobber/design";
|
|
2
2
|
import type { ReactElement } from "react";
|
|
3
3
|
import type { StyleProp, ViewStyle } from "react-native";
|
|
4
|
-
export type BannerTypes = "error" | "warning" | "notice";
|
|
4
|
+
export type BannerTypes = "error" | "warning" | "notice" | "success";
|
|
5
5
|
export interface BannerStyleProps {
|
|
6
6
|
/**
|
|
7
7
|
* Styles applied to the main view of the banner. Styles are grabbed from Banner.style.ts file
|
|
@@ -23,6 +23,7 @@ export declare const useStyles: () => {
|
|
|
23
23
|
right: number;
|
|
24
24
|
bottom: number;
|
|
25
25
|
left: number;
|
|
26
|
+
zIndex: number;
|
|
26
27
|
};
|
|
27
28
|
miniLabel: {
|
|
28
29
|
top: number;
|
|
@@ -30,7 +31,6 @@ export declare const useStyles: () => {
|
|
|
30
31
|
backgroundColor: string;
|
|
31
32
|
marginRight: number;
|
|
32
33
|
maxHeight: number;
|
|
33
|
-
zIndex: number;
|
|
34
34
|
};
|
|
35
35
|
miniLabelShowClearAction: {
|
|
36
36
|
backgroundColor: string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function isEdgeToEdgeEnabled(): boolean;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jobber/components-native",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.86.1-JOB-136074-c379982.0+c379982e9",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "React Native implementation of Atlantis",
|
|
6
6
|
"repository": {
|
|
@@ -53,6 +53,7 @@
|
|
|
53
53
|
"ts-xor": "^1.1.0"
|
|
54
54
|
},
|
|
55
55
|
"devDependencies": {
|
|
56
|
+
"@react-native-community/datetimepicker": "^7.1.0",
|
|
56
57
|
"@storybook/addon-a11y": "^9.1.2",
|
|
57
58
|
"@storybook/react": "^9.1.2",
|
|
58
59
|
"@storybook/react-native-web-vite": "^9.1.2",
|
|
@@ -66,6 +67,13 @@
|
|
|
66
67
|
"date-fns": "^2.30.0",
|
|
67
68
|
"date-fns-tz": "^2.0.0",
|
|
68
69
|
"metro-react-native-babel-preset": "^0.76.0",
|
|
70
|
+
"react-native": "^0.77.0",
|
|
71
|
+
"react-native-gesture-handler": "^2.10.2",
|
|
72
|
+
"react-native-modal-datetime-picker": "^15.0.1",
|
|
73
|
+
"react-native-reanimated": "^3.7.1",
|
|
74
|
+
"react-native-safe-area-context": "^5.4.0",
|
|
75
|
+
"react-native-svg": "^15.1.0",
|
|
76
|
+
"react-native-web": "^0.20.0",
|
|
69
77
|
"react-test-renderer": "^18.2.0",
|
|
70
78
|
"storybook": "^9.1.2"
|
|
71
79
|
},
|
|
@@ -78,6 +86,7 @@
|
|
|
78
86
|
"react": "^18.2.0",
|
|
79
87
|
"react-intl": "^6.4.2",
|
|
80
88
|
"react-native": ">=0.76.0",
|
|
89
|
+
"react-native-build-config": "^0.3.2",
|
|
81
90
|
"react-native-gesture-handler": ">=2.10.0",
|
|
82
91
|
"react-native-keyboard-aware-scroll-view": "^0.9.5",
|
|
83
92
|
"react-native-modal-datetime-picker": " >=13.0.0",
|
|
@@ -87,5 +96,10 @@
|
|
|
87
96
|
"react-native-safe-area-context": "^5.4.0",
|
|
88
97
|
"react-native-svg": ">=12.0.0"
|
|
89
98
|
},
|
|
90
|
-
"
|
|
99
|
+
"peerDependenciesMeta": {
|
|
100
|
+
"react-native-build-config": {
|
|
101
|
+
"optional": true
|
|
102
|
+
}
|
|
103
|
+
},
|
|
104
|
+
"gitHead": "c379982e9d83ceef1ec4ffa08f53ce98ed914d8c"
|
|
91
105
|
}
|
|
@@ -35,6 +35,18 @@ describe("Banner", () => {
|
|
|
35
35
|
expect(getByText("Notice me")).toBeDefined();
|
|
36
36
|
expect(icon.props.children.props.name).toBe("starburst");
|
|
37
37
|
});
|
|
38
|
+
|
|
39
|
+
it("renders a success Banner", () => {
|
|
40
|
+
const { getByText, getByTestId } = render(
|
|
41
|
+
<Banner type="success">
|
|
42
|
+
<Text>Your import is complete</Text>
|
|
43
|
+
</Banner>,
|
|
44
|
+
);
|
|
45
|
+
|
|
46
|
+
const icon = getByTestId("ATL-Banner-Icon");
|
|
47
|
+
expect(getByText("Your import is complete")).toBeDefined();
|
|
48
|
+
expect(icon.props.children.props.name).toBe("checkmark");
|
|
49
|
+
});
|
|
38
50
|
});
|
|
39
51
|
|
|
40
52
|
describe("Children", () => {
|
package/src/Banner/Banner.tsx
CHANGED
package/src/Banner/types.ts
CHANGED
|
@@ -2,7 +2,7 @@ import type { IconNames } from "@jobber/design";
|
|
|
2
2
|
import type { ReactElement } from "react";
|
|
3
3
|
import type { StyleProp, ViewStyle } from "react-native";
|
|
4
4
|
|
|
5
|
-
export type BannerTypes = "error" | "warning" | "notice";
|
|
5
|
+
export type BannerTypes = "error" | "warning" | "notice" | "success";
|
|
6
6
|
|
|
7
7
|
export interface BannerStyleProps {
|
|
8
8
|
/**
|
package/src/Form/Form.tsx
CHANGED
|
@@ -26,6 +26,7 @@ import { useScrollToError } from "./hooks/useScrollToError";
|
|
|
26
26
|
import { FormSaveButton } from "./components/FormSaveButton";
|
|
27
27
|
import { useSaveButtonPosition } from "./hooks/useSaveButtonPosition";
|
|
28
28
|
import { FormCache } from "./components/FormCache/FormCache";
|
|
29
|
+
import { isEdgeToEdgeEnabled } from "../utils/buildConfig/isEdgeToEdgeEnabled";
|
|
29
30
|
import { InputAccessoriesProvider } from "../InputText";
|
|
30
31
|
import { tokens } from "../utils/design";
|
|
31
32
|
import { ErrorMessageProvider } from "../ErrorMessageWrapper";
|
|
@@ -134,6 +135,9 @@ function InternalForm<T extends FieldValues, S>({
|
|
|
134
135
|
|
|
135
136
|
const styles = useStyles();
|
|
136
137
|
|
|
138
|
+
// Check if edge-to-edge is enabled using utility function
|
|
139
|
+
const edgeToEdgeEnabled = isEdgeToEdgeEnabled();
|
|
140
|
+
|
|
137
141
|
return (
|
|
138
142
|
<FormProvider {...formMethods}>
|
|
139
143
|
<>
|
|
@@ -161,6 +165,7 @@ function InternalForm<T extends FieldValues, S>({
|
|
|
161
165
|
<KeyboardAwareScrollView
|
|
162
166
|
enableResetScrollToCoords={false}
|
|
163
167
|
enableAutomaticScroll={true}
|
|
168
|
+
enableOnAndroid={edgeToEdgeEnabled}
|
|
164
169
|
keyboardOpeningTime={
|
|
165
170
|
Platform.OS === "ios" ? tokens["timing-slowest"] : 0
|
|
166
171
|
}
|
|
@@ -168,6 +173,7 @@ function InternalForm<T extends FieldValues, S>({
|
|
|
168
173
|
ref={scrollViewRef}
|
|
169
174
|
{...keyboardProps}
|
|
170
175
|
extraHeight={headerHeight}
|
|
176
|
+
extraScrollHeight={edgeToEdgeEnabled ? 20 : 0}
|
|
171
177
|
contentContainerStyle={
|
|
172
178
|
!keyboardHeight && styles.scrollContentContainer
|
|
173
179
|
}
|
|
@@ -43,6 +43,7 @@ export const useStyles = buildThemedStyles(tokens => {
|
|
|
43
43
|
right: 0,
|
|
44
44
|
bottom: 0,
|
|
45
45
|
left: 0,
|
|
46
|
+
zIndex: 1,
|
|
46
47
|
},
|
|
47
48
|
|
|
48
49
|
miniLabel: {
|
|
@@ -53,7 +54,6 @@ export const useStyles = buildThemedStyles(tokens => {
|
|
|
53
54
|
maxHeight:
|
|
54
55
|
(typographyStyles.defaultSize.lineHeight || 0) +
|
|
55
56
|
tokens["space-smaller"],
|
|
56
|
-
zIndex: 1,
|
|
57
57
|
},
|
|
58
58
|
// Prevents the miniLabel from cutting off the ClearAction button
|
|
59
59
|
miniLabelShowClearAction: {
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { Platform } from "react-native";
|
|
2
|
+
|
|
3
|
+
type BuildCfg = { IS_EDGE_TO_EDGE_ENABLED?: boolean } | undefined | null;
|
|
4
|
+
|
|
5
|
+
function loadBuildConfig(): BuildCfg {
|
|
6
|
+
try {
|
|
7
|
+
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
8
|
+
const mod = require("react-native-build-config");
|
|
9
|
+
|
|
10
|
+
return (mod?.default ?? mod) as BuildCfg;
|
|
11
|
+
} catch {
|
|
12
|
+
return null; // module not installed or not linked
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export function isEdgeToEdgeEnabled(): boolean {
|
|
17
|
+
if (Platform.OS !== "android") return false;
|
|
18
|
+
const cfg = loadBuildConfig();
|
|
19
|
+
|
|
20
|
+
return !!cfg?.IS_EDGE_TO_EDGE_ENABLED;
|
|
21
|
+
}
|