@capacitor/keyboard
Advanced tools
Comparing version 0.2.0 to 0.3.0
@@ -6,2 +6,19 @@ # Change Log | ||
# [0.3.0](https://github.com/ionic-team/capacitor-plugins/compare/@capacitor/keyboard@0.2.0...@capacitor/keyboard@0.3.0) (2020-12-20) | ||
### Bug Fixes | ||
* support deprecated types from Capacitor 2 ([#139](https://github.com/ionic-team/capacitor-plugins/issues/139)) ([2d7127a](https://github.com/ionic-team/capacitor-plugins/commit/2d7127a488e26f0287951921a6db47c49d817336)) | ||
* **keyboard:** remove deprecated warnings ([#122](https://github.com/ionic-team/capacitor-plugins/issues/122)) ([a6e207c](https://github.com/ionic-team/capacitor-plugins/commit/a6e207c47dfac14d6cbcaa2a942b7b04cae3dae8)) | ||
### Features | ||
* **keyboard:** add types for config files ([#115](https://github.com/ionic-team/capacitor-plugins/issues/115)) ([09bba16](https://github.com/ionic-team/capacitor-plugins/commit/09bba168242c26b3816ab5ff5b15f22531935fec)) | ||
# [0.2.0](https://github.com/ionic-team/capacitor-plugins/compare/@capacitor/keyboard@0.1.0...@capacitor/keyboard@0.2.0) (2020-12-02) | ||
@@ -8,0 +25,0 @@ |
@@ -133,3 +133,3 @@ { | ||
"docs": "", | ||
"type": "\"keyboardWillShow\"" | ||
"type": "'keyboardWillShow'" | ||
}, | ||
@@ -154,3 +154,3 @@ { | ||
], | ||
"slug": "addlistener" | ||
"slug": "addlistenerkeyboardwillshow-" | ||
}, | ||
@@ -164,3 +164,3 @@ { | ||
"docs": "", | ||
"type": "\"keyboardDidShow\"" | ||
"type": "'keyboardDidShow'" | ||
}, | ||
@@ -185,3 +185,3 @@ { | ||
], | ||
"slug": "addlistener" | ||
"slug": "addlistenerkeyboarddidshow-" | ||
}, | ||
@@ -195,3 +195,3 @@ { | ||
"docs": "", | ||
"type": "\"keyboardWillHide\"" | ||
"type": "'keyboardWillHide'" | ||
}, | ||
@@ -215,3 +215,3 @@ { | ||
], | ||
"slug": "addlistener" | ||
"slug": "addlistenerkeyboardwillhide-" | ||
}, | ||
@@ -225,3 +225,3 @@ { | ||
"docs": "", | ||
"type": "\"keyboardDidHide\"" | ||
"type": "'keyboardDidHide'" | ||
}, | ||
@@ -245,3 +245,3 @@ { | ||
], | ||
"slug": "addlistener" | ||
"slug": "addlistenerkeyboarddidhide-" | ||
}, | ||
@@ -430,3 +430,4 @@ { | ||
} | ||
] | ||
], | ||
"typeAliases": [] | ||
} |
import type { PluginListenerHandle } from '@capacitor/core'; | ||
declare module '@capacitor/cli' { | ||
interface PluginsConfig { | ||
Keyboard?: { | ||
/** | ||
* Configure the way the app is resized when the Keyboard appears. | ||
* | ||
* Only available on iOS. | ||
* | ||
* @since 1.0.0 | ||
* @default native | ||
*/ | ||
resize?: 'none' | 'native' | 'body' | 'ionic'; | ||
/** | ||
* Use the dark style keyboard instead of the regular one. | ||
* | ||
* Only available on iOS. | ||
* | ||
* @since 1.0.0 | ||
*/ | ||
style?: 'dark'; | ||
}; | ||
} | ||
} | ||
export interface KeyboardInfo { | ||
@@ -3,0 +26,0 @@ /** |
@@ -0,1 +1,2 @@ | ||
/// <reference types="@capacitor/cli" /> | ||
export var KeyboardStyle; | ||
@@ -2,0 +3,0 @@ (function (KeyboardStyle) { |
import type { KeyboardPlugin } from './definitions'; | ||
import { KeyboardResize, KeyboardStyle } from './definitions'; | ||
declare const Keyboard: KeyboardPlugin; | ||
export { Keyboard, KeyboardResize, KeyboardStyle }; | ||
export * from './definitions'; | ||
export { Keyboard }; |
import { registerPlugin } from '@capacitor/core'; | ||
import { KeyboardResize, KeyboardStyle } from './definitions'; | ||
const Keyboard = registerPlugin('Keyboard'); | ||
export { Keyboard, KeyboardResize, KeyboardStyle }; | ||
export * from './definitions'; | ||
export { Keyboard }; | ||
//# sourceMappingURL=index.js.map |
var capacitorKeyboard = (function (exports, core) { | ||
'use strict'; | ||
/// <reference types="@capacitor/cli" /> | ||
(function (KeyboardStyle) { | ||
@@ -5,0 +6,0 @@ /** |
{ | ||
"name": "@capacitor/keyboard", | ||
"version": "0.2.0", | ||
"version": "0.3.0", | ||
"description": "The Keyboard API provides keyboard display and visibility control, along with event tracking when the keyboard shows and hides.", | ||
@@ -46,6 +46,7 @@ "main": "dist/esm/index.js", | ||
"devDependencies": { | ||
"@capacitor/android": "^3.0.0-alpha.7", | ||
"@capacitor/core": "^3.0.0-alpha.7", | ||
"@capacitor/docgen": "^0.0.10", | ||
"@capacitor/ios": "^3.0.0-alpha.7", | ||
"@capacitor/android": "^3.0.0-alpha.10", | ||
"@capacitor/cli": "^3.0.0-alpha.9", | ||
"@capacitor/core": "^3.0.0-alpha.9", | ||
"@capacitor/docgen": "0.0.14", | ||
"@capacitor/ios": "^3.0.0-alpha.9", | ||
"@ionic/eslint-config": "^0.3.0", | ||
@@ -63,3 +64,3 @@ "@ionic/prettier-config": "~1.0.1", | ||
"peerDependencies": { | ||
"@capacitor/core": "^3.0.0-alpha.6" | ||
"@capacitor/core": "^3.0.0-alpha.9" | ||
}, | ||
@@ -82,3 +83,3 @@ "prettier": "@ionic/prettier-config", | ||
}, | ||
"gitHead": "78c1981920988ec84c17bbc61b1da1df9743571c" | ||
"gitHead": "481260d148b920b85755dd5f9b65df0bb0db4244" | ||
} |
@@ -12,2 +12,57 @@ # @capacitor/keyboard | ||
## Example | ||
```typescript | ||
import { Keyboard } from '@capacitor/keyboard'; | ||
Keyboard.addListener('keyboardWillShow', info => { | ||
console.log('keyboard will show with height:', info.keyboardHeight); | ||
}); | ||
Keyboard.addListener('keyboardDidShow', info => { | ||
console.log('keyboard did show with height:', info.keyboardHeight); | ||
}); | ||
Keyboard.addListener('keyboardWillHide', () => { | ||
console.log('keyboard will hide'); | ||
}); | ||
Keyboard.addListener('keyboardDidHide', () => { | ||
console.log('keyboard did hide'); | ||
}); | ||
``` | ||
## Configuration | ||
On iOS, the keyboard can be configured with the following options: | ||
- `resize`: Configures the way the app is resized when the keyboard appears. Allowed values are: | ||
- `none`: Neither the app nor the Web View are resized | ||
- `native`: (default) The whole native Web View will be resized when the keyboard shows/hides. This affects the `vh` relative unit. | ||
- `body`: Only the `<body>` HTML element will be resized. Relative units are not affected, because the viewport does not change. | ||
- `ionic`: Only the `<ion-app>` HTML element will be resized. Use it only for Ionic Framework apps. | ||
- `style`: If set to `dark` it will use dark style keyboard instead of the regular one. | ||
```json | ||
{ | ||
"pluginsConfig": { | ||
"Keyboard": { | ||
"resize": "body", | ||
"style": "dark" | ||
} | ||
} | ||
} | ||
``` | ||
## Compatibility with `cordova-plugin-ionic-keyboard` | ||
To maintain compatibility with | ||
[`cordova-plugin-ionic-keyboard`](https://github.com/ionic-team/cordova-plugin-ionic-keyboard), | ||
the following events also work with `window.addEventListener`: | ||
- `keyboardWillShow` | ||
- `keyboardDidShow` | ||
- `keyboardWillHide` | ||
- `keyboardDidHide` | ||
## API | ||
@@ -23,6 +78,6 @@ | ||
* [`setResizeMode(...)`](#setresizemode) | ||
* [`addListener(...)`](#addlistener) | ||
* [`addListener(...)`](#addlistener) | ||
* [`addListener(...)`](#addlistener) | ||
* [`addListener(...)`](#addlistener) | ||
* [`addListener('keyboardWillShow', ...)`](#addlistenerkeyboardwillshow-) | ||
* [`addListener('keyboardDidShow', ...)`](#addlistenerkeyboarddidshow-) | ||
* [`addListener('keyboardWillHide', ...)`](#addlistenerkeyboardwillhide-) | ||
* [`addListener('keyboardDidHide', ...)`](#addlistenerkeyboarddidhide-) | ||
* [`removeAllListeners()`](#removealllisteners) | ||
@@ -142,3 +197,3 @@ * [Interfaces](#interfaces) | ||
### addListener(...) | ||
### addListener('keyboardWillShow', ...) | ||
@@ -153,3 +208,3 @@ ```typescript | ||
| ------------------ | ------------------------------------------------------------------------ | | ||
| **`eventName`** | <code>"keyboardWillShow"</code> | | ||
| **`eventName`** | <code>'keyboardWillShow'</code> | | ||
| **`listenerFunc`** | <code>(info: <a href="#keyboardinfo">KeyboardInfo</a>) => void</code> | | ||
@@ -164,3 +219,3 @@ | ||
### addListener(...) | ||
### addListener('keyboardDidShow', ...) | ||
@@ -175,3 +230,3 @@ ```typescript | ||
| ------------------ | ------------------------------------------------------------------------ | | ||
| **`eventName`** | <code>"keyboardDidShow"</code> | | ||
| **`eventName`** | <code>'keyboardDidShow'</code> | | ||
| **`listenerFunc`** | <code>(info: <a href="#keyboardinfo">KeyboardInfo</a>) => void</code> | | ||
@@ -186,3 +241,3 @@ | ||
### addListener(...) | ||
### addListener('keyboardWillHide', ...) | ||
@@ -197,3 +252,3 @@ ```typescript | ||
| ------------------ | ------------------------------- | | ||
| **`eventName`** | <code>"keyboardWillHide"</code> | | ||
| **`eventName`** | <code>'keyboardWillHide'</code> | | ||
| **`listenerFunc`** | <code>() => void</code> | | ||
@@ -208,3 +263,3 @@ | ||
### addListener(...) | ||
### addListener('keyboardDidHide', ...) | ||
@@ -219,3 +274,3 @@ ```typescript | ||
| ------------------ | ------------------------------ | | ||
| **`eventName`** | <code>"keyboardDidHide"</code> | | ||
| **`eventName`** | <code>'keyboardDidHide'</code> | | ||
| **`listenerFunc`** | <code>() => void</code> | | ||
@@ -222,0 +277,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
58952
694
340
15