@mauricewegner/capacitor-navigation-bar
v2.0.3
Published
Capacitor Plugin for Navigation Bar
Downloads
1,020
Maintainers
Readme
Install
npm install @mauricewegner/capacitor-navigation-bar
npx cap sync
Configuration
No configuration required for this plugin.
API
show()
hide()
setColor(...)
setTransparency(...)
getColor()
addListener(NavigationBarPluginEvents.SHOW, ...)
addListener(NavigationBarPluginEvents.HIDE, ...)
addListener(NavigationBarPluginEvents.COLOR_CHANGE, ...)
- Interfaces
- Enums
show()
show() => Promise<void>
Display the navigation bar.
hide()
hide() => Promise<void>
Hide the navigation bar.
setColor(...)
setColor(options: ColorParameters) => Promise<void>
Change the color of the navigation bar. *Support alpha hexadecimal numbers.
| Param | Type |
| ------------- | ----------------------------------------------------------- |
| options
| ColorParameters |
setTransparency(...)
setTransparency(options: { isTransparent: boolean; }) => Promise<void>
Set the Transparency
| Param | Type |
| ------------- | ---------------------------------------- |
| options
| { isTransparent: boolean; } |
getColor()
getColor() => Promise<{ color: string; }>
Gets the current color of the navigation bar in Hexadecimal.
Returns: Promise<{ color: string; }>
addListener(NavigationBarPluginEvents.SHOW, ...)
addListener(event: NavigationBarPluginEvents.SHOW, listenerFunc: () => void) => PluginListenerHandle
Event fired after navigation bar is displayed
| Param | Type | Description |
| ------------------ | ------------------------------------------------------------------------------------ | ----------- |
| event
| NavigationBarPluginEvents.SHOW | The event |
| listenerFunc
| () => void | Callback |
Returns: PluginListenerHandle
addListener(NavigationBarPluginEvents.HIDE, ...)
addListener(event: NavigationBarPluginEvents.HIDE, listenerFunc: () => void) => PluginListenerHandle
Event fired after navigation bar is hidden
| Param | Type | Description |
| ------------------ | ------------------------------------------------------------------------------------ | ----------- |
| event
| NavigationBarPluginEvents.HIDE | The event |
| listenerFunc
| () => void | Callback |
Returns: PluginListenerHandle
addListener(NavigationBarPluginEvents.COLOR_CHANGE, ...)
addListener(event: NavigationBarPluginEvents.COLOR_CHANGE, listenerFunc: (returnObject: { color: string; }) => void) => PluginListenerHandle
Event fired after navigation bar color is changed
| Param | Type | Description |
| ------------------ | -------------------------------------------------------------------------------------------- | ----------- |
| event
| NavigationBarPluginEvents.COLOR_CHANGE | The event |
| listenerFunc
| (returnObject: { color: string; }) => void | Callback |
Returns: PluginListenerHandle
Interfaces
ColorParameters
| Prop | Type | Description |
| ----------------- | -------------------- | ------------------------------------------------------------------------- |
| color
| string | Sets the new color of the navigation bar. |
| darkButtons
| boolean | Sets whether the default navigation bar buttons should be black or white. |
PluginListenerHandle
| Prop | Type |
| ------------ | ----------------------------------------- |
| remove
| () => Promise<void> |
Enums
NavigationBarPluginEvents
| Members | Value | Description |
| ------------------ | ---------------------------- | -------------------------------------------- |
| SHOW
| 'onShow' | Called after the navigation bar is displayed |
| HIDE
| 'onHide' | Called after navigation bar is hidden |
| COLOR_CHANGE
| 'onColorChange' | Called after navigation bar color is changed |