1.1.0 • Published 1 year ago

@newagebel/react-native-currency-field v1.1.0

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

Demo

Currency: USD, Locale: en_USCurrency: EUR, Locale: de_DECurrency: UAH, Locale: uk_UA

Installation

npm install @newagebel/react-native-currency-field

or

yarn add @newagebel/react-native-currency-field

iOS Installation

cd ios && pod install && cd ..

Android Installation

There are no extra steps 💆‍♂️

Usage

import CurrencyField from '@newagebel/react-native-currency-field'

function MyComponent() {
  const [value, setValue] = useState(20);

  <CurrencyField
    value={value}
    onChangeText={setValue}
    currency={'EUR'}
    maxValue={10000}
    selectTextOnInit={false}
    style={style.inputStyle}
  />;
}

Props

PropTypeDefaultDescription
...TextInputPropsInherit all props of TextInput.
valuenumber0
onChangeTextfunction(unmaskedValue: number, maskedValue: string) => null
currencystringUSD
maxValuestring100000000
selectTextOnInitbooleanfalseSelect all text on initialization

To change the locale, you need to change the region in the phone settings.

License

MIT