expo-navigation-bar 4.1.2 → 4.2.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.
Files changed (51) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/android/build.gradle +2 -2
  3. package/build/NativeNavigationBarWrapper.d.ts +178 -0
  4. package/build/NativeNavigationBarWrapper.d.ts.map +1 -0
  5. package/build/NativeNavigationBarWrapper.js +316 -0
  6. package/build/NativeNavigationBarWrapper.js.map +1 -0
  7. package/build/NavigationBar.d.ts +12 -152
  8. package/build/NavigationBar.d.ts.map +1 -1
  9. package/build/NavigationBar.js +32 -292
  10. package/build/NavigationBar.js.map +1 -1
  11. package/build/NavigationBar.types.d.ts +9 -0
  12. package/build/NavigationBar.types.d.ts.map +1 -1
  13. package/build/NavigationBar.types.js.map +1 -1
  14. package/expo-module.config.json +1 -1
  15. package/local-maven-repo/host/exp/exponent/expo.modules.navigationbar/{4.1.2/expo.modules.navigationbar-4.1.2.module → 4.2.0/expo.modules.navigationbar-4.2.0.module} +7 -7
  16. package/local-maven-repo/host/exp/exponent/expo.modules.navigationbar/4.2.0/expo.modules.navigationbar-4.2.0.module.md5 +1 -0
  17. package/local-maven-repo/host/exp/exponent/expo.modules.navigationbar/4.2.0/expo.modules.navigationbar-4.2.0.module.sha1 +1 -0
  18. package/local-maven-repo/host/exp/exponent/expo.modules.navigationbar/4.2.0/expo.modules.navigationbar-4.2.0.module.sha256 +1 -0
  19. package/local-maven-repo/host/exp/exponent/expo.modules.navigationbar/4.2.0/expo.modules.navigationbar-4.2.0.module.sha512 +1 -0
  20. package/local-maven-repo/host/exp/exponent/expo.modules.navigationbar/{4.1.2/expo.modules.navigationbar-4.1.2.pom → 4.2.0/expo.modules.navigationbar-4.2.0.pom} +1 -1
  21. package/local-maven-repo/host/exp/exponent/expo.modules.navigationbar/4.2.0/expo.modules.navigationbar-4.2.0.pom.md5 +1 -0
  22. package/local-maven-repo/host/exp/exponent/expo.modules.navigationbar/4.2.0/expo.modules.navigationbar-4.2.0.pom.sha1 +1 -0
  23. package/local-maven-repo/host/exp/exponent/expo.modules.navigationbar/4.2.0/expo.modules.navigationbar-4.2.0.pom.sha256 +1 -0
  24. package/local-maven-repo/host/exp/exponent/expo.modules.navigationbar/4.2.0/expo.modules.navigationbar-4.2.0.pom.sha512 +1 -0
  25. package/local-maven-repo/host/exp/exponent/expo.modules.navigationbar/maven-metadata.xml +4 -4
  26. package/local-maven-repo/host/exp/exponent/expo.modules.navigationbar/maven-metadata.xml.md5 +1 -1
  27. package/local-maven-repo/host/exp/exponent/expo.modules.navigationbar/maven-metadata.xml.sha1 +1 -1
  28. package/local-maven-repo/host/exp/exponent/expo.modules.navigationbar/maven-metadata.xml.sha256 +1 -1
  29. package/local-maven-repo/host/exp/exponent/expo.modules.navigationbar/maven-metadata.xml.sha512 +1 -1
  30. package/package.json +6 -5
  31. package/src/NativeNavigationBarWrapper.ts +366 -0
  32. package/src/NavigationBar.ts +39 -320
  33. package/src/NavigationBar.types.ts +10 -0
  34. package/local-maven-repo/host/exp/exponent/expo.modules.navigationbar/4.1.2/expo.modules.navigationbar-4.1.2.module.md5 +0 -1
  35. package/local-maven-repo/host/exp/exponent/expo.modules.navigationbar/4.1.2/expo.modules.navigationbar-4.1.2.module.sha1 +0 -1
  36. package/local-maven-repo/host/exp/exponent/expo.modules.navigationbar/4.1.2/expo.modules.navigationbar-4.1.2.module.sha256 +0 -1
  37. package/local-maven-repo/host/exp/exponent/expo.modules.navigationbar/4.1.2/expo.modules.navigationbar-4.1.2.module.sha512 +0 -1
  38. package/local-maven-repo/host/exp/exponent/expo.modules.navigationbar/4.1.2/expo.modules.navigationbar-4.1.2.pom.md5 +0 -1
  39. package/local-maven-repo/host/exp/exponent/expo.modules.navigationbar/4.1.2/expo.modules.navigationbar-4.1.2.pom.sha1 +0 -1
  40. package/local-maven-repo/host/exp/exponent/expo.modules.navigationbar/4.1.2/expo.modules.navigationbar-4.1.2.pom.sha256 +0 -1
  41. package/local-maven-repo/host/exp/exponent/expo.modules.navigationbar/4.1.2/expo.modules.navigationbar-4.1.2.pom.sha512 +0 -1
  42. /package/local-maven-repo/host/exp/exponent/expo.modules.navigationbar/{4.1.2/expo.modules.navigationbar-4.1.2-sources.jar → 4.2.0/expo.modules.navigationbar-4.2.0-sources.jar} +0 -0
  43. /package/local-maven-repo/host/exp/exponent/expo.modules.navigationbar/{4.1.2/expo.modules.navigationbar-4.1.2-sources.jar.md5 → 4.2.0/expo.modules.navigationbar-4.2.0-sources.jar.md5} +0 -0
  44. /package/local-maven-repo/host/exp/exponent/expo.modules.navigationbar/{4.1.2/expo.modules.navigationbar-4.1.2-sources.jar.sha1 → 4.2.0/expo.modules.navigationbar-4.2.0-sources.jar.sha1} +0 -0
  45. /package/local-maven-repo/host/exp/exponent/expo.modules.navigationbar/{4.1.2/expo.modules.navigationbar-4.1.2-sources.jar.sha256 → 4.2.0/expo.modules.navigationbar-4.2.0-sources.jar.sha256} +0 -0
  46. /package/local-maven-repo/host/exp/exponent/expo.modules.navigationbar/{4.1.2/expo.modules.navigationbar-4.1.2-sources.jar.sha512 → 4.2.0/expo.modules.navigationbar-4.2.0-sources.jar.sha512} +0 -0
  47. /package/local-maven-repo/host/exp/exponent/expo.modules.navigationbar/{4.1.2/expo.modules.navigationbar-4.1.2.aar → 4.2.0/expo.modules.navigationbar-4.2.0.aar} +0 -0
  48. /package/local-maven-repo/host/exp/exponent/expo.modules.navigationbar/{4.1.2/expo.modules.navigationbar-4.1.2.aar.md5 → 4.2.0/expo.modules.navigationbar-4.2.0.aar.md5} +0 -0
  49. /package/local-maven-repo/host/exp/exponent/expo.modules.navigationbar/{4.1.2/expo.modules.navigationbar-4.1.2.aar.sha1 → 4.2.0/expo.modules.navigationbar-4.2.0.aar.sha1} +0 -0
  50. /package/local-maven-repo/host/exp/exponent/expo.modules.navigationbar/{4.1.2/expo.modules.navigationbar-4.1.2.aar.sha256 → 4.2.0/expo.modules.navigationbar-4.2.0.aar.sha256} +0 -0
  51. /package/local-maven-repo/host/exp/exponent/expo.modules.navigationbar/{4.1.2/expo.modules.navigationbar-4.1.2.aar.sha512 → 4.2.0/expo.modules.navigationbar-4.2.0.aar.sha512} +0 -0
package/CHANGELOG.md CHANGED
@@ -10,6 +10,16 @@
10
10
 
11
11
  ### 💡 Others
12
12
 
13
+ ## 4.2.0 — 2025-04-21
14
+
15
+ ### 🎉 New features
16
+
17
+ - Use wrappers for methods from `react-native-edge-to-edge.SystemBars` when edge-to-edge is enabled. ([#36163](https://github.com/expo/expo/pull/36163) by [@behenate](https://github.com/behenate))
18
+
19
+ ## 4.1.3 — 2025-04-14
20
+
21
+ _This version does not introduce any user-facing changes._
22
+
13
23
  ## 4.1.2 — 2025-04-09
14
24
 
15
25
  _This version does not introduce any user-facing changes._
@@ -4,13 +4,13 @@ plugins {
4
4
  }
5
5
 
6
6
  group = 'host.exp.exponent'
7
- version = '4.1.2'
7
+ version = '4.2.0'
8
8
 
9
9
  android {
10
10
  namespace "expo.modules.navigationbar"
11
11
  defaultConfig {
12
12
  versionCode 1
13
- versionName '4.1.2'
13
+ versionName '4.2.0'
14
14
  }
15
15
  }
16
16
 
@@ -0,0 +1,178 @@
1
+ import { type EventSubscription } from 'expo-modules-core';
2
+ import { NavigationBarBehavior, NavigationBarButtonStyle, NavigationBarPosition, NavigationBarVisibility, NavigationBarVisibilityEvent } from './NavigationBar.types';
3
+ /**
4
+ * Observe changes to the system navigation bar.
5
+ * Due to platform constraints, this callback will also be triggered when the status bar visibility changes.
6
+ *
7
+ * @example
8
+ * ```ts
9
+ * NavigationBar.addVisibilityListener(({ visibility }) => {
10
+ * // ...
11
+ * });
12
+ * ```
13
+ */
14
+ export declare function addVisibilityListener(listener: (event: NavigationBarVisibilityEvent) => void): EventSubscription;
15
+ /**
16
+ * Changes the navigation bar's background color.
17
+ *
18
+ * > This method is supported only when edge-to-edge is disabled. Using it in edge-to-edge app may lead to unexpected behavior.
19
+ *
20
+ * @example
21
+ * ```ts
22
+ * NavigationBar.setBackgroundColorAsync("white");
23
+ * ```
24
+ * @param color Any valid [CSS 3 (SVG) color](http://www.w3.org/TR/css3-color/#svg-color).
25
+ */
26
+ export declare function setBackgroundColorAsync(color: string): Promise<void>;
27
+ /**
28
+ * Gets the navigation bar's background color.
29
+ *
30
+ * > This method is supported only when edge-to-edge is disabled. Using it in edge-to-edge app may lead to unexpected behavior.
31
+ *
32
+ * @example
33
+ * ```ts
34
+ * const color = await NavigationBar.getBackgroundColorAsync();
35
+ * ```
36
+ * @returns Current navigation bar color in hex format. Returns `#00000000` (transparent) on unsupported platforms (iOS, web).
37
+ *
38
+ */
39
+ export declare function getBackgroundColorAsync(): Promise<string>;
40
+ /**
41
+ * Changes the navigation bar's border color.
42
+ *
43
+ * > This method is supported only when edge-to-edge is disabled. Using it in edge-to-edge app may lead to unexpected behavior.
44
+ *
45
+ * @example
46
+ * ```ts
47
+ * NavigationBar.setBorderColorAsync("red");
48
+ * ```
49
+ * @param color Any valid [CSS 3 (SVG) color](http://www.w3.org/TR/css3-color/#svg-color).
50
+ */
51
+ export declare function setBorderColorAsync(color: string): Promise<void>;
52
+ /**
53
+ * Gets the navigation bar's top border color, also known as the "divider color".
54
+ *
55
+ * > This method is supported only when edge-to-edge is disabled. Using it in edge-to-edge app may lead to unexpected behavior.
56
+ *
57
+ * @example
58
+ * ```ts
59
+ * const color = await NavigationBar.getBorderColorAsync();
60
+ * ```
61
+ * @returns Navigation bar top border color in hex format. Returns `#00000000` (transparent) on unsupported platforms (iOS, web).
62
+ */
63
+ export declare function getBorderColorAsync(): Promise<string>;
64
+ /**
65
+ * Get the navigation bar's visibility.
66
+ *
67
+ *
68
+ * @example
69
+ * ```ts
70
+ * const visibility = await NavigationBar.getVisibilityAsync("hidden");
71
+ * ```
72
+ * @returns Navigation bar's current visibility status. Returns `hidden` on unsupported platforms (iOS, web).
73
+ */
74
+ export declare function getVisibilityAsync(): Promise<NavigationBarVisibility>;
75
+ /**
76
+ * Changes the navigation bar's button colors between white (`light`) and a dark gray color (`dark`).
77
+ *
78
+ * > This method is supported only when edge-to-edge is disabled. Using it in edge-to-edge app may lead to unexpected behavior.
79
+ *
80
+ * @example
81
+ * ```ts
82
+ * NavigationBar.setButtonStyleAsync("light");
83
+ * ```
84
+ * @param style Dictates the color of the foreground element color.
85
+ */
86
+ export declare function setButtonStyleAsync(style: NavigationBarButtonStyle): Promise<void>;
87
+ /**
88
+ * Gets the navigation bar's button color styles.
89
+ *
90
+ * > This method is supported only when edge-to-edge is disabled. Using it in edge-to-edge app may lead to unexpected behavior.
91
+ *
92
+ * @example
93
+ * ```ts
94
+ * const style = await NavigationBar.getButtonStyleAsync();
95
+ * ```
96
+ * @returns Navigation bar foreground element color settings. Returns `light` on unsupported platforms (iOS, web).
97
+ */
98
+ export declare function getButtonStyleAsync(): Promise<NavigationBarButtonStyle>;
99
+ /**
100
+ * Sets positioning method used for the navigation bar (and status bar).
101
+ * Setting position `absolute` will float the navigation bar above the content,
102
+ * whereas position `relative` will shrink the screen to inline the navigation bar.
103
+ *
104
+ * When drawing behind the status and navigation bars, ensure the safe area insets are adjusted accordingly.
105
+ *
106
+ * > This method is supported only when edge-to-edge is disabled. Using it in edge-to-edge app may lead to unexpected behavior.
107
+ *
108
+ * @example
109
+ * ```ts
110
+ * // enables edge-to-edge mode
111
+ * await NavigationBar.setPositionAsync('absolute')
112
+ * // transparent backgrounds to see through
113
+ * await NavigationBar.setBackgroundColorAsync('#ffffff00')
114
+ * ```
115
+ * @param position Based on CSS position property.
116
+ */
117
+ export declare function setPositionAsync(position: NavigationBarPosition): Promise<void>;
118
+ /**
119
+ * Whether the navigation and status bars float above the app (absolute) or sit inline with it (relative).
120
+ * This value can be incorrect if `androidNavigationBar.visible` is used instead of the config plugin `position` property.
121
+ *
122
+ * This method is unstable because the position can be set via another native module and get out of sync.
123
+ * Alternatively, you can get the position by measuring the insets returned by `react-native-safe-area-context`.
124
+ *
125
+ * > This method is supported only when edge-to-edge is disabled. Using it in edge-to-edge app may lead to unexpected behavior.
126
+ *
127
+ * @example
128
+ * ```ts
129
+ * await NavigationBar.unstable_getPositionAsync()
130
+ * ```
131
+ * @returns Navigation bar positional rendering mode. Returns `relative` on unsupported platforms (iOS, web).
132
+ */
133
+ export declare function unstable_getPositionAsync(): Promise<NavigationBarPosition>;
134
+ /**
135
+ * Sets the behavior of the status bar and navigation bar when they are hidden and the user wants to reveal them.
136
+ *
137
+ * For example, if the navigation bar is hidden (`setVisibilityAsync(false)`) and the behavior
138
+ * is `'overlay-swipe'`, the user can swipe from the bottom of the screen to temporarily reveal the navigation bar.
139
+ *
140
+ * - `'overlay-swipe'`: Temporarily reveals the System UI after a swipe gesture (bottom or top) without insetting your App's content.
141
+ * - `'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.
142
+ * - `'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.
143
+ *
144
+ * > This method is supported only when edge-to-edge is disabled. Using it in edge-to-edge app may lead to unexpected behavior.
145
+ *
146
+ * @example
147
+ * ```ts
148
+ * await NavigationBar.setBehaviorAsync('overlay-swipe')
149
+ * ```
150
+ * @param behavior Dictates the interaction behavior of the navigation bar.
151
+ */
152
+ export declare function setBehaviorAsync(behavior: NavigationBarBehavior): Promise<void>;
153
+ /**
154
+ * Gets the behavior of the status and navigation bars when the user swipes or touches the screen.
155
+ *
156
+ * > This method is supported only when edge-to-edge is disabled. Using it in edge-to-edge app may lead to unexpected behavior.
157
+ *
158
+ * @example
159
+ * ```ts
160
+ * await NavigationBar.getBehaviorAsync()
161
+ * ```
162
+ * @returns Navigation bar interaction behavior. Returns `inset-touch` on unsupported platforms (iOS, web).
163
+ */
164
+ export declare function getBehaviorAsync(): Promise<NavigationBarBehavior>;
165
+ /**
166
+ * React hook that statefully updates with the visibility of the system navigation bar.
167
+ *
168
+ * @example
169
+ * ```ts
170
+ * function App() {
171
+ * const visibility = NavigationBar.useVisibility()
172
+ * // React Component...
173
+ * }
174
+ * ```
175
+ * @returns Visibility of the navigation bar, `null` during async initialization.
176
+ */
177
+ export declare function useVisibility(): NavigationBarVisibility | null;
178
+ //# sourceMappingURL=NativeNavigationBarWrapper.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"NativeNavigationBarWrapper.d.ts","sourceRoot":"","sources":["../src/NativeNavigationBarWrapper.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,iBAAiB,EAAiC,MAAM,mBAAmB,CAAC;AAM1F,OAAO,EACL,qBAAqB,EACrB,wBAAwB,EACxB,qBAAqB,EACrB,uBAAuB,EACvB,4BAA4B,EAC7B,MAAM,uBAAuB,CAAC;AAY/B;;;;;;;;;;GAUG;AACH,wBAAgB,qBAAqB,CACnC,QAAQ,EAAE,CAAC,KAAK,EAAE,4BAA4B,KAAK,IAAI,GACtD,iBAAiB,CAMnB;AAED;;;;;;;;;;GAUG;AACH,wBAAsB,uBAAuB,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAY1E;AAED;;;;;;;;;;;GAWG;AACH,wBAAsB,uBAAuB,IAAI,OAAO,CAAC,MAAM,CAAC,CAW/D;AAED;;;;;;;;;;GAUG;AACH,wBAAsB,mBAAmB,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAYtE;AAED;;;;;;;;;;GAUG;AACH,wBAAsB,mBAAmB,IAAI,OAAO,CAAC,MAAM,CAAC,CAY3D;AAED;;;;;;;;;GASG;AACH,wBAAsB,kBAAkB,IAAI,OAAO,CAAC,uBAAuB,CAAC,CAM3E;AAED;;;;;;;;;;GAUG;AACH,wBAAsB,mBAAmB,CAAC,KAAK,EAAE,wBAAwB,GAAG,OAAO,CAAC,IAAI,CAAC,CAWxF;AAED;;;;;;;;;;GAUG;AACH,wBAAsB,mBAAmB,IAAI,OAAO,CAAC,wBAAwB,CAAC,CAW7E;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAsB,gBAAgB,CAAC,QAAQ,EAAE,qBAAqB,GAAG,OAAO,CAAC,IAAI,CAAC,CAWrF;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAsB,yBAAyB,IAAI,OAAO,CAAC,qBAAqB,CAAC,CAWhF;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAsB,gBAAgB,CAAC,QAAQ,EAAE,qBAAqB,GAAG,OAAO,CAAC,IAAI,CAAC,CAWrF;AAED;;;;;;;;;;GAUG;AACH,wBAAsB,gBAAgB,IAAI,OAAO,CAAC,qBAAqB,CAAC,CAWvE;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,aAAa,IAAI,uBAAuB,GAAG,IAAI,CA4B9D"}
@@ -0,0 +1,316 @@
1
+ import { Platform, UnavailabilityError } from 'expo-modules-core';
2
+ import { useEffect, useState } from 'react';
3
+ import { processColor } from 'react-native';
4
+ import { isEdgeToEdge } from 'react-native-is-edge-to-edge';
5
+ import ExpoNavigationBar from './ExpoNavigationBar';
6
+ const shouldWarnAboutEdgeToEdge = Platform.OS === 'android' && isEdgeToEdge();
7
+ const defaultMessage = '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';
8
+ function potentiallyWarnAboutEdgeToEdge(message = defaultMessage) {
9
+ if (shouldWarnAboutEdgeToEdge) {
10
+ console.warn(message);
11
+ }
12
+ }
13
+ /**
14
+ * Observe changes to the system navigation bar.
15
+ * Due to platform constraints, this callback will also be triggered when the status bar visibility changes.
16
+ *
17
+ * @example
18
+ * ```ts
19
+ * NavigationBar.addVisibilityListener(({ visibility }) => {
20
+ * // ...
21
+ * });
22
+ * ```
23
+ */
24
+ export function addVisibilityListener(listener) {
25
+ // Assert so the type is non-nullable.
26
+ if (!ExpoNavigationBar.addListener) {
27
+ throw new UnavailabilityError('NavigationBar', 'addVisibilityListener');
28
+ }
29
+ return ExpoNavigationBar.addListener('ExpoNavigationBar.didChange', listener);
30
+ }
31
+ /**
32
+ * Changes the navigation bar's background color.
33
+ *
34
+ * > This method is supported only when edge-to-edge is disabled. Using it in edge-to-edge app may lead to unexpected behavior.
35
+ *
36
+ * @example
37
+ * ```ts
38
+ * NavigationBar.setBackgroundColorAsync("white");
39
+ * ```
40
+ * @param color Any valid [CSS 3 (SVG) color](http://www.w3.org/TR/css3-color/#svg-color).
41
+ */
42
+ export async function setBackgroundColorAsync(color) {
43
+ if (__DEV__) {
44
+ potentiallyWarnAboutEdgeToEdge('Setting the background color of the navigation bar is not supported when edge-to-edge is enabled And may lead to unexpected behavoir. Use the `setStyle` method instead.');
45
+ }
46
+ if (Platform.OS !== 'android') {
47
+ console.warn('`setBackgroundColorAsync` is only available on Android');
48
+ return;
49
+ }
50
+ const colorNumber = processColor(color);
51
+ return await ExpoNavigationBar.setBackgroundColorAsync(colorNumber);
52
+ }
53
+ /**
54
+ * Gets the navigation bar's background color.
55
+ *
56
+ * > This method is supported only when edge-to-edge is disabled. Using it in edge-to-edge app may lead to unexpected behavior.
57
+ *
58
+ * @example
59
+ * ```ts
60
+ * const color = await NavigationBar.getBackgroundColorAsync();
61
+ * ```
62
+ * @returns Current navigation bar color in hex format. Returns `#00000000` (transparent) on unsupported platforms (iOS, web).
63
+ *
64
+ */
65
+ export async function getBackgroundColorAsync() {
66
+ if (__DEV__) {
67
+ potentiallyWarnAboutEdgeToEdge('Getting the background color of the navigation bar is not supported when edge-to-edge is enabled and may lead to unexpected behavior.');
68
+ }
69
+ if (Platform.OS !== 'android') {
70
+ console.warn('`getBackgroundColorAsync` is only available on Android');
71
+ return `#00000000`;
72
+ }
73
+ return await ExpoNavigationBar.getBackgroundColorAsync();
74
+ }
75
+ /**
76
+ * Changes the navigation bar's border color.
77
+ *
78
+ * > This method is supported only when edge-to-edge is disabled. Using it in edge-to-edge app may lead to unexpected behavior.
79
+ *
80
+ * @example
81
+ * ```ts
82
+ * NavigationBar.setBorderColorAsync("red");
83
+ * ```
84
+ * @param color Any valid [CSS 3 (SVG) color](http://www.w3.org/TR/css3-color/#svg-color).
85
+ */
86
+ export async function setBorderColorAsync(color) {
87
+ if (__DEV__) {
88
+ potentiallyWarnAboutEdgeToEdge('Setting the border color of the navigation bar is not supported when edge-to-edge is enabled and may lead to unexpected behavior.');
89
+ }
90
+ if (Platform.OS !== 'android') {
91
+ console.warn('`setBorderColorAsync` is only available on Android');
92
+ return;
93
+ }
94
+ const colorNumber = processColor(color);
95
+ await ExpoNavigationBar.setBorderColorAsync(colorNumber);
96
+ }
97
+ /**
98
+ * Gets the navigation bar's top border color, also known as the "divider color".
99
+ *
100
+ * > This method is supported only when edge-to-edge is disabled. Using it in edge-to-edge app may lead to unexpected behavior.
101
+ *
102
+ * @example
103
+ * ```ts
104
+ * const color = await NavigationBar.getBorderColorAsync();
105
+ * ```
106
+ * @returns Navigation bar top border color in hex format. Returns `#00000000` (transparent) on unsupported platforms (iOS, web).
107
+ */
108
+ export async function getBorderColorAsync() {
109
+ if (__DEV__) {
110
+ potentiallyWarnAboutEdgeToEdge('Getting the border color of the navigation bar is not supported when edge-to-edge is enabled and may lead to unexpected behavior.');
111
+ }
112
+ if (Platform.OS !== 'android') {
113
+ console.warn('`getBorderColorAsync` is only available on Android');
114
+ return `#00000000`;
115
+ }
116
+ return await ExpoNavigationBar.getBorderColorAsync();
117
+ }
118
+ /**
119
+ * Get the navigation bar's visibility.
120
+ *
121
+ *
122
+ * @example
123
+ * ```ts
124
+ * const visibility = await NavigationBar.getVisibilityAsync("hidden");
125
+ * ```
126
+ * @returns Navigation bar's current visibility status. Returns `hidden` on unsupported platforms (iOS, web).
127
+ */
128
+ export async function getVisibilityAsync() {
129
+ if (Platform.OS !== 'android') {
130
+ console.warn('`getVisibilityAsync` is only available on Android');
131
+ return 'hidden';
132
+ }
133
+ return ExpoNavigationBar.getVisibilityAsync();
134
+ }
135
+ /**
136
+ * Changes the navigation bar's button colors between white (`light`) and a dark gray color (`dark`).
137
+ *
138
+ * > This method is supported only when edge-to-edge is disabled. Using it in edge-to-edge app may lead to unexpected behavior.
139
+ *
140
+ * @example
141
+ * ```ts
142
+ * NavigationBar.setButtonStyleAsync("light");
143
+ * ```
144
+ * @param style Dictates the color of the foreground element color.
145
+ */
146
+ export async function setButtonStyleAsync(style) {
147
+ if (__DEV__) {
148
+ potentiallyWarnAboutEdgeToEdge('Setting the navigation bar button style is not supported when edge-to-edge is enabled and may lead to unexpected behavior. Use the `setStyle` method instead.');
149
+ }
150
+ if (Platform.OS !== 'android') {
151
+ console.warn('`setButtonStyleAsync` is only available on Android');
152
+ return;
153
+ }
154
+ await ExpoNavigationBar.setButtonStyleAsync(style);
155
+ }
156
+ /**
157
+ * Gets the navigation bar's button color styles.
158
+ *
159
+ * > This method is supported only when edge-to-edge is disabled. Using it in edge-to-edge app may lead to unexpected behavior.
160
+ *
161
+ * @example
162
+ * ```ts
163
+ * const style = await NavigationBar.getButtonStyleAsync();
164
+ * ```
165
+ * @returns Navigation bar foreground element color settings. Returns `light` on unsupported platforms (iOS, web).
166
+ */
167
+ export async function getButtonStyleAsync() {
168
+ if (__DEV__) {
169
+ potentiallyWarnAboutEdgeToEdge('Getting the navigation bar button style is not supported when edge-to-edge is enabled and may lead to unexpected behavior.');
170
+ }
171
+ if (Platform.OS !== 'android') {
172
+ console.warn('`getButtonStyleAsync` is only available on Android');
173
+ return 'light';
174
+ }
175
+ return await ExpoNavigationBar.getButtonStyleAsync();
176
+ }
177
+ /**
178
+ * Sets positioning method used for the navigation bar (and status bar).
179
+ * Setting position `absolute` will float the navigation bar above the content,
180
+ * whereas position `relative` will shrink the screen to inline the navigation bar.
181
+ *
182
+ * When drawing behind the status and navigation bars, ensure the safe area insets are adjusted accordingly.
183
+ *
184
+ * > This method is supported only when edge-to-edge is disabled. Using it in edge-to-edge app may lead to unexpected behavior.
185
+ *
186
+ * @example
187
+ * ```ts
188
+ * // enables edge-to-edge mode
189
+ * await NavigationBar.setPositionAsync('absolute')
190
+ * // transparent backgrounds to see through
191
+ * await NavigationBar.setBackgroundColorAsync('#ffffff00')
192
+ * ```
193
+ * @param position Based on CSS position property.
194
+ */
195
+ export async function setPositionAsync(position) {
196
+ if (__DEV__) {
197
+ potentiallyWarnAboutEdgeToEdge('Setting the navigation bar position is not supported when edge-to-edge is enabled and may lead to unexpected behavior.');
198
+ }
199
+ if (Platform.OS !== 'android') {
200
+ console.warn('`setPositionAsync` is only available on Android');
201
+ return;
202
+ }
203
+ await ExpoNavigationBar.setPositionAsync(position);
204
+ }
205
+ /**
206
+ * Whether the navigation and status bars float above the app (absolute) or sit inline with it (relative).
207
+ * This value can be incorrect if `androidNavigationBar.visible` is used instead of the config plugin `position` property.
208
+ *
209
+ * This method is unstable because the position can be set via another native module and get out of sync.
210
+ * Alternatively, you can get the position by measuring the insets returned by `react-native-safe-area-context`.
211
+ *
212
+ * > This method is supported only when edge-to-edge is disabled. Using it in edge-to-edge app may lead to unexpected behavior.
213
+ *
214
+ * @example
215
+ * ```ts
216
+ * await NavigationBar.unstable_getPositionAsync()
217
+ * ```
218
+ * @returns Navigation bar positional rendering mode. Returns `relative` on unsupported platforms (iOS, web).
219
+ */
220
+ export async function unstable_getPositionAsync() {
221
+ if (__DEV__) {
222
+ potentiallyWarnAboutEdgeToEdge('Using the `unstable_getPositionAsync` function is not supported when edge-to-edge is enabled and may lead to unexpected behavior.');
223
+ }
224
+ if (Platform.OS !== 'android') {
225
+ console.warn('`unstable_getPositionAsync` is only available on Android');
226
+ return 'relative';
227
+ }
228
+ return await ExpoNavigationBar.unstable_getPositionAsync();
229
+ }
230
+ /**
231
+ * Sets the behavior of the status bar and navigation bar when they are hidden and the user wants to reveal them.
232
+ *
233
+ * For example, if the navigation bar is hidden (`setVisibilityAsync(false)`) and the behavior
234
+ * is `'overlay-swipe'`, the user can swipe from the bottom of the screen to temporarily reveal the navigation bar.
235
+ *
236
+ * - `'overlay-swipe'`: Temporarily reveals the System UI after a swipe gesture (bottom or top) without insetting your App's content.
237
+ * - `'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.
238
+ * - `'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.
239
+ *
240
+ * > This method is supported only when edge-to-edge is disabled. Using it in edge-to-edge app may lead to unexpected behavior.
241
+ *
242
+ * @example
243
+ * ```ts
244
+ * await NavigationBar.setBehaviorAsync('overlay-swipe')
245
+ * ```
246
+ * @param behavior Dictates the interaction behavior of the navigation bar.
247
+ */
248
+ export async function setBehaviorAsync(behavior) {
249
+ if (__DEV__) {
250
+ potentiallyWarnAboutEdgeToEdge('Setting the behavior of the navigation bar is not supported when edge-to-edge is enabled and may lead to unexpected behavior.');
251
+ }
252
+ if (Platform.OS !== 'android') {
253
+ console.warn('`setBehaviorAsync` is only available on Android');
254
+ return;
255
+ }
256
+ return await ExpoNavigationBar.setBehaviorAsync(behavior);
257
+ }
258
+ /**
259
+ * Gets the behavior of the status and navigation bars when the user swipes or touches the screen.
260
+ *
261
+ * > This method is supported only when edge-to-edge is disabled. Using it in edge-to-edge app may lead to unexpected behavior.
262
+ *
263
+ * @example
264
+ * ```ts
265
+ * await NavigationBar.getBehaviorAsync()
266
+ * ```
267
+ * @returns Navigation bar interaction behavior. Returns `inset-touch` on unsupported platforms (iOS, web).
268
+ */
269
+ export async function getBehaviorAsync() {
270
+ if (__DEV__) {
271
+ potentiallyWarnAboutEdgeToEdge('Getting the behavior of the navigation bar is not supported when edge-to-edge is enabled and may lead to unexpected behavior.');
272
+ }
273
+ if (Platform.OS !== 'android') {
274
+ console.warn('`getBehaviorAsync` is only available on Android');
275
+ return 'inset-touch';
276
+ }
277
+ return await ExpoNavigationBar.getBehaviorAsync();
278
+ }
279
+ /**
280
+ * React hook that statefully updates with the visibility of the system navigation bar.
281
+ *
282
+ * @example
283
+ * ```ts
284
+ * function App() {
285
+ * const visibility = NavigationBar.useVisibility()
286
+ * // React Component...
287
+ * }
288
+ * ```
289
+ * @returns Visibility of the navigation bar, `null` during async initialization.
290
+ */
291
+ export function useVisibility() {
292
+ const [visibility, setVisible] = useState(null);
293
+ useEffect(() => {
294
+ let isMounted = true;
295
+ if (Platform.OS !== 'android') {
296
+ setVisible('hidden');
297
+ return;
298
+ }
299
+ getVisibilityAsync().then((visibility) => {
300
+ if (isMounted) {
301
+ setVisible(visibility);
302
+ }
303
+ });
304
+ const listener = addVisibilityListener(({ visibility }) => {
305
+ if (isMounted) {
306
+ setVisible(visibility);
307
+ }
308
+ });
309
+ return () => {
310
+ listener.remove();
311
+ isMounted = false;
312
+ };
313
+ }, []);
314
+ return visibility;
315
+ }
316
+ //# sourceMappingURL=NativeNavigationBarWrapper.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"NativeNavigationBarWrapper.js","sourceRoot":"","sources":["../src/NativeNavigationBarWrapper.ts"],"names":[],"mappings":"AAAA,OAAO,EAA0B,QAAQ,EAAE,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,MAAM,yBAAyB,GAAG,QAAQ,CAAC,EAAE,KAAK,SAAS,IAAI,YAAY,EAAE,CAAC;AAC9E,MAAM,cAAc,GAClB,+NAA+N,CAAC;AAElO,SAAS,8BAA8B,CAAC,UAAkB,cAAc;IACtE,IAAI,yBAAyB,EAAE,CAAC;QAC9B,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IACxB,CAAC;AACH,CAAC;AAED;;;;;;;;;;GAUG;AACH,MAAM,UAAU,qBAAqB,CACnC,QAAuD;IAEvD,sCAAsC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CAAC,CAAC;IAEP,OAAO,UAAU,CAAC;AACpB,CAAC","sourcesContent":["import { type EventSubscription, Platform, 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 NavigationBarBehavior,\n NavigationBarButtonStyle,\n NavigationBarPosition,\n NavigationBarVisibility,\n NavigationBarVisibilityEvent,\n} from './NavigationBar.types';\n\nconst shouldWarnAboutEdgeToEdge = Platform.OS === 'android' && isEdgeToEdge();\nconst defaultMessage =\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\nfunction potentiallyWarnAboutEdgeToEdge(message: string = defaultMessage) {\n if (shouldWarnAboutEdgeToEdge) {\n console.warn(message);\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 // 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 * > This method is supported only when edge-to-edge is disabled. Using it in edge-to-edge app may lead to unexpected behavior.\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 'Setting the background color of the navigation bar is not supported when edge-to-edge is enabled And may lead to unexpected behavoir. Use the `setStyle` method instead.'\n );\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 * > This method is supported only when edge-to-edge is disabled. Using it in edge-to-edge app may lead to unexpected behavior.\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 *\n */\nexport async function getBackgroundColorAsync(): Promise<string> {\n if (__DEV__) {\n potentiallyWarnAboutEdgeToEdge(\n 'Getting the background color of the navigation bar is not supported when edge-to-edge is enabled and may lead to unexpected behavior.'\n );\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 * > This method is supported only when edge-to-edge is disabled. Using it in edge-to-edge app may lead to unexpected behavior.\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 'Setting the border color of the navigation bar is not supported when edge-to-edge is enabled and may lead to unexpected behavior.'\n );\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 * > This method is supported only when edge-to-edge is disabled. Using it in edge-to-edge app may lead to unexpected behavior.\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 'Getting the border color of the navigation bar is not supported when edge-to-edge is enabled and may lead to unexpected behavior.'\n );\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 * Get the navigation bar's visibility.\n *\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 * > This method is supported only when edge-to-edge is disabled. Using it in edge-to-edge app may lead to unexpected behavior.\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 'Setting the navigation bar button style is not supported when edge-to-edge is enabled and may lead to unexpected behavior. Use the `setStyle` method instead.'\n );\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 * > This method is supported only when edge-to-edge is disabled. Using it in edge-to-edge app may lead to unexpected behavior.\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 'Getting the navigation bar button style is not supported when edge-to-edge is enabled and may lead to unexpected behavior.'\n );\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 * > This method is supported only when edge-to-edge is disabled. Using it in edge-to-edge app may lead to unexpected behavior.\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 'Setting the navigation bar position is not supported when edge-to-edge is enabled and may lead to unexpected behavior.'\n );\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 * > This method is supported only when edge-to-edge is disabled. Using it in edge-to-edge app may lead to unexpected behavior.\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 'Using the `unstable_getPositionAsync` function is not supported when edge-to-edge is enabled and may lead to unexpected behavior.'\n );\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 * > This method is supported only when edge-to-edge is disabled. Using it in edge-to-edge app may lead to unexpected behavior.\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 'Setting the behavior of the navigation bar is not supported when edge-to-edge is enabled and may lead to unexpected behavior.'\n );\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 * > This method is supported only when edge-to-edge is disabled. Using it in edge-to-edge app may lead to unexpected behavior.\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 'Getting the behavior of the navigation bar is not supported when edge-to-edge is enabled and may lead to unexpected behavior.'\n );\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 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"]}