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.
- package/CHANGELOG.md +10 -0
- package/android/build.gradle +2 -2
- package/build/NativeNavigationBarWrapper.d.ts +178 -0
- package/build/NativeNavigationBarWrapper.d.ts.map +1 -0
- package/build/NativeNavigationBarWrapper.js +316 -0
- package/build/NativeNavigationBarWrapper.js.map +1 -0
- package/build/NavigationBar.d.ts +12 -152
- package/build/NavigationBar.d.ts.map +1 -1
- package/build/NavigationBar.js +32 -292
- package/build/NavigationBar.js.map +1 -1
- package/build/NavigationBar.types.d.ts +9 -0
- package/build/NavigationBar.types.d.ts.map +1 -1
- package/build/NavigationBar.types.js.map +1 -1
- package/expo-module.config.json +1 -1
- 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
- package/local-maven-repo/host/exp/exponent/expo.modules.navigationbar/4.2.0/expo.modules.navigationbar-4.2.0.module.md5 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.navigationbar/4.2.0/expo.modules.navigationbar-4.2.0.module.sha1 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.navigationbar/4.2.0/expo.modules.navigationbar-4.2.0.module.sha256 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.navigationbar/4.2.0/expo.modules.navigationbar-4.2.0.module.sha512 +1 -0
- 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
- package/local-maven-repo/host/exp/exponent/expo.modules.navigationbar/4.2.0/expo.modules.navigationbar-4.2.0.pom.md5 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.navigationbar/4.2.0/expo.modules.navigationbar-4.2.0.pom.sha1 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.navigationbar/4.2.0/expo.modules.navigationbar-4.2.0.pom.sha256 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.navigationbar/4.2.0/expo.modules.navigationbar-4.2.0.pom.sha512 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.navigationbar/maven-metadata.xml +4 -4
- package/local-maven-repo/host/exp/exponent/expo.modules.navigationbar/maven-metadata.xml.md5 +1 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.navigationbar/maven-metadata.xml.sha1 +1 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.navigationbar/maven-metadata.xml.sha256 +1 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.navigationbar/maven-metadata.xml.sha512 +1 -1
- package/package.json +6 -5
- package/src/NativeNavigationBarWrapper.ts +366 -0
- package/src/NavigationBar.ts +39 -320
- package/src/NavigationBar.types.ts +10 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.navigationbar/4.1.2/expo.modules.navigationbar-4.1.2.module.md5 +0 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.navigationbar/4.1.2/expo.modules.navigationbar-4.1.2.module.sha1 +0 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.navigationbar/4.1.2/expo.modules.navigationbar-4.1.2.module.sha256 +0 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.navigationbar/4.1.2/expo.modules.navigationbar-4.1.2.module.sha512 +0 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.navigationbar/4.1.2/expo.modules.navigationbar-4.1.2.pom.md5 +0 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.navigationbar/4.1.2/expo.modules.navigationbar-4.1.2.pom.sha1 +0 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.navigationbar/4.1.2/expo.modules.navigationbar-4.1.2.pom.sha256 +0 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.navigationbar/4.1.2/expo.modules.navigationbar-4.1.2.pom.sha512 +0 -1
- /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
- /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
- /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
- /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
- /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
- /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
- /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
- /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
- /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
- /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/src/NavigationBar.ts
CHANGED
|
@@ -1,133 +1,49 @@
|
|
|
1
|
-
import { Platform
|
|
2
|
-
import { useEffect, useState } from 'react';
|
|
3
|
-
import { processColor } from 'react-native';
|
|
1
|
+
import { Platform } from 'react-native';
|
|
4
2
|
import { isEdgeToEdge } from 'react-native-is-edge-to-edge';
|
|
5
3
|
|
|
6
4
|
import ExpoNavigationBar from './ExpoNavigationBar';
|
|
7
|
-
import {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
if (
|
|
19
|
-
|
|
20
|
-
|
|
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'
|
|
5
|
+
import { NavigationBarStyle, NavigationBarVisibility } from './NavigationBar.types';
|
|
6
|
+
|
|
7
|
+
// This line only imports the type information for TypeScript type checking.
|
|
8
|
+
// It doesn't import the actual module in the compiled JavaScript code. The actual
|
|
9
|
+
// module is imported conditionally with require() below, in order to avoid
|
|
10
|
+
// importing the module if edge-to-edge is not enabled (which could throw if
|
|
11
|
+
// it's not linked).
|
|
12
|
+
let SystemBars: typeof import('react-native-edge-to-edge').SystemBars | null = null;
|
|
13
|
+
|
|
14
|
+
if (isEdgeToEdge() && Platform.OS === 'android') {
|
|
15
|
+
SystemBars = require('react-native-edge-to-edge').SystemBars;
|
|
16
|
+
if (!SystemBars) {
|
|
17
|
+
throw new Error(
|
|
18
|
+
'Edge-to-edge has been enabled with `react-native-edge-to-edge`, but `SystemBars` failed to resolve. Make sure your project is configured correctly.'
|
|
22
19
|
);
|
|
23
20
|
}
|
|
24
21
|
}
|
|
22
|
+
const canRunEdgeToEdgeMethods = SystemBars !== null;
|
|
25
23
|
|
|
24
|
+
// MARK: react-native-edge-to-edge based APIs
|
|
26
25
|
/**
|
|
27
|
-
*
|
|
28
|
-
*
|
|
26
|
+
* Sets the style of the navigation bar.
|
|
27
|
+
* > This will have an effect when the following conditions are met:
|
|
28
|
+
* > - Edge-to-edge is enabled
|
|
29
|
+
* > - The `enforceNavigationBarContrast` option of the `react-native-edge-to-edge` plugin is set to `false`.
|
|
30
|
+
* > - The device is using the three-button navigation bar.
|
|
29
31
|
*
|
|
30
|
-
*
|
|
31
|
-
* ```ts
|
|
32
|
-
* NavigationBar.addVisibilityListener(({ visibility }) => {
|
|
33
|
-
* // ...
|
|
34
|
-
* });
|
|
35
|
-
* ```
|
|
36
|
-
*/
|
|
37
|
-
export function addVisibilityListener(
|
|
38
|
-
listener: (event: NavigationBarVisibilityEvent) => void
|
|
39
|
-
): EventSubscription {
|
|
40
|
-
if (__DEV__) {
|
|
41
|
-
potentiallyWarnAboutEdgeToEdge();
|
|
42
|
-
}
|
|
43
|
-
// Assert so the type is non-nullable.
|
|
44
|
-
if (!ExpoNavigationBar.addListener) {
|
|
45
|
-
throw new UnavailabilityError('NavigationBar', 'addVisibilityListener');
|
|
46
|
-
}
|
|
47
|
-
return ExpoNavigationBar.addListener('ExpoNavigationBar.didChange', listener);
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
/**
|
|
51
|
-
* Changes the navigation bar's background color.
|
|
32
|
+
* > Due to a bug in the Android 15 emulator this function may have no effect. Try a physical device or an emulator with a different version of Android.
|
|
52
33
|
*
|
|
53
|
-
* @
|
|
54
|
-
* ```ts
|
|
55
|
-
* NavigationBar.setBackgroundColorAsync("white");
|
|
56
|
-
* ```
|
|
57
|
-
* @param color Any valid [CSS 3 (SVG) color](http://www.w3.org/TR/css3-color/#svg-color).
|
|
58
|
-
*/
|
|
59
|
-
export async function setBackgroundColorAsync(color: string): Promise<void> {
|
|
60
|
-
if (__DEV__) {
|
|
61
|
-
potentiallyWarnAboutEdgeToEdge();
|
|
62
|
-
}
|
|
63
|
-
if (Platform.OS !== 'android') {
|
|
64
|
-
console.warn('`setBackgroundColorAsync` is only available on Android');
|
|
65
|
-
return;
|
|
66
|
-
}
|
|
67
|
-
const colorNumber = processColor(color);
|
|
68
|
-
return await ExpoNavigationBar.setBackgroundColorAsync(colorNumber);
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
/**
|
|
72
|
-
* Gets the navigation bar's background color.
|
|
73
|
-
*
|
|
74
|
-
* @example
|
|
75
|
-
* ```ts
|
|
76
|
-
* const color = await NavigationBar.getBackgroundColorAsync();
|
|
77
|
-
* ```
|
|
78
|
-
* @returns Current navigation bar color in hex format. Returns `#00000000` (transparent) on unsupported platforms (iOS, web).
|
|
79
|
-
*/
|
|
80
|
-
export async function getBackgroundColorAsync(): Promise<string> {
|
|
81
|
-
if (__DEV__) {
|
|
82
|
-
potentiallyWarnAboutEdgeToEdge();
|
|
83
|
-
}
|
|
84
|
-
if (Platform.OS !== 'android') {
|
|
85
|
-
console.warn('`getBackgroundColorAsync` is only available on Android');
|
|
86
|
-
return `#00000000`;
|
|
87
|
-
}
|
|
88
|
-
return await ExpoNavigationBar.getBackgroundColorAsync();
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
/**
|
|
92
|
-
* Changes the navigation bar's border color.
|
|
93
|
-
*
|
|
94
|
-
* @example
|
|
95
|
-
* ```ts
|
|
96
|
-
* NavigationBar.setBorderColorAsync("red");
|
|
97
|
-
* ```
|
|
98
|
-
* @param color Any valid [CSS 3 (SVG) color](http://www.w3.org/TR/css3-color/#svg-color).
|
|
34
|
+
* @platform android
|
|
99
35
|
*/
|
|
100
|
-
export
|
|
101
|
-
if (
|
|
102
|
-
|
|
36
|
+
export function setStyle(style: NavigationBarStyle) {
|
|
37
|
+
if (!canRunEdgeToEdgeMethods && Platform.OS === 'android') {
|
|
38
|
+
throw new Error(
|
|
39
|
+
'`setStyle` is only supported on Android when edge-to-edge is enabled. Enable edge-to-edge or use the `setButtonStyle` function instead.'
|
|
40
|
+
);
|
|
103
41
|
}
|
|
104
42
|
if (Platform.OS !== 'android') {
|
|
105
|
-
console.warn('`
|
|
43
|
+
console.warn('`setStyle` method is only available on Android');
|
|
106
44
|
return;
|
|
107
45
|
}
|
|
108
|
-
|
|
109
|
-
await ExpoNavigationBar.setBorderColorAsync(colorNumber);
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
/**
|
|
113
|
-
* Gets the navigation bar's top border color, also known as the "divider color".
|
|
114
|
-
*
|
|
115
|
-
* @example
|
|
116
|
-
* ```ts
|
|
117
|
-
* const color = await NavigationBar.getBorderColorAsync();
|
|
118
|
-
* ```
|
|
119
|
-
* @returns Navigation bar top border color in hex format. Returns `#00000000` (transparent) on unsupported platforms (iOS, web).
|
|
120
|
-
*/
|
|
121
|
-
export async function getBorderColorAsync(): Promise<string> {
|
|
122
|
-
if (__DEV__) {
|
|
123
|
-
potentiallyWarnAboutEdgeToEdge();
|
|
124
|
-
}
|
|
125
|
-
if (Platform.OS !== 'android') {
|
|
126
|
-
console.warn('`getBorderColorAsync` is only available on Android');
|
|
127
|
-
return `#00000000`;
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
return await ExpoNavigationBar.getBorderColorAsync();
|
|
46
|
+
SystemBars?.setStyle({ navigationBar: style });
|
|
131
47
|
}
|
|
132
48
|
|
|
133
49
|
/**
|
|
@@ -138,220 +54,23 @@ export async function getBorderColorAsync(): Promise<string> {
|
|
|
138
54
|
* NavigationBar.setVisibilityAsync("hidden");
|
|
139
55
|
* ```
|
|
140
56
|
* @param visibility Based on CSS visibility property.
|
|
57
|
+
* @platform android
|
|
141
58
|
*/
|
|
142
|
-
export async function setVisibilityAsync(visibility: NavigationBarVisibility)
|
|
143
|
-
if (__DEV__) {
|
|
144
|
-
potentiallyWarnAboutEdgeToEdge();
|
|
145
|
-
}
|
|
59
|
+
export async function setVisibilityAsync(visibility: NavigationBarVisibility) {
|
|
146
60
|
if (Platform.OS !== 'android') {
|
|
147
61
|
console.warn('`setVisibilityAsync` is only available on Android');
|
|
148
62
|
return;
|
|
149
63
|
}
|
|
150
|
-
await ExpoNavigationBar.setVisibilityAsync(visibility);
|
|
151
|
-
}
|
|
152
64
|
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
* @example
|
|
157
|
-
* ```ts
|
|
158
|
-
* const visibility = await NavigationBar.getVisibilityAsync("hidden");
|
|
159
|
-
* ```
|
|
160
|
-
* @returns Navigation bar's current visibility status. Returns `hidden` on unsupported platforms (iOS, web).
|
|
161
|
-
*/
|
|
162
|
-
export async function getVisibilityAsync(): Promise<NavigationBarVisibility> {
|
|
163
|
-
if (__DEV__) {
|
|
164
|
-
potentiallyWarnAboutEdgeToEdge();
|
|
165
|
-
}
|
|
166
|
-
if (Platform.OS !== 'android') {
|
|
167
|
-
console.warn('`getVisibilityAsync` is only available on Android');
|
|
168
|
-
return 'hidden';
|
|
65
|
+
if (canRunEdgeToEdgeMethods) {
|
|
66
|
+
// We know the SystemBars module is available, but typescript doesn't interpret it, so we have to use optional.
|
|
67
|
+
return SystemBars?.setHidden({ navigationBar: visibility === 'hidden' });
|
|
169
68
|
}
|
|
170
|
-
return ExpoNavigationBar.getVisibilityAsync();
|
|
171
|
-
}
|
|
172
69
|
|
|
173
|
-
|
|
174
|
-
* Changes the navigation bar's button colors between white (`light`) and a dark gray color (`dark`).
|
|
175
|
-
*
|
|
176
|
-
* @example
|
|
177
|
-
* ```ts
|
|
178
|
-
* NavigationBar.setButtonStyleAsync("light");
|
|
179
|
-
* ```
|
|
180
|
-
* @param style Dictates the color of the foreground element color.
|
|
181
|
-
*/
|
|
182
|
-
export async function setButtonStyleAsync(style: NavigationBarButtonStyle): Promise<void> {
|
|
183
|
-
if (__DEV__) {
|
|
184
|
-
potentiallyWarnAboutEdgeToEdge();
|
|
185
|
-
}
|
|
186
|
-
if (Platform.OS !== 'android') {
|
|
187
|
-
console.warn('`setButtonStyleAsync` is only available on Android');
|
|
188
|
-
return;
|
|
189
|
-
}
|
|
190
|
-
await ExpoNavigationBar.setButtonStyleAsync(style);
|
|
70
|
+
return await ExpoNavigationBar.setVisibilityAsync(visibility);
|
|
191
71
|
}
|
|
192
72
|
|
|
193
|
-
|
|
194
|
-
* Gets the navigation bar's button color styles.
|
|
195
|
-
*
|
|
196
|
-
* @example
|
|
197
|
-
* ```ts
|
|
198
|
-
* const style = await NavigationBar.getButtonStyleAsync();
|
|
199
|
-
* ```
|
|
200
|
-
* @returns Navigation bar foreground element color settings. Returns `light` on unsupported platforms (iOS, web).
|
|
201
|
-
*/
|
|
202
|
-
export async function getButtonStyleAsync(): Promise<NavigationBarButtonStyle> {
|
|
203
|
-
if (__DEV__) {
|
|
204
|
-
potentiallyWarnAboutEdgeToEdge();
|
|
205
|
-
}
|
|
206
|
-
if (Platform.OS !== 'android') {
|
|
207
|
-
console.warn('`getButtonStyleAsync` is only available on Android');
|
|
208
|
-
return 'light';
|
|
209
|
-
}
|
|
210
|
-
return await ExpoNavigationBar.getButtonStyleAsync();
|
|
211
|
-
}
|
|
212
|
-
|
|
213
|
-
/**
|
|
214
|
-
* Sets positioning method used for the navigation bar (and status bar).
|
|
215
|
-
* Setting position `absolute` will float the navigation bar above the content,
|
|
216
|
-
* whereas position `relative` will shrink the screen to inline the navigation bar.
|
|
217
|
-
*
|
|
218
|
-
* When drawing behind the status and navigation bars, ensure the safe area insets are adjusted accordingly.
|
|
219
|
-
*
|
|
220
|
-
* @example
|
|
221
|
-
* ```ts
|
|
222
|
-
* // enables edge-to-edge mode
|
|
223
|
-
* await NavigationBar.setPositionAsync('absolute')
|
|
224
|
-
* // transparent backgrounds to see through
|
|
225
|
-
* await NavigationBar.setBackgroundColorAsync('#ffffff00')
|
|
226
|
-
* ```
|
|
227
|
-
* @param position Based on CSS position property.
|
|
228
|
-
*/
|
|
229
|
-
export async function setPositionAsync(position: NavigationBarPosition): Promise<void> {
|
|
230
|
-
if (__DEV__) {
|
|
231
|
-
potentiallyWarnAboutEdgeToEdge();
|
|
232
|
-
}
|
|
233
|
-
if (Platform.OS !== 'android') {
|
|
234
|
-
console.warn('`setPositionAsync` is only available on Android');
|
|
235
|
-
return;
|
|
236
|
-
}
|
|
237
|
-
await ExpoNavigationBar.setPositionAsync(position);
|
|
238
|
-
}
|
|
239
|
-
|
|
240
|
-
/**
|
|
241
|
-
* Whether the navigation and status bars float above the app (absolute) or sit inline with it (relative).
|
|
242
|
-
* This value can be incorrect if `androidNavigationBar.visible` is used instead of the config plugin `position` property.
|
|
243
|
-
*
|
|
244
|
-
* This method is unstable because the position can be set via another native module and get out of sync.
|
|
245
|
-
* Alternatively, you can get the position by measuring the insets returned by `react-native-safe-area-context`.
|
|
246
|
-
*
|
|
247
|
-
* @example
|
|
248
|
-
* ```ts
|
|
249
|
-
* await NavigationBar.unstable_getPositionAsync()
|
|
250
|
-
* ```
|
|
251
|
-
* @returns Navigation bar positional rendering mode. Returns `relative` on unsupported platforms (iOS, web).
|
|
252
|
-
*/
|
|
253
|
-
export async function unstable_getPositionAsync(): Promise<NavigationBarPosition> {
|
|
254
|
-
if (__DEV__) {
|
|
255
|
-
potentiallyWarnAboutEdgeToEdge();
|
|
256
|
-
}
|
|
257
|
-
if (Platform.OS !== 'android') {
|
|
258
|
-
console.warn('`unstable_getPositionAsync` is only available on Android');
|
|
259
|
-
return 'relative';
|
|
260
|
-
}
|
|
261
|
-
return await ExpoNavigationBar.unstable_getPositionAsync();
|
|
262
|
-
}
|
|
263
|
-
|
|
264
|
-
/**
|
|
265
|
-
* Sets the behavior of the status bar and navigation bar when they are hidden and the user wants to reveal them.
|
|
266
|
-
*
|
|
267
|
-
* For example, if the navigation bar is hidden (`setVisibilityAsync(false)`) and the behavior
|
|
268
|
-
* is `'overlay-swipe'`, the user can swipe from the bottom of the screen to temporarily reveal the navigation bar.
|
|
269
|
-
*
|
|
270
|
-
* - `'overlay-swipe'`: Temporarily reveals the System UI after a swipe gesture (bottom or top) without insetting your App's content.
|
|
271
|
-
* - `'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.
|
|
272
|
-
* - `'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.
|
|
273
|
-
*
|
|
274
|
-
* @example
|
|
275
|
-
* ```ts
|
|
276
|
-
* await NavigationBar.setBehaviorAsync('overlay-swipe')
|
|
277
|
-
* ```
|
|
278
|
-
* @param behavior Dictates the interaction behavior of the navigation bar.
|
|
279
|
-
*/
|
|
280
|
-
export async function setBehaviorAsync(behavior: NavigationBarBehavior): Promise<void> {
|
|
281
|
-
if (__DEV__) {
|
|
282
|
-
potentiallyWarnAboutEdgeToEdge();
|
|
283
|
-
}
|
|
284
|
-
if (Platform.OS !== 'android') {
|
|
285
|
-
console.warn('`setBehaviorAsync` is only available on Android');
|
|
286
|
-
return;
|
|
287
|
-
}
|
|
288
|
-
return await ExpoNavigationBar.setBehaviorAsync(behavior);
|
|
289
|
-
}
|
|
290
|
-
|
|
291
|
-
/**
|
|
292
|
-
* Gets the behavior of the status and navigation bars when the user swipes or touches the screen.
|
|
293
|
-
*
|
|
294
|
-
* @example
|
|
295
|
-
* ```ts
|
|
296
|
-
* await NavigationBar.getBehaviorAsync()
|
|
297
|
-
* ```
|
|
298
|
-
* @returns Navigation bar interaction behavior. Returns `inset-touch` on unsupported platforms (iOS, web).
|
|
299
|
-
*/
|
|
300
|
-
export async function getBehaviorAsync(): Promise<NavigationBarBehavior> {
|
|
301
|
-
if (__DEV__) {
|
|
302
|
-
potentiallyWarnAboutEdgeToEdge();
|
|
303
|
-
}
|
|
304
|
-
if (Platform.OS !== 'android') {
|
|
305
|
-
console.warn('`getBehaviorAsync` is only available on Android');
|
|
306
|
-
return 'inset-touch';
|
|
307
|
-
}
|
|
308
|
-
return await ExpoNavigationBar.getBehaviorAsync();
|
|
309
|
-
}
|
|
310
|
-
|
|
311
|
-
/**
|
|
312
|
-
* React hook that statefully updates with the visibility of the system navigation bar.
|
|
313
|
-
*
|
|
314
|
-
* @example
|
|
315
|
-
* ```ts
|
|
316
|
-
* function App() {
|
|
317
|
-
* const visibility = NavigationBar.useVisibility()
|
|
318
|
-
* // React Component...
|
|
319
|
-
* }
|
|
320
|
-
* ```
|
|
321
|
-
* @returns Visibility of the navigation bar, `null` during async initialization.
|
|
322
|
-
*/
|
|
323
|
-
export function useVisibility(): NavigationBarVisibility | null {
|
|
324
|
-
if (__DEV__) {
|
|
325
|
-
potentiallyWarnAboutEdgeToEdge();
|
|
326
|
-
}
|
|
327
|
-
|
|
328
|
-
const [visibility, setVisible] = useState<NavigationBarVisibility | null>(null);
|
|
329
|
-
|
|
330
|
-
useEffect(() => {
|
|
331
|
-
let isMounted = true;
|
|
332
|
-
if (Platform.OS !== 'android') {
|
|
333
|
-
setVisible('hidden');
|
|
334
|
-
return;
|
|
335
|
-
}
|
|
336
|
-
getVisibilityAsync().then((visibility) => {
|
|
337
|
-
if (isMounted) {
|
|
338
|
-
setVisible(visibility);
|
|
339
|
-
}
|
|
340
|
-
});
|
|
341
|
-
|
|
342
|
-
const listener = addVisibilityListener(({ visibility }) => {
|
|
343
|
-
if (isMounted) {
|
|
344
|
-
setVisible(visibility);
|
|
345
|
-
}
|
|
346
|
-
});
|
|
347
|
-
|
|
348
|
-
return () => {
|
|
349
|
-
listener.remove();
|
|
350
|
-
isMounted = false;
|
|
351
|
-
};
|
|
352
|
-
}, []);
|
|
353
|
-
|
|
354
|
-
return visibility;
|
|
355
|
-
}
|
|
73
|
+
// MARK: existing expo-navigation-bar APIs
|
|
356
74
|
|
|
75
|
+
export * from './NativeNavigationBarWrapper';
|
|
357
76
|
export * from './NavigationBar.types';
|
|
@@ -34,3 +34,13 @@ export type NavigationBarVisibilityEvent = {
|
|
|
34
34
|
*/
|
|
35
35
|
rawVisibility: number;
|
|
36
36
|
};
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Navigation bar style.
|
|
40
|
+
*
|
|
41
|
+
* - `auto` will automatically adjust based on the current theme.
|
|
42
|
+
* - `light` a light navigation bar with dark content.
|
|
43
|
+
* - `dark` a dark navigation bar with light content.
|
|
44
|
+
* - `inverted` the bar colors are inverted in relation to the current theme.
|
|
45
|
+
*/
|
|
46
|
+
export type NavigationBarStyle = 'auto' | 'inverted' | 'light' | 'dark';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
13b4cdac9c46f9c494ef5db0b5ba29f2
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
1ea3b6db76bea250e5cd7b89d7c3245a6dc7af23
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
e3834a83af08d2ac35a648d529e05a41b8dbf9ea6300ad5caeb239c654b3a339
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
f68253a9db257b986df6907d81418395d811d806a6c7027600f7111e47b4210a46637dc10de8d90e95aa388b4956d28a8da11ce0d982d5144946169a805e9a8b
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
4382ed5025d7ff8a252b0ef941874d78
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
335a1d44d473e2fb6ff8a55f18f67d32369ab411
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
be727fe53d6413a1deb345f857faa48befb6d8407091b60d739c6356f94f6180
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
365332f2ed650f48359e66db7dffd47b7523e1d2ef9568037fed09af48792cacb05d8a4e79df13b3176d78f186ff3b34a3b3dd0e39ab0c7e661e5259c40d3ef4
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|