@jobber/components-native 0.86.0 → 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.
@@ -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.86.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": {
@@ -86,6 +86,7 @@
86
86
  "react": "^18.2.0",
87
87
  "react-intl": "^6.4.2",
88
88
  "react-native": ">=0.76.0",
89
+ "react-native-build-config": "^0.3.2",
89
90
  "react-native-gesture-handler": ">=2.10.0",
90
91
  "react-native-keyboard-aware-scroll-view": "^0.9.5",
91
92
  "react-native-modal-datetime-picker": " >=13.0.0",
@@ -95,5 +96,10 @@
95
96
  "react-native-safe-area-context": "^5.4.0",
96
97
  "react-native-svg": ">=12.0.0"
97
98
  },
98
- "gitHead": "712019a3de148ba8511e117278495ced049f331f"
99
+ "peerDependenciesMeta": {
100
+ "react-native-build-config": {
101
+ "optional": true
102
+ }
103
+ },
104
+ "gitHead": "c379982e9d83ceef1ec4ffa08f53ce98ed914d8c"
99
105
  }
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
  }
@@ -0,0 +1,7 @@
1
+ declare module "react-native-build-config" {
2
+ const BuildConfig: {
3
+ IS_EDGE_TO_EDGE_ENABLED?: boolean;
4
+ [k: string]: unknown;
5
+ };
6
+ export = BuildConfig;
7
+ }
@@ -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
+ }