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

react-native-numpad

v0.3.0

Published

A simple React Native number pad for quickly updating multiple number inputs.

Downloads

143

Readme

React Native Numpad

A simple React Native number pad for quickly updating multiple number inputs.

npm version runs with expo

  • No Dependencies
  • ✅ iOS
  • ✅ Android
  • ✅ React Native Web
  • ✅ JS-Only (No Native Code / No Linking Necessary)

Screen Recording

Demo 👉 Expo Snack

Install

yarn add react-native-numpad

Use Cases

  • Splitting expenses
  • Forms with multiple number inputs
  • Spreadsheets
  • Calculators

Usage

import React from 'react';
import NumberPad, { Input, Display } from './index';

export default () => (
  <NumberPad>
    <Display key={0} cursor value={1.0} />
    <Display key={1} cursor value={2.5} />
    <Input />
  </NumberPad>
);

Custom Icons

import React from 'react';
import NumberPad, { Input, Display } from './index';
import { Ionicons } from '@expo/vector-icons';

export default () => (
  <NumberPad>
    <Display key={0} cursor value={1.0} />
    <Display key={1} cursor value={2.5} />
    <Input
      backspaceIcon={<Ionicons icon="ios-backspace" {...Input.iconStyle} />}
      hideIcon={<Ionicons icon="ios-arrow-down" {...Input.iconStyle} />}
    />
  </NumberPad>
);

API

Under the hood, react-native-numpad uses the React Context API to link the number inputs (the <Display>s) to the number pad (the <Input>).

<NumberPad> Component

The <NumberPad> component is a HOC (Higher Order Component) that does not accept any props besides children. It creates a reactNativeNumpad context that listens for press events on the number inputs, opens the number input when it detects a press, and then updates the input values when the user presses on the number buttons in the number pad.

<Display> Component

The <Display> is the number pad's equivalent of React Native's <TextInput> component. It is a controlled component that, when pressed, opens the number pad.

| Prop | Description | Default | | -------------------------- | ------------------------------------------------------------------------------------------------ | ------- | | value | Current value of the input (number only) | None | | style | Any valid style object for <TouchableOpacity> | None | | textStyle | Any valid style object for a <Text> component | None | | activeStyle | Any valid style object for a <Text> component | None | | invalidTextStyle | Any valid style object for a <Text> component | None | | placeholderTextStyle | Any valid style object for a <Text> component | None | | cursorStyle | Any valid style object for a <View> component | None | | blinkOnStyle | Any valid style object for a <View> component | None | | blinkOffStyle | Any valid style object for a <View> component | None | | onChange | An event handler function that receives the new value (number) as an argument | None | | cursor | Whether or not to show the cursor when the input is focused (boolean) | true | | autofocus | Whether or not to autofocus the input when the component is loaded (boolean) | false |

<Input> Component

The <Input> a custom number pad keyboard that, unlike the native keyboard, does not minimize when the user presses on a new number input if it is already open. It is stylable and easy to customize.

| Prop | Description | Default | | ------------------- | ---------------------------------------------------------------------------------------------------------------- | ------------------------ | | height | Height of the number pad | 270 | | position | How the number pad will be positioned | 'absolute' | 'relative' | | style | Any valid style object for a <View> component (Animated.View, actually) | None | | backspaceIcon | An Icon element (eg from react-native-vector-icons or @expo/vector-icons) | None | | hideIcon | An Icon element (eg from react-native-vector-icons or @expo/vector-icons) | None | | onWillHide | Called just before the number pad will hide | None | | onDidHide | Called just after the number pad hides | None | | onWillShow | Called just before the number pad will show | None | | onDidShow | Called just after the number pad shows | None |

<AvoidingView> Component

Sometimes React Native's built-in does not work smoothly with the number pad: it can either have performance issues where animations are choppy or it can be difficult to configure its height properly altogether. We've included a number pad context-aware version that adjusts it's height based on the keyboard animation to achieve a smooth frame rate.

| Prop | Description | Default | | ----------- | ---------------------------------------------------------------------------------------------------------------- | ------- | | style | Any valid style object for a <View> component (Animated.View, actually) | None |

Version History (Change Log)

View here.

Contribute

We welcome contributions! If you are interested in contributing, consider helping us with one of the following tasks:

  • Rewrite components in TypeScript using arrow-function components and React hooks
  • Add TypeScript bindings
  • Add Tests

Glance Money

Glance Money Logo

We wrote this for, actively use, and maintain this library for Glance Money. Now it is free and open for the world to use ❤️

License

MIT licensed.