0.1.0 • Published 11 months ago

react-native-naira v0.1.0

Weekly downloads
-
License
MIT
Repository
-
Last release
11 months ago

React Native Naira

A React Native package for displaying amount figures with the Nigerian Naira symbol.

Installation

npm install react-native-naira

or

yarn add react-native-naira

Usage

Import the Naira component and use in your JSX.

Example 1

import { Naira } from 'react-native-naira'

const App = () => {
  return (
    <Naira>{10000}</Naira> 
  )
}

Example 2

Use inside a Text component.

E.g: I Paid John ₦10,000 for his car today!

import * as React from 'react'
import { StyleSheet, Text, View } from 'react-native'
import { Naira } from 'react-native-naira'

const App = () => {
  return (
    <View style={styles.background}>
      <Text>I Paid John <Naira>{10000}</Naira> for his car today!</Text>
    </View>
  )
}

const styles = StyleSheet.create({
  background: {
    flex: 1,
    backgroundColor: "#3b4d61"
  },
  amount: {
    color: '#fff',
    fontSize: 25,
    fontWeight: "800"
  }
})

export default App

Props

PropsTypeRequiredDescription
styleStyleProp<TextStyle>OptionalAdd your styles directly to the component.
decimalPlacesnumberOptionalThis prop is used to describe the number of digits that appear after the decimal point in a number.
childrennumbertruePass a number to be rendered by the component. The value you pass here must not be a string!

Testing

This package uses Jest for testing, make sure you have the following configurations setup in package.json file:

  "jest": {
    "preset": "react-native",
    "moduleFileExtensions": [
      "ts",
      "tsx",
      "js",
      "jsx",
      "json",
      "node"
    ]
  }

Licensing

This project is licensed under MIT license.

0.1.0

11 months ago