Skip to content

Commit 83cd977

Browse files
authored
fix(status-bar): add missing types (#2498) (#2500)
1 parent 7579317 commit 83cd977

File tree

2 files changed

+109
-9
lines changed

2 files changed

+109
-9
lines changed

status-bar/README.md

Lines changed: 72 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,10 @@ export default config;
111111
* [`hide(...)`](#hide)
112112
* [`getInfo()`](#getinfo)
113113
* [`setOverlaysWebView(...)`](#setoverlayswebview)
114+
* [`addListener('statusBarVisibilityChanged', ...)`](#addlistenerstatusbarvisibilitychanged-)
115+
* [`addListener('statusBarOverlayChanged', ...)`](#addlistenerstatusbaroverlaychanged-)
114116
* [Interfaces](#interfaces)
117+
* [Type Aliases](#type-aliases)
115118
* [Enums](#enums)
116119

117120
</docgen-index>
@@ -224,6 +227,48 @@ of the space underneath it.
224227
--------------------
225228

226229

230+
### addListener('statusBarVisibilityChanged', ...)
231+
232+
```typescript
233+
addListener(eventName: 'statusBarVisibilityChanged', listenerFunc: VisibilityChangeListener) => Promise<PluginListenerHandle>
234+
```
235+
236+
Listen for status bar visibility changes.
237+
Fired when hide or show methods get called.
238+
239+
| Param | Type |
240+
| ------------------ | ----------------------------------------------------------------------------- |
241+
| **`eventName`** | <code>'statusBarVisibilityChanged'</code> |
242+
| **`listenerFunc`** | <code><a href="#visibilitychangelistener">VisibilityChangeListener</a></code> |
243+
244+
**Returns:** <code>Promise&lt;<a href="#pluginlistenerhandle">PluginListenerHandle</a>&gt;</code>
245+
246+
**Since:** 7.0.0
247+
248+
--------------------
249+
250+
251+
### addListener('statusBarOverlayChanged', ...)
252+
253+
```typescript
254+
addListener(eventName: 'statusBarOverlayChanged', listenerFunc: OverlayChangeListener) => Promise<PluginListenerHandle>
255+
```
256+
257+
Listen for status bar overlay changes.
258+
Fired when setOverlaysWebView gets called.
259+
260+
| Param | Type |
261+
| ------------------ | ----------------------------------------------------------------------- |
262+
| **`eventName`** | <code>'statusBarOverlayChanged'</code> |
263+
| **`listenerFunc`** | <code><a href="#overlaychangelistener">OverlayChangeListener</a></code> |
264+
265+
**Returns:** <code>Promise&lt;<a href="#pluginlistenerhandle">PluginListenerHandle</a>&gt;</code>
266+
267+
**Since:** 7.0.0
268+
269+
--------------------
270+
271+
227272
### Interfaces
228273

229274

@@ -250,12 +295,13 @@ of the space underneath it.
250295

251296
#### StatusBarInfo
252297

253-
| Prop | Type | Description | Since |
254-
| -------------- | --------------------------------------- | ----------------------------------------- | ----- |
255-
| **`visible`** | <code>boolean</code> | Whether the status bar is visible or not. | 1.0.0 |
256-
| **`style`** | <code><a href="#style">Style</a></code> | The current status bar style. | 1.0.0 |
257-
| **`color`** | <code>string</code> | The current status bar color. | 1.0.0 |
258-
| **`overlays`** | <code>boolean</code> | Whether the statusbar is overlaid or not. | 1.0.0 |
298+
| Prop | Type | Description | Since |
299+
| -------------- | --------------------------------------- | ------------------------------------------ | ----- |
300+
| **`visible`** | <code>boolean</code> | Whether the status bar is visible or not. | 1.0.0 |
301+
| **`style`** | <code><a href="#style">Style</a></code> | The current status bar style. | 1.0.0 |
302+
| **`color`** | <code>string</code> | The current status bar color. | 1.0.0 |
303+
| **`overlays`** | <code>boolean</code> | Whether the status bar is overlaid or not. | 1.0.0 |
304+
| **`height`** | <code>number</code> | The height of the status bar. | 7.0.0 |
259305

260306

261307
#### SetOverlaysWebViewOptions
@@ -265,6 +311,26 @@ of the space underneath it.
265311
| **`overlay`** | <code>boolean</code> | Whether to overlay the status bar or not. | 1.0.0 |
266312

267313

314+
#### PluginListenerHandle
315+
316+
| Prop | Type |
317+
| ------------ | ----------------------------------------- |
318+
| **`remove`** | <code>() =&gt; Promise&lt;void&gt;</code> |
319+
320+
321+
### Type Aliases
322+
323+
324+
#### VisibilityChangeListener
325+
326+
<code>(info: <a href="#statusbarinfo">StatusBarInfo</a>): void</code>
327+
328+
329+
#### OverlayChangeListener
330+
331+
<code>(info: <a href="#statusbarinfo">StatusBarInfo</a>): void</code>
332+
333+
268334
### Enums
269335

270336

status-bar/src/definitions.ts

Lines changed: 37 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
/**
@@ -143,14 +145,21 @@ export interface StatusBarInfo {
143145
*
144146
* @since 1.0.0
145147
*/
146-
color?: string;
148+
color: string;
147149

148150
/**
149-
* Whether the statusbar is overlaid or not.
151+
* Whether the status bar is overlaid or not.
150152
*
151153
* @since 1.0.0
152154
*/
153-
overlays?: boolean;
155+
overlays: boolean;
156+
157+
/**
158+
* The height of the status bar.
159+
*
160+
* @since 7.0.0
161+
*/
162+
height: number;
154163
}
155164

156165
export interface SetOverlaysWebViewOptions {
@@ -162,6 +171,9 @@ export interface SetOverlaysWebViewOptions {
162171
overlay: boolean;
163172
}
164173

174+
export type VisibilityChangeListener = (info: StatusBarInfo) => void;
175+
export type OverlayChangeListener = (info: StatusBarInfo) => void;
176+
165177
export interface StatusBarPlugin {
166178
/**
167179
* Set the current style of the status bar.
@@ -209,6 +221,28 @@ export interface StatusBarPlugin {
209221
* @since 1.0.0
210222
*/
211223
setOverlaysWebView(options: SetOverlaysWebViewOptions): Promise<void>;
224+
225+
/**
226+
* Listen for status bar visibility changes.
227+
* Fired when hide or show methods get called.
228+
*
229+
* @since 7.0.0
230+
*/
231+
addListener(
232+
eventName: 'statusBarVisibilityChanged',
233+
listenerFunc: VisibilityChangeListener,
234+
): Promise<PluginListenerHandle>;
235+
236+
/**
237+
* Listen for status bar overlay changes.
238+
* Fired when setOverlaysWebView gets called.
239+
*
240+
* @since 7.0.0
241+
*/
242+
addListener(
243+
eventName: 'statusBarOverlayChanged',
244+
listenerFunc: OverlayChangeListener,
245+
): Promise<PluginListenerHandle>;
212246
}
213247

214248
/**

0 commit comments

Comments
 (0)