Add new definition for @expo/status-bar-height.

This commit is contained in:
Janeene Beeforth
2018-06-08 22:55:50 +10:00
parent ebadb7272e
commit c790d201ff
4 changed files with 65 additions and 0 deletions
@@ -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
View File
@@ -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" }