mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-11-29 17:51:46 +00:00
Add new definition for @expo/status-bar-height.
This commit is contained in:
@@ -0,0 +1,11 @@
|
||||
import StatusBarHeight from '@expo/status-bar-height';
|
||||
|
||||
const onChangeHeight = (height: number) => console.log(`New height: ${height}`);
|
||||
|
||||
StatusBarHeight.addEventListener(onChangeHeight);
|
||||
|
||||
StatusBarHeight.getAsync()
|
||||
.then((height: number) => console.log(`Current height: ${height}`))
|
||||
.catch((error: Error) => console.error('Threw an error in StatusBarHeight.getAsync():', error));
|
||||
|
||||
StatusBarHeight.removeEventListener(onChangeHeight);
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
// Type definitions for @expo/status-bar-height 0.0
|
||||
// Project: https://github.com/expo/status-bar-height
|
||||
// Definitions by: Janeene Beeforth <https://github.com/dawnmist>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
export type StatusBarHeightHandler = (height: number) => void;
|
||||
|
||||
export class StatusBarHeight {
|
||||
/**
|
||||
* Get the current status bar height
|
||||
*/
|
||||
getAsync(): Promise<number>;
|
||||
/**
|
||||
* Add 'willChange' event listener
|
||||
*/
|
||||
addEventListener(handler: StatusBarHeightHandler): void;
|
||||
/**
|
||||
* Remove 'willChange' event listener
|
||||
*/
|
||||
removeEventListener(handler: StatusBarHeightHandler): void;
|
||||
}
|
||||
|
||||
declare const StatusBarHeightStatic: StatusBarHeight;
|
||||
export default StatusBarHeightStatic;
|
||||
@@ -0,0 +1,29 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"dom",
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"paths": {
|
||||
"@expo/status-bar-height": [
|
||||
"expo__status-bar-height"
|
||||
]
|
||||
},
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"expo__status-bar-height-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Reference in New Issue
Block a user