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-calculator

v0.5.2

Published

React Native Calculator and Calculator Input Component

Downloads

156

Readme

React Native Calculator

npm version build status

Simple react native calculator and calculator input component.

Installation

Using npm:

npm i -S react-native-calculator

or yarn:

yarn add react-native-calculator

Demo

Calculator Component

Usage

import React from 'react'
import { View } from 'react-native'
import { Calculator } from 'react-native-calculator'

export default class App extends React.Component {
  render() {
    return (
      <View style={{ flex: 1 }}>
        <Calculator style={{ flex: 1 }} />
      </View>
    )
  }
}

Props

All props in common props and...

| Prop Name | Data Type | Default Value | Description | | --------------- | ------------------------------------------- | ------------- | ----------------------------------- | | hasAcceptButton | boolean | false | Show accept button after calculate. | | style | ViewStyle | | Container style. | | onCalc | (value : number , text : string ) => void | | Calculate button click event. | | onAccept | (value : number , text : string ) => void | | Accept button click event. | | hideDisplay | boolean | false | Hide display text field. |

Calculator Input Component

Usage

import React from 'react'
import { View } from 'react-native'
import { CalculatorInput } from 'react-native-calculator'

export default class App extends React.Component {
  render() {
    return (
      <View>
        <CalculatorInput
          fieldTextStyle={{ fontSize: 24 }}
          fieldContainerStyle={{ height: 36 }}
        />
      </View>
    )
  }
}

Props

All props in common props and...

| Prop Name | Data Type | Default Value | Description | | ------------------- | ------------------------------------------------------- | ------------- | ---------------------------------------------------------------------------------------- | | modalAnimationType | 'none' | 'slide' | 'fade' | slide | Modal animation type. | | modalBackdropStyle | ViewStyle | | Style of modal backdrop. | | fieldContainerStyle | ViewStyle | | Text field container style. | | fieldTextStyle | TextStyle | | Text style. | | onChange | (value : number , text : string ) => void | | Value change event. | | prefix | string | | Prefix. | | suffix | string | | Suffix. | | onBeforeChange | (value : number , text : string ) => boolean | | Called before changes applied. Return true if changes are accepted. | | onBeforeChangeAsync | (value : number , text : string ) => Promise<boolean> | | Called asynchronously before changes applied. Resolve with true if changes are accepted. |

Common Props

| Prop Name | Data Type | Default Value | Description | | ---------------------------- | -------------------------------------------------- | ------------- | ------------------------------------------------------- | | decimalSeparator | string | . | Decimal separator sign. | | thousandSeparator | string | , | Thousand separator sign. | | numericButtonBackgroundColor | string | #ffffff | Numeric button background color. | | numericButtonColor | string | #aaaaaa | Numeric text button color. | | actionButtonBackgroundColor | string | #e7e5e3 | Action button background color. | | actionButtonColor | string | #000000 | Action text button color. | | calcButtonBackgroundColor | string | #ff8d00 | Calculate button background color. | | calcButtonColor | string | #ffffff | Calculator text button color. | | acceptButtonBackgroundColor | string | #14CC60 | Accept button background color. | | acceptButtonColor | string | #ffffff | Accept text button color. | | displayBackgroundColor | string | #ffffff | Digit display background color. | | displayColor | string | #000000 | Digit display text color. | | borderColor | string | #52525B | Border color. | | fontSize | number | 18 | Button text font size. | | value | number | 0 | Initial value. | | width | number | (auto) | Calculator component width. | | height | number | (auto) | Calculator component height. | | displayHeight | number | (auto) | Digit display container height. | | keyboardHeight | number | (auto) | Keyboard container height. | | onTextChange | (text: string) => void | | Text change event. | | displayTextAlign | "auto" / "left" / "right" / "center" / "justify" | "left" | Digit align display. | | noDecimal | boolean | false | Hide decimal separator button to disable decimal value. | | roundTo | number | 2 | How many decimal places to round the value |

License

MIT