expo-navigation-bar 4.0.4 → 4.0.6
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 +8 -0
- package/android/build.gradle +2 -2
- package/build/NavigationBar.js.map +1 -1
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -10,6 +10,14 @@
|
|
|
10
10
|
|
|
11
11
|
### 💡 Others
|
|
12
12
|
|
|
13
|
+
## 4.0.6 — 2024-12-10
|
|
14
|
+
|
|
15
|
+
_This version does not introduce any user-facing changes._
|
|
16
|
+
|
|
17
|
+
## 4.0.5 — 2024-11-29
|
|
18
|
+
|
|
19
|
+
_This version does not introduce any user-facing changes._
|
|
20
|
+
|
|
13
21
|
## 4.0.4 — 2024-11-22
|
|
14
22
|
|
|
15
23
|
_This version does not introduce any user-facing changes._
|
package/android/build.gradle
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
apply plugin: 'com.android.library'
|
|
2
2
|
|
|
3
3
|
group = 'host.exp.exponent'
|
|
4
|
-
version = '4.0.
|
|
4
|
+
version = '4.0.6'
|
|
5
5
|
|
|
6
6
|
def expoModulesCorePlugin = new File(project(":expo-modules-core").projectDir.absolutePath, "ExpoModulesCorePlugin.gradle")
|
|
7
7
|
apply from: expoModulesCorePlugin
|
|
@@ -14,7 +14,7 @@ android {
|
|
|
14
14
|
namespace "expo.modules.navigationbar"
|
|
15
15
|
defaultConfig {
|
|
16
16
|
versionCode 1
|
|
17
|
-
versionName '4.0.
|
|
17
|
+
versionName '4.0.6'
|
|
18
18
|
}
|
|
19
19
|
}
|
|
20
20
|
|
|
@@ -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,EAA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MAAM,iBAAiB,CAAC,gBAAgB,EAAE,CAAC;AACpD,CAAC;AAED;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,aAAa;IAC3B,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,CAAC;YAC9B,UAAU,CAAC,QAAQ,CAAC,CAAC;YACrB,OAAO;QACT,CAAC;QACD,kBAAkB,EAAE,CAAC,IAAI,CAAC,CAAC,UAAU,EAAE,EAAE;YACvC,IAAI,SAAS,EAAE,CAAC;gBACd,UAAU,CAAC,UAAU,CAAC,CAAC;YACzB,CAAC;QACH,CAAC,CAAC,CAAC;QAEH,MAAM,QAAQ,GAAG,qBAAqB,CAAC,CAAC,EAAE,UAAU,EAAE,EAAE,EAAE;YACxD,IAAI,SAAS,EAAE,CAAC;gBACd,UAAU,CAAC,UAAU,CAAC,CAAC;YACzB,CAAC;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 { type ColorValue, 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: ColorValue): 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<ColorValue> {\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: ColorValue): 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<ColorValue> {\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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E,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 { type ColorValue, 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: ColorValue): 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<ColorValue> {\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: ColorValue): 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<ColorValue> {\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"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "expo-navigation-bar",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.6",
|
|
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,7 +34,7 @@
|
|
|
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.
|
|
37
|
+
"@react-native/normalize-colors": "0.76.5",
|
|
38
38
|
"debug": "^4.3.2"
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
@@ -46,5 +46,5 @@
|
|
|
46
46
|
"react": "*",
|
|
47
47
|
"react-native": "*"
|
|
48
48
|
},
|
|
49
|
-
"gitHead": "
|
|
49
|
+
"gitHead": "1faceb8d22bebee4571ef3a2f9578bec33dc26b1"
|
|
50
50
|
}
|