All Projects → inKindCards → react-native-money

inKindCards / react-native-money

Licence: MIT license
A fully native TextInput component that allows currency input with a right to left text alignment

Programming Languages

swift
15916 projects
kotlin
9241 projects
typescript
32286 projects
ruby
36898 projects - #4 most used programming language
objective c
16641 projects - #2 most used programming language
javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to react-native-money

frontend
Cambiatus Web based frontend using Elm
Stars: ✭ 25 (-44.44%)
Mutual labels:  currency
stockholm
💵 Modern Python library for working with money and monetary amounts. Human friendly and flexible approach for development. 100% test coverage + built-in support for GraphQL and Protocol Buffers transports using current best-practices.
Stars: ✭ 26 (-42.22%)
Mutual labels:  currency
persian
Some utilities for Persian language in Go (Golang)
Stars: ✭ 65 (+44.44%)
Mutual labels:  currency
nis-python-client
Python client for NEM NIS API (https://nemproject.github.io). XEM\NEM\Crypto
Stars: ✭ 16 (-64.44%)
Mutual labels:  currency
rescript-intl
ReScript wrapper on top of JavaScript's Intl
Stars: ✭ 18 (-60%)
Mutual labels:  currency
Rates
A currency rate converter App.
Stars: ✭ 13 (-71.11%)
Mutual labels:  currency
Credits
Credits(CRDS) - An Evolving Currency For An Evolving Society
Stars: ✭ 14 (-68.89%)
Mutual labels:  currency
php-currency-api
Standardized wrapper for popular currency rate APIs. Currently supports FixerIO, CurrencyLayer, Open Exchange Rates and Exchange Rates API.
Stars: ✭ 17 (-62.22%)
Mutual labels:  currency
crypto-monitor
Monitor the crypto currency rate
Stars: ✭ 71 (+57.78%)
Mutual labels:  currency
Guide-to-Swift-Numbers-Sample-Code
Xcode Playground Sample Code for the Flight School Guide to Swift Numbers
Stars: ✭ 92 (+104.44%)
Mutual labels:  currency
pesa
A JS money lib whose precision goes up to 11 (and beyond).
Stars: ✭ 38 (-15.56%)
Mutual labels:  currency
addons-konos
Konos Chilean Addons
Stars: ✭ 16 (-64.44%)
Mutual labels:  currency
javascript-forex-quotes
JavaScript Library for fetching realtime forex quotes.
Stars: ✭ 38 (-15.56%)
Mutual labels:  currency
poe-currency-flip-planner
This tool is an attempt at planning short-term arbitrage deals of currency in Path of Exile.
Stars: ✭ 95 (+111.11%)
Mutual labels:  currency
money-parser
Price and currency parsing utility
Stars: ✭ 26 (-42.22%)
Mutual labels:  currency
currency
A currency computations package.
Stars: ✭ 52 (+15.56%)
Mutual labels:  currency
GoCurrency
Simple currency converter. Insert an amount, what currency to convert from and what currency to convert to.
Stars: ✭ 29 (-35.56%)
Mutual labels:  currency
LEAmountInputView
Amount Input View (inspired by Square's design)
Stars: ✭ 44 (-2.22%)
Mutual labels:  currency
currencyconverter
A Python currency converter using the European Central Bank data.
Stars: ✭ 158 (+251.11%)
Mutual labels:  currency
django-prices-openexchangerates
openexchangerates.org support for django-prices
Stars: ✭ 33 (-26.67%)
Mutual labels:  currency

Contributors Forks Stargazers Issues MIT License


Logo

React Native Money

A fully native TextInput component that allows multilingual currency input
with a right to left text alignment.

View Library · Report Bug · Request Feature

What is this?

React Native Money is a simple component library that exposes a fully native TextInput component that uses currency formatting libraries provided with Android and iOS, so as well as being performant it is also lightweight on your binary sizes. The component has an identitical prop signature and API to the default TextInput provided with React Native, The only difference is that the value prop accepts a Number type and onChangeText returns a number value and formatted string.


npm install @inkindcards/react-native-money

iOS Installation:

Make sure to add the following to your Podfile before running npx pod-install:

pod 'React-RCTText', :path => '../node_modules/react-native/Libraries/Text', :modular_headers => true

Manual Installation

iOS

  1. In XCode, in the project navigator, right click LibrariesAdd Files to [your project's name]
  2. Go to node_modulesreact-native-money and add RNMoneyInput.xcodeproj
  3. In XCode, in the project navigator, select your project. Add libRNMoneyInput.a to your project's Build PhasesLink Binary With Libraries
  4. Run your project (Cmd+R)

Android

  1. Open up android/app/src/main/java/[...]/MainActivity.java
  • Add import com.inkind.RNMoneyInput.RNMoneyInputPackage; to the imports at the top of the file
  • Add new RNMoneyInputPackage() to the list returned by the getPackages() method
  1. Append the following lines to android/settings.gradle:
    include ':inkindcards_react-native-money'
    project(':inkindcards_react-native-money').projectDir = new File(rootProject.projectDir, 	'../node_modules/@inkindcards/react-native-money/android')
    
  2. Insert the following lines inside the dependencies block in android/app/build.gradle:
    compile project(':react-native-money')
    

Usage

You use the MoneyInput component like a normal TextInput from the React Native library with the exception that you pass a number to the value prop. You can also pass a locale idenitifer which is composed of the language along with the country, this in turn will change the how the currency is formatted, All possible locales can be read about here: Currency Locale Reference.

import {useState} from 'react'
import MoneyInput from '@inkindcards/react-native-money'

const App = () => {
  const [bill, setBill] = useState<number>()

  return (
    <MoneyInput 
      value={bill} 
      locale='en_US'
      placeholder='$0.00'
      onChangeText={(value: number, label: string) => {
        setBill(value)
      }}
    />
  )

}

Testing

Make sure to mock the following to jest.setup.js:

jest.mock('react-native-money', () => ({
    default: jest.fn(),
}))

Inspiration

We'd like to express thanks to the developers of react-native-text-input-mask as this project started as a fork of that repo as their approach in monkeypatching the TextInput delegate was exactly what we needed.

Versioning

This project uses semantic versioning: MAJOR.MINOR.PATCH. This means that releases within the same MAJOR version are always backwards compatible. For more info see semver.org.

(back to top)

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].