Skip to content

Commit aa683d8

Browse files
authored
fix(status-bar): add missing types (#2498)
1 parent c0a3bc4 commit aa683d8

File tree

2 files changed

+106
-9
lines changed

2 files changed

+106
-9
lines changed

status-bar/README.md

Lines changed: 72 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,10 @@ export default config;
127127
* [`hide(...)`](#hide)
128128
* [`getInfo()`](#getinfo)
129129
* [`setOverlaysWebView(...)`](#setoverlayswebview)
130+
* [`addListener('statusBarVisibilityChanged', ...)`](#addlistenerstatusbarvisibilitychanged-)
131+
* [`addListener('statusBarOverlayChanged', ...)`](#addlistenerstatusbaroverlaychanged-)
130132
* [Interfaces](#interfaces)
133+
* [Type Aliases](#type-aliases)
131134
* [Enums](#enums)
132135

133136
</docgen-index>
@@ -243,6 +246,48 @@ Not available on Android 15+.
243246
--------------------
244247

245248

249+
### addListener('statusBarVisibilityChanged', ...)
250+
251+
```typescript
252+
addListener(eventName: 'statusBarVisibilityChanged', listenerFunc: VisibilityChangeListener) => Promise<PluginListenerHandle>
253+
```
254+
255+
Listen for status bar visibility changes.
256+
Fired when hide or show methods get called.
257+
258+
| Param | Type |
259+
| ------------------ | ----------------------------------------------------------------------------- |
260+
| **`eventName`** | <code>'statusBarVisibilityChanged'</code> |
261+
| **`listenerFunc`** | <code><a href="#visibilitychangelistener">VisibilityChangeListener</a></code> |
262+
263+
**Returns:** <code>Promise&lt;<a href="#pluginlistenerhandle">PluginListenerHandle</a>&gt;</code>
264+
265+
**Since:** 7.0.0
266+
267+
--------------------
268+
269+
270+
### addListener('statusBarOverlayChanged', ...)
271+
272+
```typescript
273+
addListener(eventName: 'statusBarOverlayChanged', listenerFunc: OverlayChangeListener) => Promise<PluginListenerHandle>
274+
```
275+
276+
Listen for status bar overlay changes.
277+
Fired when setOverlaysWebView gets called.
278+
279+
| Param | Type |
280+
| ------------------ | ----------------------------------------------------------------------- |
281+
| **`eventName`** | <code>'statusBarOverlayChanged'</code> |
282+
| **`listenerFunc`** | <code><a href="#overlaychangelistener">OverlayChangeListener</a></code> |
283+
284+
**Returns:** <code>Promise&lt;<a href="#pluginlistenerhandle">PluginListenerHandle</a>&gt;</code>
285+
286+
**Since:** 7.0.0
287+
288+
--------------------
289+
290+
246291
### Interfaces
247292

248293

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

270315
#### StatusBarInfo
271316

272-
| Prop | Type | Description | Since |
273-
| -------------- | --------------------------------------- | ----------------------------------------- | ----- |
274-
| **`visible`** | <code>boolean</code> | Whether the status bar is visible or not. | 1.0.0 |
275-
| **`style`** | <code><a href="#style">Style</a></code> | The current status bar style. | 1.0.0 |
276-
| **`color`** | <code>string</code> | The current status bar color. | 1.0.0 |
277-
| **`overlays`** | <code>boolean</code> | Whether the statusbar is overlaid or not. | 1.0.0 |
317+
| Prop | Type | Description | Since |
318+
| -------------- | --------------------------------------- | ------------------------------------------ | ----- |
319+
| **`visible`** | <code>boolean</code> | Whether the status bar is visible or not. | 1.0.0 |
320+
| **`style`** | <code><a href="#style">Style</a></code> | The current status bar style. | 1.0.0 |
321+
| **`color`** | <code>string</code> | The current status bar color. | 1.0.0 |
322+
| **`overlays`** | <code>boolean</code> | Whether the status bar is overlaid or not. | 1.0.0 |
323+
| **`height`** | <code>number</code> | The height of the status bar. | 7.0.0 |
278324

279325

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

286332

333+
#### PluginListenerHandle
334+
335+
| Prop | Type |
336+
| ------------ | ----------------------------------------- |
337+
| **`remove`** | <code>() =&gt; Promise&lt;void&gt;</code> |
338+
339+
340+
### Type Aliases
341+
342+
343+
#### VisibilityChangeListener
344+
345+
<code>(info: <a href="#statusbarinfo">StatusBarInfo</a>): void</code>
346+
347+
348+
#### OverlayChangeListener
349+
350+
<code>(info: <a href="#statusbarinfo">StatusBarInfo</a>): void</code>
351+
352+
287353
### Enums
288354

289355

status-bar/src/definitions.ts

Lines changed: 34 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
/// <reference types="@capacitor/cli" />
22

3+
import type { PluginListenerHandle } from '@capacitor/core';
4+
35
declare module '@capacitor/cli' {
46
export interface PluginsConfig {
57
/**
@@ -141,14 +143,21 @@ export interface StatusBarInfo {
141143
*
142144
* @since 1.0.0
143145
*/
144-
color?: string;
146+
color: string;
145147

146148
/**
147-
* Whether the statusbar is overlaid or not.
149+
* Whether the status bar is overlaid or not.
148150
*
149151
* @since 1.0.0
150152
*/
151-
overlays?: boolean;
153+
overlays: boolean;
154+
155+
/**
156+
* The height of the status bar.
157+
*
158+
* @since 7.0.0
159+
*/
160+
height: number;
152161
}
153162

154163
export interface SetOverlaysWebViewOptions {
@@ -160,6 +169,9 @@ export interface SetOverlaysWebViewOptions {
160169
overlay: boolean;
161170
}
162171

172+
export type VisibilityChangeListener = (info: StatusBarInfo) => void;
173+
export type OverlayChangeListener = (info: StatusBarInfo) => void;
174+
163175
export interface StatusBarPlugin {
164176
/**
165177
* Set the current style of the status bar.
@@ -210,6 +222,25 @@ export interface StatusBarPlugin {
210222
* @since 1.0.0
211223
*/
212224
setOverlaysWebView(options: SetOverlaysWebViewOptions): Promise<void>;
225+
226+
/**
227+
* Listen for status bar visibility changes.
228+
* Fired when hide or show methods get called.
229+
*
230+
* @since 7.0.0
231+
*/
232+
addListener(
233+
eventName: 'statusBarVisibilityChanged',
234+
listenerFunc: VisibilityChangeListener,
235+
): Promise<PluginListenerHandle>;
236+
237+
/**
238+
* Listen for status bar overlay changes.
239+
* Fired when setOverlaysWebView gets called.
240+
*
241+
* @since 7.0.0
242+
*/
243+
addListener(eventName: 'statusBarOverlayChanged', listenerFunc: OverlayChangeListener): Promise<PluginListenerHandle>;
213244
}
214245

215246
/**

0 commit comments

Comments
 (0)