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

cordova-plugin-nativeinput

v0.0.1

Published

Add Native Input Field below the WebView that contains: leftButton - inputField - rightButton

Downloads

3

Readme

forked from AppGyver Native Input Plugin

This plugin renders a native view (panel) at the bottom of the webview that contains: | leftButton - inputField - rightButton |

This allows for apps with chat views to have a better user experience where the input field is native and moves up and down with soft-keyboard.

All components can be styled using css:

/*default values*/

/*default css class for the inputField*/
.nativeInput {
  background-color: white;
  color:black;
}

/*default css class for the panel */
.nativeInput-panel {
  background-color: white;
}

/*default class for the left button */
.nativeInput-leftButton {
  background-color: whitesmoke;
}

.nativeInput-leftButton:pressed {
  background-color: #C0C0C0;
}

/*default class for the right button */
.nativeInput-rightButton {
  background-color: whitesmoke;
}

.nativeInput-rightButton:pressed{
  background-color: #C0C0C0;
}

Usage

cordova.plugins.NativeInput.show(params)

params = {
      leftButton:{
        styleCSS: 'text:Up;color:blue;background-color:gray;'
      },
      rightButton: {
        styleClass: 'myRightButtonClass',
        cssId: 'myRightButton'
      },
      panel: {
        styleClass: 'grey-panel'
      },
      input:{
        placeHolder: 'Type your message here',
        type: 'normal',
        lines: 1,
        styleClass: 'myInputClass'
      }
 }

 cordova.plugins.NativeInput.show(params);

leftButton / rightButton

There are the buttons that can be displayed at the left and/or right of the input field. You can specify the native css using a class, id or in-line css.

{
  styleId:'',
  styleClass:'',
  styleCSS:''
}

When one of the buttons is tapped the event can be handled using:

cordova.plugins.NativeInput.onButtonAction(function(side){
  if("left" === side){
    console.log("left button tapped");
  }
  if("right" === side){
    console.log("right button tapped");
  }
});

panel

This is the panel that goes behind the input field and buttons. You can use css to configure it's look and feel. The default style is with white background.

input

The actual input field. You can use css to configure it's look and feel (styleId, styleClass and styleCSS).

You can also configure the following options:

  • type - string - Defines the behaviour of the input field and the soft keyboard. Possible values: ('uri', 'normal', 'email', 'number')

  • placeHolder - Text that appears in the input field while it is empty.

  • lines - (Android Only) Number of lines that the input field will support. When you specify 1 the input field is confifure as single line. When lines > 1 the input field is configure as mult-line and will grow in size as the user adds more lines to the text.

cordova.plugins.NativeInput.hide()

Hide the whole panel including: buttons, input field and etc.

cordova.plugins.NativeInput.hide();

cordova.plugins.NativeInput.onKeyboardAction(autoCloseKeyboard, handler);

  • autoCloseKeyboard - If the keyboard should be closed after the "action button" is tapped.
cordova.plugins.NativeInput.onKeyboardAction(true, function(action){
  ...
});
  • autoCloseKeyboard: When true it will close the keyboard after any keyboard action is triggered.
  • handler: The handle function can be called multiple times when a keyboard action has occurred. The handler function receives a parameter action with the possible values: done, go, next, send, newline

cordova.plugins.NativeInput.onButtonAction(handler);

cordova.plugins.NativeInput.onButtonAction(function(side){
  if("left" === side){
    console.log("left button tapped");
  }
  if("right" === side){
    console.log("right button tapped");
  }
});

The handler function can be called multiple fimes when a button is tapped. It receives a parameter side with the possible values: left, right

cordova.plugins.NativeInput.closeKeyboard()

Close the soft keyboard.

cordova.plugins.NativeInput.closeKeyboard();

cordova.plugins.NativeInput.onChange(handler)

cordova.plugins.NativeInput.onChange(function(value){
  ... //do something with the new value
});

The handler function will be called multiples times when the content of the input field changes.

cordova.plugins.NativeInput.getValue(handler)

cordova.plugins.NativeInput.getValue(function(value){
  ... //do something with the value
});

The handler function will be called once with the current value of the input field.