npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

spoken-keyboard

v4.0.2

Published

The Keyboard API provides keyboard display and visibility control, along with event tracking when the keyboard shows and hides.

Downloads

5

Readme

This is the Spoken fork of

@capacitor/keyboard

The Keyboard API provides keyboard display and visibility control, along with event tracking when the keyboard shows and hides.

The Spoken fork adds additional functionality to * setAccessoryBarVisible(...)

Install

npm install @capacitor/keyboard
npx cap sync

Example

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:

| Prop | Type | Description | Default | Since | | ------------------------ | --------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------- | ----- | | resize | KeyboardResize | Configure the way the app is resized when the Keyboard appears. Only available on iOS. | native | 1.0.0 | | style | KeyboardStyle | Override the keyboard style if your app doesn't support dark/light theme changes. If not set, the keyboard style will depend on the device appearance. Only available on iOS. | | 1.0.0 | | resizeOnFullScreen | boolean | There is an Android bug that prevents the keyboard from resizing the WebView when the app is in full screen (i.e. if StatusBar plugin is used to overlay the status bar). This setting, if set to true, add a workaround that resizes the WebView even when the app is in full screen. Only available for Android | | 1.1.0 |

Examples

In capacitor.config.json:

{
  "plugins": {
    "Keyboard": {
      "resize": "body",
      "style": "DARK",
      "resizeOnFullScreen": true
    }
  }
}

In capacitor.config.ts:

/// <reference types="@capacitor/keyboard" />

import { CapacitorConfig } from '@capacitor/cli';
import { KeyboardResize, KeyboardStyle } from '@capacitor/keyboard';

const config: CapacitorConfig = {
  plugins: {
    Keyboard: {
      resize: KeyboardResize.Body,
      style: KeyboardStyle.Dark,
      resizeOnFullScreen: true,
    },
  },
};

export default config;

Compatibility with cordova-plugin-ionic-keyboard

To maintain compatibility with cordova-plugin-ionic-keyboard, the following events also work with window.addEventListener:

  • keyboardWillShow
  • keyboardDidShow
  • keyboardWillHide
  • keyboardDidHide

API

show()

show() => Promise<void>

Show the keyboard. This method is alpha and may have issues.

This method is only supported on Android.

Since: 1.0.0


hide()

hide() => Promise<void>

Hide the keyboard.

Since: 1.0.0


setAccessoryBarVisible(...)

setAccessoryBarVisible(options: { isVisible: boolean; }) => Promise<void>

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; } |

Since: 1.0.0


setScroll(...)

setScroll(options: { isDisabled: boolean; }) => Promise<void>

Programmatically enable or disable the WebView scroll.

This method is only supported on iOS.

| Param | Type | | ------------- | ------------------------------------- | | options | { isDisabled: boolean; } |

Since: 1.0.0


setStyle(...)

setStyle(options: KeyboardStyleOptions) => Promise<void>

Programmatically set the keyboard style.

This method is only supported on iOS.

| Param | Type | | ------------- | --------------------------------------------------------------------- | | options | KeyboardStyleOptions |

Since: 1.0.0


setResizeMode(...)

setResizeMode(options: KeyboardResizeOptions) => Promise<void>

Programmatically set the resize mode.

This method is only supported on iOS.

| Param | Type | | ------------- | ----------------------------------------------------------------------- | | options | KeyboardResizeOptions |

Since: 1.0.0


addListener('keyboardWillShow', ...)

addListener(eventName: 'keyboardWillShow', listenerFunc: (info: KeyboardInfo) => void) => Promise<PluginListenerHandle> & PluginListenerHandle

Listen for when the keyboard is about to be shown.

| Param | Type | | ------------------ | ------------------------------------------------------------------------ | | eventName | 'keyboardWillShow' | | listenerFunc | (info: KeyboardInfo) => void |

Returns: Promise<PluginListenerHandle> & PluginListenerHandle

Since: 1.0.0


addListener('keyboardDidShow', ...)

addListener(eventName: 'keyboardDidShow', listenerFunc: (info: KeyboardInfo) => void) => Promise<PluginListenerHandle> & PluginListenerHandle

Listen for when the keyboard is shown.

| Param | Type | | ------------------ | ------------------------------------------------------------------------ | | eventName | 'keyboardDidShow' | | listenerFunc | (info: KeyboardInfo) => void |

Returns: Promise<PluginListenerHandle> & PluginListenerHandle

Since: 1.0.0


addListener('keyboardWillHide', ...)

addListener(eventName: 'keyboardWillHide', listenerFunc: () => void) => Promise<PluginListenerHandle> & PluginListenerHandle

Listen for when the keyboard is about to be hidden.

| Param | Type | | ------------------ | ------------------------------- | | eventName | 'keyboardWillHide' | | listenerFunc | () => void |

Returns: Promise<PluginListenerHandle> & PluginListenerHandle

Since: 1.0.0


addListener('keyboardDidHide', ...)

addListener(eventName: 'keyboardDidHide', listenerFunc: () => void) => Promise<PluginListenerHandle> & PluginListenerHandle

Listen for when the keyboard is hidden.

| Param | Type | | ------------------ | ------------------------------ | | eventName | 'keyboardDidHide' | | listenerFunc | () => void |

Returns: Promise<PluginListenerHandle> & PluginListenerHandle

Since: 1.0.0


removeAllListeners()

removeAllListeners() => Promise<void>

Remove all native listeners for this plugin.

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 |

PluginListenerHandle

| Prop | Type | | ------------ | ----------------------------------------- | | remove | () => Promise<void> |

KeyboardInfo

| Prop | Type | Description | Since | | -------------------- | ------------------- | ----------------------- | ----- | | keyboardHeight | number | Height of the heyboard. | 1.0.0 |

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 |