keyboard-coss
v1.0.6
Published
keyboard
Downloads
5
Readme
coss-keyboard
keyboard
Install
npm install coss-keyboard
npx cap sync
API
show()
hide()
setAccessoryBarVisible(...)
setScroll(...)
setStyle(...)
setResizeMode(...)
getResizeMode()
addListener('keyboardWillShow', ...)
addListener('keyboardDidShow', ...)
addListener('keyboardWillHide', ...)
addListener('keyboardDidHide', ...)
removeAllListeners()
- Interfaces
- Enums
show()
show() => any
Show the keyboard. This method is alpha and may have issues.
This method is only supported on Android.
Returns: any
Since: 1.0.0
hide()
hide() => any
Hide the keyboard.
Returns: any
Since: 1.0.0
setAccessoryBarVisible(...)
setAccessoryBarVisible(options: { isVisible: boolean; }) => any
Set whether the accessory bar should be visible on the keyboard. We recommend disabling the accessory bar for short forms (login, signup, etc.) to provide a cleaner UI.
This method is only supported on iPhone devices.
| Param | Type |
| ------------- | ------------------------------------ |
| options
| { isVisible: boolean; } |
Returns: any
Since: 1.0.0
setScroll(...)
setScroll(options: { isDisabled: boolean; }) => any
Programmatically enable or disable the WebView scroll.
This method is only supported on iOS.
| Param | Type |
| ------------- | ------------------------------------- |
| options
| { isDisabled: boolean; } |
Returns: any
Since: 1.0.0
setStyle(...)
setStyle(options: KeyboardStyleOptions) => any
Programmatically set the keyboard style.
This method is only supported on iOS.
| Param | Type |
| ------------- | --------------------------------------------------------------------- |
| options
| KeyboardStyleOptions |
Returns: any
Since: 1.0.0
setResizeMode(...)
setResizeMode(options: KeyboardResizeOptions) => any
Programmatically set the resize mode.
This method is only supported on iOS.
| Param | Type |
| ------------- | ----------------------------------------------------------------------- |
| options
| KeyboardResizeOptions |
Returns: any
Since: 1.0.0
getResizeMode()
getResizeMode() => any
Get the currently set resize mode.
This method is only supported on iOS.
Returns: any
Since: 4.0.0
addListener('keyboardWillShow', ...)
addListener(eventName: 'keyboardWillShow', listenerFunc: (info: KeyboardInfo) => void) => any
Listen for when the keyboard is about to be shown.
On Android keyboardWillShow and keyboardDidShow fire almost at the same time.
| Param | Type |
| ------------------ | ------------------------------------------------------------------------ |
| eventName
| 'keyboardWillShow' |
| listenerFunc
| (info: KeyboardInfo) => void |
Returns: any
Since: 1.0.0
addListener('keyboardDidShow', ...)
addListener(eventName: 'keyboardDidShow', listenerFunc: (info: KeyboardInfo) => void) => any
Listen for when the keyboard is shown.
On Android keyboardWillShow and keyboardDidShow fire almost at the same time.
| Param | Type |
| ------------------ | ------------------------------------------------------------------------ |
| eventName
| 'keyboardDidShow' |
| listenerFunc
| (info: KeyboardInfo) => void |
Returns: any
Since: 1.0.0
addListener('keyboardWillHide', ...)
addListener(eventName: 'keyboardWillHide', listenerFunc: () => void) => any
Listen for when the keyboard is about to be hidden.
On Android keyboardWillHide and keyboardDidHide fire almost at the same time.
| Param | Type |
| ------------------ | ------------------------------- |
| eventName
| 'keyboardWillHide' |
| listenerFunc
| () => void |
Returns: any
Since: 1.0.0
addListener('keyboardDidHide', ...)
addListener(eventName: 'keyboardDidHide', listenerFunc: () => void) => any
Listen for when the keyboard is hidden.
On Android keyboardWillHide and keyboardDidHide fire almost at the same time.
| Param | Type |
| ------------------ | ------------------------------ |
| eventName
| 'keyboardDidHide' |
| listenerFunc
| () => void |
Returns: any
Since: 1.0.0
removeAllListeners()
removeAllListeners() => any
Remove all native listeners for this plugin.
Returns: any
Since: 1.0.0
Interfaces
KeyboardStyleOptions
| Prop | Type | Description | Default | Since |
| ----------- | ------------------------------------------------------- | ---------------------- | ---------------------------------- | ----- |
| style
| KeyboardStyle | Style of the keyboard. | KeyboardStyle.Default | 1.0.0 |
KeyboardResizeOptions
| Prop | Type | Description | Since |
| ---------- | --------------------------------------------------------- | ------------------------------------------------------- | ----- |
| mode
| KeyboardResize | Mode used to resize elements when the keyboard appears. | 1.0.0 |
KeyboardInfo
| Prop | Type | Description | Since |
| -------------------- | ------------------- | ----------------------- | ----- |
| keyboardHeight
| number | Height of the heyboard. | 1.0.0 |
PluginListenerHandle
| Prop | Type |
| ------------ | ------------------------- |
| remove
| () => any |
Enums
KeyboardStyle
| Members | Value | Description | Since |
| ------------- | ---------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----- |
| Dark
| 'DARK' | Dark keyboard. | 1.0.0 |
| Light
| 'LIGHT' | Light keyboard. | 1.0.0 |
| Default
| 'DEFAULT' | On iOS 13 and newer the keyboard style is based on the device appearance. If the device is using Dark mode, the keyboard will be dark. If the device is using Light mode, the keyboard will be light. On iOS 12 the keyboard will be light. | 1.0.0 |
KeyboardResize
| Members | Value | Description | Since |
| ------------ | --------------------- | -------------------------------------------------------------------------------------------------------------------- | ----- |
| Body
| 'body' | Only the body
HTML element will be resized. Relative units are not affected, because the viewport does not change. | 1.0.0 |
| Ionic
| 'ionic' | Only the ion-app
HTML element will be resized. Use it only for Ionic Framework apps. | 1.0.0 |
| Native
| 'native' | The whole native Web View will be resized when the keyboard shows/hides. This affects the vh
relative unit. | 1.0.0 |
| None
| 'none' | Neither the app nor the Web View are resized. | 1.0.0 |