0.0.1-alpha.2 • Published 4 years ago

react-native-number-ticker-input v0.0.1-alpha.2

Weekly downloads
3
License
MIT
Repository
github
Last release
4 years ago

react-native-number-ticker-input

A numeric input in the style of a ticker, which supports Android, iOS and Web.

Getting Started

Using npm:

npm install --save react-native-number-ticker-input

Using yarn:

yarn add react-native-number-ticker-input

Usage

The component works very similarly to a <TextInput/>, since it is after all, just an animated wrapper of one!

import React, { useState } from "react";
import NumberTickerInput from "react-native-number-ticker-input";

export default () => {
  const [value, setValue] = useState(0);
  return (
    <NumberTickerInput
      height={100}
      significantContainerStyle={{
        backgroundColor: 'white',
      }}
      decimalContainerStyle={{
        backgroundColor: 'lightgrey',
      }}
      significantTickerStyle={{
        fontSize: 60,
        fontFamily: 'monospace',
      }}
      decimalTickerStyle={{
        fontSize: 60,
        fontFamily: 'monospace',
        color: 'red',
      }}
      decimalDigits={1}
      value={value}
      onChange={setValue}
    />
  );
};

Props

PropertyTypeRequiredDefault valueDescription
heightnumberno100Defines the component height.
valuenumberno0Defines the current value.
onChangefuncno() => nullCallback to update the value.
significantDigitsnumberno4The number of digits to show before the decimal point.
significantContainerStylestylenoundefinedThe style of the outer container for a significant digit.
significantTickerStylestylenoundefinedThe style of an individual number ticker for a significant digit.
decimalDigitsnumberno2The number of decimal digits.
decimalContainerStylestylenoundefinedThe style of the outer container for a decimal digit.
decimalTickerStylestylenoundefinedThe style of an individual number ticker for a decimal digit.
DecimalPointelementTypenoDecimalPointThe component to use when rendering the decimal point. This will not be rendered if decimalDigits === 0.

License

MIT