expo-navigation-bar 4.0.9 → 4.1.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/CHANGELOG.md CHANGED
@@ -10,26 +10,38 @@
10
10
 
11
11
  ### 💡 Others
12
12
 
13
- ## 4.0.9 — 2025-03-31
13
+ ## 4.1.0 — 2025-04-04
14
+
15
+ - Warn about potential edge-to-edge interferences. ([#34478](https://github.com/expo/expo/pull/34478) by [@zoontek](https://github.com/zoontek))
16
+
17
+ ### 🛠 Breaking changes
18
+
19
+ - upgrade RN to 0.78 ([#35050](https://github.com/expo/expo/pull/35050) by [@vonovak](https://github.com/vonovak))
20
+
21
+ ### 💡 Others
22
+
23
+ - [Android] Started using expo modules gradle plugin. ([#34176](https://github.com/expo/expo/pull/34176) by [@lukmccall](https://github.com/lukmccall))
24
+ - [apple] Migrate remaining `expo-module.config.json` to unified platform syntax. ([#34445](https://github.com/expo/expo/pull/34445) by [@reichhartd](https://github.com/reichhartd))
25
+
26
+ ## 4.0.9 - 2025-03-31
14
27
 
15
28
  _This version does not introduce any user-facing changes._
16
29
 
17
- ## 4.0.8 2025-02-06
30
+ ## 4.0.8 - 2025-02-06
18
31
 
19
32
  _This version does not introduce any user-facing changes._
20
33
 
21
- ## 4.0.7 2025-01-10
34
+ ## 4.0.7 - 2025-01-10
22
35
 
23
36
  ### 💡 Others
24
37
 
25
38
  - Restricted color types to string to prevent the use of illegal color types (PlatformColor) until supported. ([#34053](https://github.com/expo/expo/pull/34053) by [@chrfalch](https://github.com/chrfalch))
26
- - Bump `@react-native/normalize-colors` to 0.76.6. ([#34062](https://github.com/expo/expo/pull/34062) by [@gabrieldonadel](https://github.com/gabrieldonadel))
27
39
 
28
40
  ## 4.0.6 - 2024-12-10
29
41
 
30
42
  _This version does not introduce any user-facing changes._
31
43
 
32
- ## 4.0.5 2024-11-29
44
+ ## 4.0.5 - 2024-11-29
33
45
 
34
46
  _This version does not introduce any user-facing changes._
35
47
 
@@ -1,20 +1,16 @@
1
- apply plugin: 'com.android.library'
1
+ plugins {
2
+ id 'com.android.library'
3
+ id 'expo-module-gradle-plugin'
4
+ }
2
5
 
3
6
  group = 'host.exp.exponent'
4
- version = '4.0.9'
5
-
6
- def expoModulesCorePlugin = new File(project(":expo-modules-core").projectDir.absolutePath, "ExpoModulesCorePlugin.gradle")
7
- apply from: expoModulesCorePlugin
8
- applyKotlinExpoModulesCorePlugin()
9
- useCoreDependencies()
10
- useDefaultAndroidSdkVersions()
11
- useExpoPublishing()
7
+ version = '4.1.0'
12
8
 
13
9
  android {
14
10
  namespace "expo.modules.navigationbar"
15
11
  defaultConfig {
16
12
  versionCode 1
17
- versionName '4.0.9'
13
+ versionName '4.1.0'
18
14
  }
19
15
  }
20
16
 
@@ -1 +1 @@
1
- {"version":3,"file":"NavigationBar.d.ts","sourceRoot":"","sources":["../src/NavigationBar.ts"],"names":[],"mappings":"AAAA,OAAO,EAAY,KAAK,iBAAiB,EAAuB,MAAM,mBAAmB,CAAC;AAK1F,OAAO,EACL,wBAAwB,EACxB,qBAAqB,EACrB,qBAAqB,EACrB,uBAAuB,EACvB,4BAA4B,EAC7B,MAAM,uBAAuB,CAAC;AAE/B;;;;;;;;;;GAUG;AACH,wBAAgB,qBAAqB,CACnC,QAAQ,EAAE,CAAC,KAAK,EAAE,4BAA4B,KAAK,IAAI,GACtD,iBAAiB,CAMnB;AAED;;;;;;;;GAQG;AACH,wBAAsB,uBAAuB,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAO1E;AAED;;;;;;;;GAQG;AACH,wBAAsB,uBAAuB,IAAI,OAAO,CAAC,MAAM,CAAC,CAM/D;AAED;;;;;;;;GAQG;AACH,wBAAsB,mBAAmB,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAOtE;AAED;;;;;;;;GAQG;AACH,wBAAsB,mBAAmB,IAAI,OAAO,CAAC,MAAM,CAAC,CAO3D;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"}
@@ -1,7 +1,15 @@
1
1
  import { Platform, UnavailabilityError } from 'expo-modules-core';
2
2
  import { useEffect, useState } from 'react';
3
3
  import { processColor } from 'react-native';
4
+ import { isEdgeToEdge } from 'react-native-is-edge-to-edge';
4
5
  import ExpoNavigationBar from './ExpoNavigationBar';
6
+ let shouldWarnAboutEdgeToEdge = Platform.OS === 'android' && isEdgeToEdge();
7
+ function potentiallyWarnAboutEdgeToEdge() {
8
+ if (shouldWarnAboutEdgeToEdge) {
9
+ shouldWarnAboutEdgeToEdge = false; // warn once
10
+ console.warn('Using expo-navigation-bar in apps with edge-to-edge layout enabled may cause unexpected behavior. Instead, use the SystemBars component from react-native-edge-to-edge. Learn more: https://expo.fyi/edge-to-edge-system-bars');
11
+ }
12
+ }
5
13
  /**
6
14
  * Observe changes to the system navigation bar.
7
15
  * Due to platform constraints, this callback will also be triggered when the status bar visibility changes.
@@ -14,6 +22,9 @@ import ExpoNavigationBar from './ExpoNavigationBar';
14
22
  * ```
15
23
  */
16
24
  export function addVisibilityListener(listener) {
25
+ if (__DEV__) {
26
+ potentiallyWarnAboutEdgeToEdge();
27
+ }
17
28
  // Assert so the type is non-nullable.
18
29
  if (!ExpoNavigationBar.addListener) {
19
30
  throw new UnavailabilityError('NavigationBar', 'addVisibilityListener');
@@ -30,6 +41,9 @@ export function addVisibilityListener(listener) {
30
41
  * @param color Any valid [CSS 3 (SVG) color](http://www.w3.org/TR/css3-color/#svg-color).
31
42
  */
32
43
  export async function setBackgroundColorAsync(color) {
44
+ if (__DEV__) {
45
+ potentiallyWarnAboutEdgeToEdge();
46
+ }
33
47
  if (Platform.OS !== 'android') {
34
48
  console.warn('`setBackgroundColorAsync` is only available on Android');
35
49
  return;
@@ -47,6 +61,9 @@ export async function setBackgroundColorAsync(color) {
47
61
  * @returns Current navigation bar color in hex format. Returns `#00000000` (transparent) on unsupported platforms (iOS, web).
48
62
  */
49
63
  export async function getBackgroundColorAsync() {
64
+ if (__DEV__) {
65
+ potentiallyWarnAboutEdgeToEdge();
66
+ }
50
67
  if (Platform.OS !== 'android') {
51
68
  console.warn('`getBackgroundColorAsync` is only available on Android');
52
69
  return `#00000000`;
@@ -63,6 +80,9 @@ export async function getBackgroundColorAsync() {
63
80
  * @param color Any valid [CSS 3 (SVG) color](http://www.w3.org/TR/css3-color/#svg-color).
64
81
  */
65
82
  export async function setBorderColorAsync(color) {
83
+ if (__DEV__) {
84
+ potentiallyWarnAboutEdgeToEdge();
85
+ }
66
86
  if (Platform.OS !== 'android') {
67
87
  console.warn('`setBorderColorAsync` is only available on Android');
68
88
  return;
@@ -80,6 +100,9 @@ export async function setBorderColorAsync(color) {
80
100
  * @returns Navigation bar top border color in hex format. Returns `#00000000` (transparent) on unsupported platforms (iOS, web).
81
101
  */
82
102
  export async function getBorderColorAsync() {
103
+ if (__DEV__) {
104
+ potentiallyWarnAboutEdgeToEdge();
105
+ }
83
106
  if (Platform.OS !== 'android') {
84
107
  console.warn('`getBorderColorAsync` is only available on Android');
85
108
  return `#00000000`;
@@ -96,6 +119,9 @@ export async function getBorderColorAsync() {
96
119
  * @param visibility Based on CSS visibility property.
97
120
  */
98
121
  export async function setVisibilityAsync(visibility) {
122
+ if (__DEV__) {
123
+ potentiallyWarnAboutEdgeToEdge();
124
+ }
99
125
  if (Platform.OS !== 'android') {
100
126
  console.warn('`setVisibilityAsync` is only available on Android');
101
127
  return;
@@ -112,6 +138,9 @@ export async function setVisibilityAsync(visibility) {
112
138
  * @returns Navigation bar's current visibility status. Returns `hidden` on unsupported platforms (iOS, web).
113
139
  */
114
140
  export async function getVisibilityAsync() {
141
+ if (__DEV__) {
142
+ potentiallyWarnAboutEdgeToEdge();
143
+ }
115
144
  if (Platform.OS !== 'android') {
116
145
  console.warn('`getVisibilityAsync` is only available on Android');
117
146
  return 'hidden';
@@ -128,6 +157,9 @@ export async function getVisibilityAsync() {
128
157
  * @param style Dictates the color of the foreground element color.
129
158
  */
130
159
  export async function setButtonStyleAsync(style) {
160
+ if (__DEV__) {
161
+ potentiallyWarnAboutEdgeToEdge();
162
+ }
131
163
  if (Platform.OS !== 'android') {
132
164
  console.warn('`setButtonStyleAsync` is only available on Android');
133
165
  return;
@@ -144,6 +176,9 @@ export async function setButtonStyleAsync(style) {
144
176
  * @returns Navigation bar foreground element color settings. Returns `light` on unsupported platforms (iOS, web).
145
177
  */
146
178
  export async function getButtonStyleAsync() {
179
+ if (__DEV__) {
180
+ potentiallyWarnAboutEdgeToEdge();
181
+ }
147
182
  if (Platform.OS !== 'android') {
148
183
  console.warn('`getButtonStyleAsync` is only available on Android');
149
184
  return 'light';
@@ -167,6 +202,9 @@ export async function getButtonStyleAsync() {
167
202
  * @param position Based on CSS position property.
168
203
  */
169
204
  export async function setPositionAsync(position) {
205
+ if (__DEV__) {
206
+ potentiallyWarnAboutEdgeToEdge();
207
+ }
170
208
  if (Platform.OS !== 'android') {
171
209
  console.warn('`setPositionAsync` is only available on Android');
172
210
  return;
@@ -187,6 +225,9 @@ export async function setPositionAsync(position) {
187
225
  * @returns Navigation bar positional rendering mode. Returns `relative` on unsupported platforms (iOS, web).
188
226
  */
189
227
  export async function unstable_getPositionAsync() {
228
+ if (__DEV__) {
229
+ potentiallyWarnAboutEdgeToEdge();
230
+ }
190
231
  if (Platform.OS !== 'android') {
191
232
  console.warn('`unstable_getPositionAsync` is only available on Android');
192
233
  return 'relative';
@@ -210,6 +251,9 @@ export async function unstable_getPositionAsync() {
210
251
  * @param behavior Dictates the interaction behavior of the navigation bar.
211
252
  */
212
253
  export async function setBehaviorAsync(behavior) {
254
+ if (__DEV__) {
255
+ potentiallyWarnAboutEdgeToEdge();
256
+ }
213
257
  if (Platform.OS !== 'android') {
214
258
  console.warn('`setBehaviorAsync` is only available on Android');
215
259
  return;
@@ -226,6 +270,9 @@ export async function setBehaviorAsync(behavior) {
226
270
  * @returns Navigation bar interaction behavior. Returns `inset-touch` on unsupported platforms (iOS, web).
227
271
  */
228
272
  export async function getBehaviorAsync() {
273
+ if (__DEV__) {
274
+ potentiallyWarnAboutEdgeToEdge();
275
+ }
229
276
  if (Platform.OS !== 'android') {
230
277
  console.warn('`getBehaviorAsync` is only available on Android');
231
278
  return 'inset-touch';
@@ -245,6 +292,9 @@ export async function getBehaviorAsync() {
245
292
  * @returns Visibility of the navigation bar, `null` during async initialization.
246
293
  */
247
294
  export function useVisibility() {
295
+ if (__DEV__) {
296
+ potentiallyWarnAboutEdgeToEdge();
297
+ }
248
298
  const [visibility, setVisible] = useState(null);
249
299
  useEffect(() => {
250
300
  let isMounted = true;
@@ -1 +1 @@
1
- {"version":3,"file":"NavigationBar.js","sourceRoot":"","sources":["../src/NavigationBar.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAA0B,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAC1F,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC5C,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAE5C,OAAO,iBAAiB,MAAM,qBAAqB,CAAC;AASpD;;;;;;;;;;GAUG;AACH,MAAM,UAAU,qBAAqB,CACnC,QAAuD;IAEvD,sCAAsC;IACtC,IAAI,CAAC,iBAAiB,CAAC,WAAW,EAAE;QAClC,MAAM,IAAI,mBAAmB,CAAC,eAAe,EAAE,uBAAuB,CAAC,CAAC;KACzE;IACD,OAAO,iBAAiB,CAAC,WAAW,CAAC,6BAA6B,EAAE,QAAQ,CAAC,CAAC;AAChF,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,CAAC,KAAK,UAAU,uBAAuB,CAAC,KAAa;IACzD,IAAI,QAAQ,CAAC,EAAE,KAAK,SAAS,EAAE;QAC7B,OAAO,CAAC,IAAI,CAAC,wDAAwD,CAAC,CAAC;QACvE,OAAO;KACR;IACD,MAAM,WAAW,GAAG,YAAY,CAAC,KAAK,CAAC,CAAC;IACxC,OAAO,MAAM,iBAAiB,CAAC,uBAAuB,CAAC,WAAW,CAAC,CAAC;AACtE,CAAC;A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AAC","sourcesContent":["import { Platform, type EventSubscription, UnavailabilityError } from 'expo-modules-core';\nimport { useEffect, useState } from 'react';\nimport { processColor } from 'react-native';\n\nimport ExpoNavigationBar from './ExpoNavigationBar';\nimport {\n NavigationBarButtonStyle,\n NavigationBarBehavior,\n NavigationBarPosition,\n NavigationBarVisibility,\n NavigationBarVisibilityEvent,\n} from './NavigationBar.types';\n\n/**\n * Observe changes to the system navigation bar.\n * Due to platform constraints, this callback will also be triggered when the status bar visibility changes.\n *\n * @example\n * ```ts\n * NavigationBar.addVisibilityListener(({ visibility }) => {\n * // ...\n * });\n * ```\n */\nexport function addVisibilityListener(\n listener: (event: NavigationBarVisibilityEvent) => void\n): EventSubscription {\n // Assert so the type is non-nullable.\n if (!ExpoNavigationBar.addListener) {\n throw new UnavailabilityError('NavigationBar', 'addVisibilityListener');\n }\n return ExpoNavigationBar.addListener('ExpoNavigationBar.didChange', listener);\n}\n\n/**\n * Changes the navigation bar's background color.\n *\n * @example\n * ```ts\n * NavigationBar.setBackgroundColorAsync(\"white\");\n * ```\n * @param color Any valid [CSS 3 (SVG) color](http://www.w3.org/TR/css3-color/#svg-color).\n */\nexport async function setBackgroundColorAsync(color: string): Promise<void> {\n if (Platform.OS !== 'android') {\n console.warn('`setBackgroundColorAsync` is only available on Android');\n return;\n }\n const colorNumber = processColor(color);\n return await ExpoNavigationBar.setBackgroundColorAsync(colorNumber);\n}\n\n/**\n * Gets the navigation bar's background color.\n *\n * @example\n * ```ts\n * const color = await NavigationBar.getBackgroundColorAsync();\n * ```\n * @returns Current navigation bar color in hex format. Returns `#00000000` (transparent) on unsupported platforms (iOS, web).\n */\nexport async function getBackgroundColorAsync(): Promise<string> {\n if (Platform.OS !== 'android') {\n console.warn('`getBackgroundColorAsync` is only available on Android');\n return `#00000000`;\n }\n return await ExpoNavigationBar.getBackgroundColorAsync();\n}\n\n/**\n * Changes the navigation bar's border color.\n *\n * @example\n * ```ts\n * NavigationBar.setBorderColorAsync(\"red\");\n * ```\n * @param color Any valid [CSS 3 (SVG) color](http://www.w3.org/TR/css3-color/#svg-color).\n */\nexport async function setBorderColorAsync(color: string): Promise<void> {\n if (Platform.OS !== 'android') {\n console.warn('`setBorderColorAsync` is only available on Android');\n return;\n }\n const colorNumber = processColor(color);\n await ExpoNavigationBar.setBorderColorAsync(colorNumber);\n}\n\n/**\n * Gets the navigation bar's top border color, also known as the \"divider color\".\n *\n * @example\n * ```ts\n * const color = await NavigationBar.getBorderColorAsync();\n * ```\n * @returns Navigation bar top border color in hex format. Returns `#00000000` (transparent) on unsupported platforms (iOS, web).\n */\nexport async function getBorderColorAsync(): Promise<string> {\n if (Platform.OS !== 'android') {\n console.warn('`getBorderColorAsync` is only available on Android');\n return `#00000000`;\n }\n\n return await ExpoNavigationBar.getBorderColorAsync();\n}\n\n/**\n * Set the navigation bar's visibility.\n *\n * @example\n * ```ts\n * NavigationBar.setVisibilityAsync(\"hidden\");\n * ```\n * @param visibility Based on CSS visibility property.\n */\nexport async function setVisibilityAsync(visibility: NavigationBarVisibility): Promise<void> {\n if (Platform.OS !== 'android') {\n console.warn('`setVisibilityAsync` is only available on Android');\n return;\n }\n await ExpoNavigationBar.setVisibilityAsync(visibility);\n}\n\n/**\n * Get the navigation bar's visibility.\n *\n * @example\n * ```ts\n * const visibility = await NavigationBar.getVisibilityAsync(\"hidden\");\n * ```\n * @returns Navigation bar's current visibility status. Returns `hidden` on unsupported platforms (iOS, web).\n */\nexport async function getVisibilityAsync(): Promise<NavigationBarVisibility> {\n if (Platform.OS !== 'android') {\n console.warn('`getVisibilityAsync` is only available on Android');\n return 'hidden';\n }\n return ExpoNavigationBar.getVisibilityAsync();\n}\n\n/**\n * Changes the navigation bar's button colors between white (`light`) and a dark gray color (`dark`).\n *\n * @example\n * ```ts\n * NavigationBar.setButtonStyleAsync(\"light\");\n * ```\n * @param style Dictates the color of the foreground element color.\n */\nexport async function setButtonStyleAsync(style: NavigationBarButtonStyle): Promise<void> {\n if (Platform.OS !== 'android') {\n console.warn('`setButtonStyleAsync` is only available on Android');\n return;\n }\n await ExpoNavigationBar.setButtonStyleAsync(style);\n}\n\n/**\n * Gets the navigation bar's button color styles.\n *\n * @example\n * ```ts\n * const style = await NavigationBar.getButtonStyleAsync();\n * ```\n * @returns Navigation bar foreground element color settings. Returns `light` on unsupported platforms (iOS, web).\n */\nexport async function getButtonStyleAsync(): Promise<NavigationBarButtonStyle> {\n if (Platform.OS !== 'android') {\n console.warn('`getButtonStyleAsync` is only available on Android');\n return 'light';\n }\n return await ExpoNavigationBar.getButtonStyleAsync();\n}\n\n/**\n * Sets positioning method used for the navigation bar (and status bar).\n * Setting position `absolute` will float the navigation bar above the content,\n * whereas position `relative` will shrink the screen to inline the navigation bar.\n *\n * When drawing behind the status and navigation bars, ensure the safe area insets are adjusted accordingly.\n *\n * @example\n * ```ts\n * // enables edge-to-edge mode\n * await NavigationBar.setPositionAsync('absolute')\n * // transparent backgrounds to see through\n * await NavigationBar.setBackgroundColorAsync('#ffffff00')\n * ```\n * @param position Based on CSS position property.\n */\nexport async function setPositionAsync(position: NavigationBarPosition): Promise<void> {\n if (Platform.OS !== 'android') {\n console.warn('`setPositionAsync` is only available on Android');\n return;\n }\n await ExpoNavigationBar.setPositionAsync(position);\n}\n\n/**\n * Whether the navigation and status bars float above the app (absolute) or sit inline with it (relative).\n * This value can be incorrect if `androidNavigationBar.visible` is used instead of the config plugin `position` property.\n *\n * This method is unstable because the position can be set via another native module and get out of sync.\n * Alternatively, you can get the position by measuring the insets returned by `react-native-safe-area-context`.\n *\n * @example\n * ```ts\n * await NavigationBar.unstable_getPositionAsync()\n * ```\n * @returns Navigation bar positional rendering mode. Returns `relative` on unsupported platforms (iOS, web).\n */\nexport async function unstable_getPositionAsync(): Promise<NavigationBarPosition> {\n if (Platform.OS !== 'android') {\n console.warn('`unstable_getPositionAsync` is only available on Android');\n return 'relative';\n }\n return await ExpoNavigationBar.unstable_getPositionAsync();\n}\n\n/**\n * Sets the behavior of the status bar and navigation bar when they are hidden and the user wants to reveal them.\n *\n * For example, if the navigation bar is hidden (`setVisibilityAsync(false)`) and the behavior\n * is `'overlay-swipe'`, the user can swipe from the bottom of the screen to temporarily reveal the navigation bar.\n *\n * - `'overlay-swipe'`: Temporarily reveals the System UI after a swipe gesture (bottom or top) without insetting your App's content.\n * - `'inset-swipe'`: Reveals the System UI after a swipe gesture (bottom or top) and insets your App's content (Safe Area). The System UI is visible until you explicitly hide it again.\n * - `'inset-touch'`: Reveals the System UI after a touch anywhere on the screen and insets your App's content (Safe Area). The System UI is visible until you explicitly hide it again.\n *\n * @example\n * ```ts\n * await NavigationBar.setBehaviorAsync('overlay-swipe')\n * ```\n * @param behavior Dictates the interaction behavior of the navigation bar.\n */\nexport async function setBehaviorAsync(behavior: NavigationBarBehavior): Promise<void> {\n if (Platform.OS !== 'android') {\n console.warn('`setBehaviorAsync` is only available on Android');\n return;\n }\n return await ExpoNavigationBar.setBehaviorAsync(behavior);\n}\n\n/**\n * Gets the behavior of the status and navigation bars when the user swipes or touches the screen.\n *\n * @example\n * ```ts\n * await NavigationBar.getBehaviorAsync()\n * ```\n * @returns Navigation bar interaction behavior. Returns `inset-touch` on unsupported platforms (iOS, web).\n */\nexport async function getBehaviorAsync(): Promise<NavigationBarBehavior> {\n if (Platform.OS !== 'android') {\n console.warn('`getBehaviorAsync` is only available on Android');\n return 'inset-touch';\n }\n return await ExpoNavigationBar.getBehaviorAsync();\n}\n\n/**\n * React hook that statefully updates with the visibility of the system navigation bar.\n *\n * @example\n * ```ts\n * function App() {\n * const visibility = NavigationBar.useVisibility()\n * // React Component...\n * }\n * ```\n * @returns Visibility of the navigation bar, `null` during async initialization.\n */\nexport function useVisibility(): NavigationBarVisibility | null {\n const [visibility, setVisible] = useState<NavigationBarVisibility | null>(null);\n\n useEffect(() => {\n let isMounted = true;\n if (Platform.OS !== 'android') {\n setVisible('hidden');\n return;\n }\n getVisibilityAsync().then((visibility) => {\n if (isMounted) {\n setVisible(visibility);\n }\n });\n\n const listener = addVisibilityListener(({ visibility }) => {\n if (isMounted) {\n setVisible(visibility);\n }\n });\n\n return () => {\n listener.remove();\n isMounted = false;\n };\n }, []);\n\n return visibility;\n}\n\nexport * from './NavigationBar.types';\n"]}
1
+ {"version":3,"file":"NavigationBar.js","sourceRoot":"","sources":["../src/NavigationBar.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAA0B,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAC1F,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC5C,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAE5D,OAAO,iBAAiB,MAAM,qBAAqB,CAAC;AASpD,IAAI,yBAAyB,GAAG,QAAQ,CAAC,EAAE,KAAK,SAAS,IAAI,YAAY,EAAE,CAAC;AAE5E,SAAS,8BAA8B;IACrC,IAAI,yBAAyB,EAAE;QAC7B,yBAAyB,GAAG,KAAK,CAAC,CAAC,YAAY;QAC/C,OAAO,CAAC,IAAI,CACV,+NAA+N,CAChO,CAAC;KACH;AACH,CAAC;AAED;;;;;;;;;;GAUG;AACH,MAAM,UAAU,qBAAqB,CACnC,QAAuD;IAEvD,IAAI,OAAO,EAAE;QACX,8BAA8B,EAAE,CAAC;KAClC;IACD,sCAAsC;IACtC,IAAI,CAAC,iBAAiB,CAAC,WAAW,EAAE;QAClC,MAAM,IAAI,mBAAmB,CAAC,eAAe,EAAE,uBAAuB,CAAC,CAAC;KACzE;IACD,OAAO,iBAAiB,CAAC,WAAW,CAAC,6BAA6B,EAAE,QAAQ,CAAC,CAAC;AAChF,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,CAAC,KAAK,UAAU,uBAAuB,CAAC,KAAa;IACzD,IAAI,OAAO,EAAE;QACX,8BAA8B,EAAE,CAAC;KAClC;IACD,IAAI,QAAQ,CAAC,EAAE,KAAK,SAAS,EAAE;QA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;AACH,MAAM,UAAU,aAAa;IAC3B,IAAI,OAAO,EAAE;QACX,8BAA8B,EAAE,CAAC;KAClC;IAED,MAAM,CAAC,UAAU,EAAE,UAAU,CAAC,GAAG,QAAQ,CAAiC,IAAI,CAAC,CAAC;IAEhF,SAAS,CAAC,GAAG,EAAE;QACb,IAAI,SAAS,GAAG,IAAI,CAAC;QACrB,IAAI,QAAQ,CAAC,EAAE,KAAK,SAAS,EAAE;YAC7B,UAAU,CAAC,QAAQ,CAAC,CAAC;YACrB,OAAO;SACR;QACD,kBAAkB,EAAE,CAAC,IAAI,CAAC,CAAC,UAAU,EAAE,EAAE;YACvC,IAAI,SAAS,EAAE;gBACb,UAAU,CAAC,UAAU,CAAC,CAAC;aACxB;QACH,CAAC,CAAC,CAAC;QAEH,MAAM,QAAQ,GAAG,qBAAqB,CAAC,CAAC,EAAE,UAAU,EAAE,EAAE,EAAE;YACxD,IAAI,SAAS,EAAE;gBACb,UAAU,CAAC,UAAU,CAAC,CAAC;aACxB;QACH,CAAC,CAAC,CAAC;QAEH,OAAO,GAAG,EAAE;YACV,QAAQ,CAAC,MAAM,EAAE,CAAC;YAClB,SAAS,GAAG,KAAK,CAAC;QACpB,CAAC,CAAC;IACJ,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,OAAO,UAAU,CAAC;AACpB,CAAC;AAED,cAAc,uBAAuB,CAAC","sourcesContent":["import { Platform, type EventSubscription, UnavailabilityError } from 'expo-modules-core';\nimport { useEffect, useState } from 'react';\nimport { processColor } from 'react-native';\nimport { isEdgeToEdge } from 'react-native-is-edge-to-edge';\n\nimport ExpoNavigationBar from './ExpoNavigationBar';\nimport {\n NavigationBarButtonStyle,\n NavigationBarBehavior,\n NavigationBarPosition,\n NavigationBarVisibility,\n NavigationBarVisibilityEvent,\n} from './NavigationBar.types';\n\nlet shouldWarnAboutEdgeToEdge = Platform.OS === 'android' && isEdgeToEdge();\n\nfunction potentiallyWarnAboutEdgeToEdge() {\n if (shouldWarnAboutEdgeToEdge) {\n shouldWarnAboutEdgeToEdge = false; // warn once\n console.warn(\n 'Using expo-navigation-bar in apps with edge-to-edge layout enabled may cause unexpected behavior. Instead, use the SystemBars component from react-native-edge-to-edge. Learn more: https://expo.fyi/edge-to-edge-system-bars'\n );\n }\n}\n\n/**\n * Observe changes to the system navigation bar.\n * Due to platform constraints, this callback will also be triggered when the status bar visibility changes.\n *\n * @example\n * ```ts\n * NavigationBar.addVisibilityListener(({ visibility }) => {\n * // ...\n * });\n * ```\n */\nexport function addVisibilityListener(\n listener: (event: NavigationBarVisibilityEvent) => void\n): EventSubscription {\n if (__DEV__) {\n potentiallyWarnAboutEdgeToEdge();\n }\n // Assert so the type is non-nullable.\n if (!ExpoNavigationBar.addListener) {\n throw new UnavailabilityError('NavigationBar', 'addVisibilityListener');\n }\n return ExpoNavigationBar.addListener('ExpoNavigationBar.didChange', listener);\n}\n\n/**\n * Changes the navigation bar's background color.\n *\n * @example\n * ```ts\n * NavigationBar.setBackgroundColorAsync(\"white\");\n * ```\n * @param color Any valid [CSS 3 (SVG) color](http://www.w3.org/TR/css3-color/#svg-color).\n */\nexport async function setBackgroundColorAsync(color: string): Promise<void> {\n if (__DEV__) {\n potentiallyWarnAboutEdgeToEdge();\n }\n if (Platform.OS !== 'android') {\n console.warn('`setBackgroundColorAsync` is only available on Android');\n return;\n }\n const colorNumber = processColor(color);\n return await ExpoNavigationBar.setBackgroundColorAsync(colorNumber);\n}\n\n/**\n * Gets the navigation bar's background color.\n *\n * @example\n * ```ts\n * const color = await NavigationBar.getBackgroundColorAsync();\n * ```\n * @returns Current navigation bar color in hex format. Returns `#00000000` (transparent) on unsupported platforms (iOS, web).\n */\nexport async function getBackgroundColorAsync(): Promise<string> {\n if (__DEV__) {\n potentiallyWarnAboutEdgeToEdge();\n }\n if (Platform.OS !== 'android') {\n console.warn('`getBackgroundColorAsync` is only available on Android');\n return `#00000000`;\n }\n return await ExpoNavigationBar.getBackgroundColorAsync();\n}\n\n/**\n * Changes the navigation bar's border color.\n *\n * @example\n * ```ts\n * NavigationBar.setBorderColorAsync(\"red\");\n * ```\n * @param color Any valid [CSS 3 (SVG) color](http://www.w3.org/TR/css3-color/#svg-color).\n */\nexport async function setBorderColorAsync(color: string): Promise<void> {\n if (__DEV__) {\n potentiallyWarnAboutEdgeToEdge();\n }\n if (Platform.OS !== 'android') {\n console.warn('`setBorderColorAsync` is only available on Android');\n return;\n }\n const colorNumber = processColor(color);\n await ExpoNavigationBar.setBorderColorAsync(colorNumber);\n}\n\n/**\n * Gets the navigation bar's top border color, also known as the \"divider color\".\n *\n * @example\n * ```ts\n * const color = await NavigationBar.getBorderColorAsync();\n * ```\n * @returns Navigation bar top border color in hex format. Returns `#00000000` (transparent) on unsupported platforms (iOS, web).\n */\nexport async function getBorderColorAsync(): Promise<string> {\n if (__DEV__) {\n potentiallyWarnAboutEdgeToEdge();\n }\n if (Platform.OS !== 'android') {\n console.warn('`getBorderColorAsync` is only available on Android');\n return `#00000000`;\n }\n\n return await ExpoNavigationBar.getBorderColorAsync();\n}\n\n/**\n * Set the navigation bar's visibility.\n *\n * @example\n * ```ts\n * NavigationBar.setVisibilityAsync(\"hidden\");\n * ```\n * @param visibility Based on CSS visibility property.\n */\nexport async function setVisibilityAsync(visibility: NavigationBarVisibility): Promise<void> {\n if (__DEV__) {\n potentiallyWarnAboutEdgeToEdge();\n }\n if (Platform.OS !== 'android') {\n console.warn('`setVisibilityAsync` is only available on Android');\n return;\n }\n await ExpoNavigationBar.setVisibilityAsync(visibility);\n}\n\n/**\n * Get the navigation bar's visibility.\n *\n * @example\n * ```ts\n * const visibility = await NavigationBar.getVisibilityAsync(\"hidden\");\n * ```\n * @returns Navigation bar's current visibility status. Returns `hidden` on unsupported platforms (iOS, web).\n */\nexport async function getVisibilityAsync(): Promise<NavigationBarVisibility> {\n if (__DEV__) {\n potentiallyWarnAboutEdgeToEdge();\n }\n if (Platform.OS !== 'android') {\n console.warn('`getVisibilityAsync` is only available on Android');\n return 'hidden';\n }\n return ExpoNavigationBar.getVisibilityAsync();\n}\n\n/**\n * Changes the navigation bar's button colors between white (`light`) and a dark gray color (`dark`).\n *\n * @example\n * ```ts\n * NavigationBar.setButtonStyleAsync(\"light\");\n * ```\n * @param style Dictates the color of the foreground element color.\n */\nexport async function setButtonStyleAsync(style: NavigationBarButtonStyle): Promise<void> {\n if (__DEV__) {\n potentiallyWarnAboutEdgeToEdge();\n }\n if (Platform.OS !== 'android') {\n console.warn('`setButtonStyleAsync` is only available on Android');\n return;\n }\n await ExpoNavigationBar.setButtonStyleAsync(style);\n}\n\n/**\n * Gets the navigation bar's button color styles.\n *\n * @example\n * ```ts\n * const style = await NavigationBar.getButtonStyleAsync();\n * ```\n * @returns Navigation bar foreground element color settings. Returns `light` on unsupported platforms (iOS, web).\n */\nexport async function getButtonStyleAsync(): Promise<NavigationBarButtonStyle> {\n if (__DEV__) {\n potentiallyWarnAboutEdgeToEdge();\n }\n if (Platform.OS !== 'android') {\n console.warn('`getButtonStyleAsync` is only available on Android');\n return 'light';\n }\n return await ExpoNavigationBar.getButtonStyleAsync();\n}\n\n/**\n * Sets positioning method used for the navigation bar (and status bar).\n * Setting position `absolute` will float the navigation bar above the content,\n * whereas position `relative` will shrink the screen to inline the navigation bar.\n *\n * When drawing behind the status and navigation bars, ensure the safe area insets are adjusted accordingly.\n *\n * @example\n * ```ts\n * // enables edge-to-edge mode\n * await NavigationBar.setPositionAsync('absolute')\n * // transparent backgrounds to see through\n * await NavigationBar.setBackgroundColorAsync('#ffffff00')\n * ```\n * @param position Based on CSS position property.\n */\nexport async function setPositionAsync(position: NavigationBarPosition): Promise<void> {\n if (__DEV__) {\n potentiallyWarnAboutEdgeToEdge();\n }\n if (Platform.OS !== 'android') {\n console.warn('`setPositionAsync` is only available on Android');\n return;\n }\n await ExpoNavigationBar.setPositionAsync(position);\n}\n\n/**\n * Whether the navigation and status bars float above the app (absolute) or sit inline with it (relative).\n * This value can be incorrect if `androidNavigationBar.visible` is used instead of the config plugin `position` property.\n *\n * This method is unstable because the position can be set via another native module and get out of sync.\n * Alternatively, you can get the position by measuring the insets returned by `react-native-safe-area-context`.\n *\n * @example\n * ```ts\n * await NavigationBar.unstable_getPositionAsync()\n * ```\n * @returns Navigation bar positional rendering mode. Returns `relative` on unsupported platforms (iOS, web).\n */\nexport async function unstable_getPositionAsync(): Promise<NavigationBarPosition> {\n if (__DEV__) {\n potentiallyWarnAboutEdgeToEdge();\n }\n if (Platform.OS !== 'android') {\n console.warn('`unstable_getPositionAsync` is only available on Android');\n return 'relative';\n }\n return await ExpoNavigationBar.unstable_getPositionAsync();\n}\n\n/**\n * Sets the behavior of the status bar and navigation bar when they are hidden and the user wants to reveal them.\n *\n * For example, if the navigation bar is hidden (`setVisibilityAsync(false)`) and the behavior\n * is `'overlay-swipe'`, the user can swipe from the bottom of the screen to temporarily reveal the navigation bar.\n *\n * - `'overlay-swipe'`: Temporarily reveals the System UI after a swipe gesture (bottom or top) without insetting your App's content.\n * - `'inset-swipe'`: Reveals the System UI after a swipe gesture (bottom or top) and insets your App's content (Safe Area). The System UI is visible until you explicitly hide it again.\n * - `'inset-touch'`: Reveals the System UI after a touch anywhere on the screen and insets your App's content (Safe Area). The System UI is visible until you explicitly hide it again.\n *\n * @example\n * ```ts\n * await NavigationBar.setBehaviorAsync('overlay-swipe')\n * ```\n * @param behavior Dictates the interaction behavior of the navigation bar.\n */\nexport async function setBehaviorAsync(behavior: NavigationBarBehavior): Promise<void> {\n if (__DEV__) {\n potentiallyWarnAboutEdgeToEdge();\n }\n if (Platform.OS !== 'android') {\n console.warn('`setBehaviorAsync` is only available on Android');\n return;\n }\n return await ExpoNavigationBar.setBehaviorAsync(behavior);\n}\n\n/**\n * Gets the behavior of the status and navigation bars when the user swipes or touches the screen.\n *\n * @example\n * ```ts\n * await NavigationBar.getBehaviorAsync()\n * ```\n * @returns Navigation bar interaction behavior. Returns `inset-touch` on unsupported platforms (iOS, web).\n */\nexport async function getBehaviorAsync(): Promise<NavigationBarBehavior> {\n if (__DEV__) {\n potentiallyWarnAboutEdgeToEdge();\n }\n if (Platform.OS !== 'android') {\n console.warn('`getBehaviorAsync` is only available on Android');\n return 'inset-touch';\n }\n return await ExpoNavigationBar.getBehaviorAsync();\n}\n\n/**\n * React hook that statefully updates with the visibility of the system navigation bar.\n *\n * @example\n * ```ts\n * function App() {\n * const visibility = NavigationBar.useVisibility()\n * // React Component...\n * }\n * ```\n * @returns Visibility of the navigation bar, `null` during async initialization.\n */\nexport function useVisibility(): NavigationBarVisibility | null {\n if (__DEV__) {\n potentiallyWarnAboutEdgeToEdge();\n }\n\n const [visibility, setVisible] = useState<NavigationBarVisibility | null>(null);\n\n useEffect(() => {\n let isMounted = true;\n if (Platform.OS !== 'android') {\n setVisible('hidden');\n return;\n }\n getVisibilityAsync().then((visibility) => {\n if (isMounted) {\n setVisible(visibility);\n }\n });\n\n const listener = addVisibilityListener(({ visibility }) => {\n if (isMounted) {\n setVisible(visibility);\n }\n });\n\n return () => {\n listener.remove();\n isMounted = false;\n };\n }, []);\n\n return visibility;\n}\n\nexport * from './NavigationBar.types';\n"]}
@@ -1,5 +1,4 @@
1
1
  {
2
- "name": "expo-navigation-bar",
3
2
  "platforms": ["android"],
4
3
  "android": {
5
4
  "modules": ["expo.modules.navigationbar.NavigationBarModule"]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "expo-navigation-bar",
3
- "version": "4.0.9",
3
+ "version": "4.1.0",
4
4
  "description": "Modify and observe the native navigation bar on Android devices.",
5
5
  "main": "build/NavigationBar.js",
6
6
  "types": "build/NavigationBar.d.ts",
@@ -34,17 +34,18 @@
34
34
  "license": "MIT",
35
35
  "homepage": "https://docs.expo.dev/versions/latest/sdk/navigation-bar",
36
36
  "dependencies": {
37
- "@react-native/normalize-colors": "0.76.8",
38
- "debug": "^4.3.2"
37
+ "@react-native/normalize-colors": "0.79.0-rc.4",
38
+ "debug": "^4.3.2",
39
+ "react-native-is-edge-to-edge": "^1.1.6"
39
40
  },
40
41
  "devDependencies": {
41
42
  "@types/debug": "^4.1.7",
42
- "expo-module-scripts": "^4.0.4"
43
+ "expo-module-scripts": "^4.1.0"
43
44
  },
44
45
  "peerDependencies": {
45
46
  "expo": "*",
46
47
  "react": "*",
47
48
  "react-native": "*"
48
49
  },
49
- "gitHead": "efc676ef6dbe6c2eaed19c1a31abb79a935f583a"
50
+ "gitHead": "68b8233002dc678934ba40cbade7fbc80e71aeff"
50
51
  }
@@ -1,6 +1,7 @@
1
1
  import { Platform, type EventSubscription, UnavailabilityError } from 'expo-modules-core';
2
2
  import { useEffect, useState } from 'react';
3
3
  import { processColor } from 'react-native';
4
+ import { isEdgeToEdge } from 'react-native-is-edge-to-edge';
4
5
 
5
6
  import ExpoNavigationBar from './ExpoNavigationBar';
6
7
  import {
@@ -11,6 +12,17 @@ import {
11
12
  NavigationBarVisibilityEvent,
12
13
  } from './NavigationBar.types';
13
14
 
15
+ let shouldWarnAboutEdgeToEdge = Platform.OS === 'android' && isEdgeToEdge();
16
+
17
+ function potentiallyWarnAboutEdgeToEdge() {
18
+ if (shouldWarnAboutEdgeToEdge) {
19
+ shouldWarnAboutEdgeToEdge = false; // warn once
20
+ console.warn(
21
+ 'Using expo-navigation-bar in apps with edge-to-edge layout enabled may cause unexpected behavior. Instead, use the SystemBars component from react-native-edge-to-edge. Learn more: https://expo.fyi/edge-to-edge-system-bars'
22
+ );
23
+ }
24
+ }
25
+
14
26
  /**
15
27
  * Observe changes to the system navigation bar.
16
28
  * Due to platform constraints, this callback will also be triggered when the status bar visibility changes.
@@ -25,6 +37,9 @@ import {
25
37
  export function addVisibilityListener(
26
38
  listener: (event: NavigationBarVisibilityEvent) => void
27
39
  ): EventSubscription {
40
+ if (__DEV__) {
41
+ potentiallyWarnAboutEdgeToEdge();
42
+ }
28
43
  // Assert so the type is non-nullable.
29
44
  if (!ExpoNavigationBar.addListener) {
30
45
  throw new UnavailabilityError('NavigationBar', 'addVisibilityListener');
@@ -42,6 +57,9 @@ export function addVisibilityListener(
42
57
  * @param color Any valid [CSS 3 (SVG) color](http://www.w3.org/TR/css3-color/#svg-color).
43
58
  */
44
59
  export async function setBackgroundColorAsync(color: string): Promise<void> {
60
+ if (__DEV__) {
61
+ potentiallyWarnAboutEdgeToEdge();
62
+ }
45
63
  if (Platform.OS !== 'android') {
46
64
  console.warn('`setBackgroundColorAsync` is only available on Android');
47
65
  return;
@@ -60,6 +78,9 @@ export async function setBackgroundColorAsync(color: string): Promise<void> {
60
78
  * @returns Current navigation bar color in hex format. Returns `#00000000` (transparent) on unsupported platforms (iOS, web).
61
79
  */
62
80
  export async function getBackgroundColorAsync(): Promise<string> {
81
+ if (__DEV__) {
82
+ potentiallyWarnAboutEdgeToEdge();
83
+ }
63
84
  if (Platform.OS !== 'android') {
64
85
  console.warn('`getBackgroundColorAsync` is only available on Android');
65
86
  return `#00000000`;
@@ -77,6 +98,9 @@ export async function getBackgroundColorAsync(): Promise<string> {
77
98
  * @param color Any valid [CSS 3 (SVG) color](http://www.w3.org/TR/css3-color/#svg-color).
78
99
  */
79
100
  export async function setBorderColorAsync(color: string): Promise<void> {
101
+ if (__DEV__) {
102
+ potentiallyWarnAboutEdgeToEdge();
103
+ }
80
104
  if (Platform.OS !== 'android') {
81
105
  console.warn('`setBorderColorAsync` is only available on Android');
82
106
  return;
@@ -95,6 +119,9 @@ export async function setBorderColorAsync(color: string): Promise<void> {
95
119
  * @returns Navigation bar top border color in hex format. Returns `#00000000` (transparent) on unsupported platforms (iOS, web).
96
120
  */
97
121
  export async function getBorderColorAsync(): Promise<string> {
122
+ if (__DEV__) {
123
+ potentiallyWarnAboutEdgeToEdge();
124
+ }
98
125
  if (Platform.OS !== 'android') {
99
126
  console.warn('`getBorderColorAsync` is only available on Android');
100
127
  return `#00000000`;
@@ -113,6 +140,9 @@ export async function getBorderColorAsync(): Promise<string> {
113
140
  * @param visibility Based on CSS visibility property.
114
141
  */
115
142
  export async function setVisibilityAsync(visibility: NavigationBarVisibility): Promise<void> {
143
+ if (__DEV__) {
144
+ potentiallyWarnAboutEdgeToEdge();
145
+ }
116
146
  if (Platform.OS !== 'android') {
117
147
  console.warn('`setVisibilityAsync` is only available on Android');
118
148
  return;
@@ -130,6 +160,9 @@ export async function setVisibilityAsync(visibility: NavigationBarVisibility): P
130
160
  * @returns Navigation bar's current visibility status. Returns `hidden` on unsupported platforms (iOS, web).
131
161
  */
132
162
  export async function getVisibilityAsync(): Promise<NavigationBarVisibility> {
163
+ if (__DEV__) {
164
+ potentiallyWarnAboutEdgeToEdge();
165
+ }
133
166
  if (Platform.OS !== 'android') {
134
167
  console.warn('`getVisibilityAsync` is only available on Android');
135
168
  return 'hidden';
@@ -147,6 +180,9 @@ export async function getVisibilityAsync(): Promise<NavigationBarVisibility> {
147
180
  * @param style Dictates the color of the foreground element color.
148
181
  */
149
182
  export async function setButtonStyleAsync(style: NavigationBarButtonStyle): Promise<void> {
183
+ if (__DEV__) {
184
+ potentiallyWarnAboutEdgeToEdge();
185
+ }
150
186
  if (Platform.OS !== 'android') {
151
187
  console.warn('`setButtonStyleAsync` is only available on Android');
152
188
  return;
@@ -164,6 +200,9 @@ export async function setButtonStyleAsync(style: NavigationBarButtonStyle): Prom
164
200
  * @returns Navigation bar foreground element color settings. Returns `light` on unsupported platforms (iOS, web).
165
201
  */
166
202
  export async function getButtonStyleAsync(): Promise<NavigationBarButtonStyle> {
203
+ if (__DEV__) {
204
+ potentiallyWarnAboutEdgeToEdge();
205
+ }
167
206
  if (Platform.OS !== 'android') {
168
207
  console.warn('`getButtonStyleAsync` is only available on Android');
169
208
  return 'light';
@@ -188,6 +227,9 @@ export async function getButtonStyleAsync(): Promise<NavigationBarButtonStyle> {
188
227
  * @param position Based on CSS position property.
189
228
  */
190
229
  export async function setPositionAsync(position: NavigationBarPosition): Promise<void> {
230
+ if (__DEV__) {
231
+ potentiallyWarnAboutEdgeToEdge();
232
+ }
191
233
  if (Platform.OS !== 'android') {
192
234
  console.warn('`setPositionAsync` is only available on Android');
193
235
  return;
@@ -209,6 +251,9 @@ export async function setPositionAsync(position: NavigationBarPosition): Promise
209
251
  * @returns Navigation bar positional rendering mode. Returns `relative` on unsupported platforms (iOS, web).
210
252
  */
211
253
  export async function unstable_getPositionAsync(): Promise<NavigationBarPosition> {
254
+ if (__DEV__) {
255
+ potentiallyWarnAboutEdgeToEdge();
256
+ }
212
257
  if (Platform.OS !== 'android') {
213
258
  console.warn('`unstable_getPositionAsync` is only available on Android');
214
259
  return 'relative';
@@ -233,6 +278,9 @@ export async function unstable_getPositionAsync(): Promise<NavigationBarPosition
233
278
  * @param behavior Dictates the interaction behavior of the navigation bar.
234
279
  */
235
280
  export async function setBehaviorAsync(behavior: NavigationBarBehavior): Promise<void> {
281
+ if (__DEV__) {
282
+ potentiallyWarnAboutEdgeToEdge();
283
+ }
236
284
  if (Platform.OS !== 'android') {
237
285
  console.warn('`setBehaviorAsync` is only available on Android');
238
286
  return;
@@ -250,6 +298,9 @@ export async function setBehaviorAsync(behavior: NavigationBarBehavior): Promise
250
298
  * @returns Navigation bar interaction behavior. Returns `inset-touch` on unsupported platforms (iOS, web).
251
299
  */
252
300
  export async function getBehaviorAsync(): Promise<NavigationBarBehavior> {
301
+ if (__DEV__) {
302
+ potentiallyWarnAboutEdgeToEdge();
303
+ }
253
304
  if (Platform.OS !== 'android') {
254
305
  console.warn('`getBehaviorAsync` is only available on Android');
255
306
  return 'inset-touch';
@@ -270,6 +321,10 @@ export async function getBehaviorAsync(): Promise<NavigationBarBehavior> {
270
321
  * @returns Visibility of the navigation bar, `null` during async initialization.
271
322
  */
272
323
  export function useVisibility(): NavigationBarVisibility | null {
324
+ if (__DEV__) {
325
+ potentiallyWarnAboutEdgeToEdge();
326
+ }
327
+
273
328
  const [visibility, setVisible] = useState<NavigationBarVisibility | null>(null);
274
329
 
275
330
  useEffect(() => {