Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
78 changes: 72 additions & 6 deletions status-bar/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,10 @@ export default config;
* [`hide(...)`](#hide)
* [`getInfo()`](#getinfo)
* [`setOverlaysWebView(...)`](#setoverlayswebview)
* [`addListener('statusBarVisibilityChanged', ...)`](#addlistenerstatusbarvisibilitychanged-)
* [`addListener('statusBarOverlayChanged', ...)`](#addlistenerstatusbaroverlaychanged-)
* [Interfaces](#interfaces)
* [Type Aliases](#type-aliases)
* [Enums](#enums)

</docgen-index>
Expand Down Expand Up @@ -243,6 +246,48 @@ Not available on Android 15+.
--------------------


### addListener('statusBarVisibilityChanged', ...)

```typescript
addListener(eventName: 'statusBarVisibilityChanged', listenerFunc: VisibilityChangeListener) => Promise<PluginListenerHandle>
```

Listen for status bar visibility changes.
Fired when hide or show methods get called.

| Param | Type |
| ------------------ | ----------------------------------------------------------------------------- |
| **`eventName`** | <code>'statusBarVisibilityChanged'</code> |
| **`listenerFunc`** | <code><a href="#visibilitychangelistener">VisibilityChangeListener</a></code> |

**Returns:** <code>Promise&lt;<a href="#pluginlistenerhandle">PluginListenerHandle</a>&gt;</code>

**Since:** 7.0.0

--------------------


### addListener('statusBarOverlayChanged', ...)

```typescript
addListener(eventName: 'statusBarOverlayChanged', listenerFunc: OverlayChangeListener) => Promise<PluginListenerHandle>
```

Listen for status bar overlay changes.
Fired when setOverlaysWebView gets called.

| Param | Type |
| ------------------ | ----------------------------------------------------------------------- |
| **`eventName`** | <code>'statusBarOverlayChanged'</code> |
| **`listenerFunc`** | <code><a href="#overlaychangelistener">OverlayChangeListener</a></code> |

**Returns:** <code>Promise&lt;<a href="#pluginlistenerhandle">PluginListenerHandle</a>&gt;</code>

**Since:** 7.0.0

--------------------


### Interfaces


Expand All @@ -269,12 +314,13 @@ Not available on Android 15+.

#### StatusBarInfo

| Prop | Type | Description | Since |
| -------------- | --------------------------------------- | ----------------------------------------- | ----- |
| **`visible`** | <code>boolean</code> | Whether the status bar is visible or not. | 1.0.0 |
| **`style`** | <code><a href="#style">Style</a></code> | The current status bar style. | 1.0.0 |
| **`color`** | <code>string</code> | The current status bar color. | 1.0.0 |
| **`overlays`** | <code>boolean</code> | Whether the statusbar is overlaid or not. | 1.0.0 |
| Prop | Type | Description | Since |
| -------------- | --------------------------------------- | ------------------------------------------ | ----- |
| **`visible`** | <code>boolean</code> | Whether the status bar is visible or not. | 1.0.0 |
| **`style`** | <code><a href="#style">Style</a></code> | The current status bar style. | 1.0.0 |
| **`color`** | <code>string</code> | The current status bar color. | 1.0.0 |
| **`overlays`** | <code>boolean</code> | Whether the status bar is overlaid or not. | 1.0.0 |
| **`height`** | <code>number</code> | The height of the status bar. | 7.0.0 |


#### SetOverlaysWebViewOptions
Expand All @@ -284,6 +330,26 @@ Not available on Android 15+.
| **`overlay`** | <code>boolean</code> | Whether to overlay the status bar or not. | 1.0.0 |


#### PluginListenerHandle

| Prop | Type |
| ------------ | ----------------------------------------- |
| **`remove`** | <code>() =&gt; Promise&lt;void&gt;</code> |


### Type Aliases


#### VisibilityChangeListener

<code>(info: <a href="#statusbarinfo">StatusBarInfo</a>): void</code>


#### OverlayChangeListener

<code>(info: <a href="#statusbarinfo">StatusBarInfo</a>): void</code>


### Enums


Expand Down
37 changes: 34 additions & 3 deletions status-bar/src/definitions.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
/// <reference types="@capacitor/cli" />

import type { PluginListenerHandle } from '@capacitor/core';

declare module '@capacitor/cli' {
export interface PluginsConfig {
/**
Expand Down Expand Up @@ -141,14 +143,21 @@ export interface StatusBarInfo {
*
* @since 1.0.0
*/
color?: string;
color: string;

/**
* Whether the statusbar is overlaid or not.
* Whether the status bar is overlaid or not.
*
* @since 1.0.0
*/
overlays?: boolean;
overlays: boolean;

/**
* The height of the status bar.
*
* @since 7.0.0
*/
height: number;
}

export interface SetOverlaysWebViewOptions {
Expand All @@ -160,6 +169,9 @@ export interface SetOverlaysWebViewOptions {
overlay: boolean;
}

export type VisibilityChangeListener = (info: StatusBarInfo) => void;
export type OverlayChangeListener = (info: StatusBarInfo) => void;

export interface StatusBarPlugin {
/**
* Set the current style of the status bar.
Expand Down Expand Up @@ -210,6 +222,25 @@ export interface StatusBarPlugin {
* @since 1.0.0
*/
setOverlaysWebView(options: SetOverlaysWebViewOptions): Promise<void>;

/**
* Listen for status bar visibility changes.
* Fired when hide or show methods get called.
*
* @since 7.0.0
*/
addListener(
eventName: 'statusBarVisibilityChanged',
listenerFunc: VisibilityChangeListener,
): Promise<PluginListenerHandle>;

/**
* Listen for status bar overlay changes.
* Fired when setOverlaysWebView gets called.
*
* @since 7.0.0
*/
addListener(eventName: 'statusBarOverlayChanged', listenerFunc: OverlayChangeListener): Promise<PluginListenerHandle>;
}

/**
Expand Down
Loading