1.2.0 • Published 9 months ago

@raiden16f7/react-native-currency-picker v1.2.0

Weekly downloads
-
License
MIT
Repository
github
Last release
9 months ago

react-native-currency-picker

Various currency picker for iOS and Android

Changes from original version

++ Added renderChildrenStyle prop and text slicing for long country names

++ Added prop for modal animation

++ Changed background color to #FAFAFF

++ StatusBar not hidden on Android

++ container padding adjusted for android

Demo

Getting started

$ npm install @raiden16f7/react-native-currency-picker --save OR $ yarn add @raiden16f7/react-native-currency-picker

Example

import CurrencyPicker from "react-native-currency-picker";

let currencyPickerRef = undefined;

// use currencyPickerRef
currencyPickerRef.open();
currencyPickerRef.close();

<CurrencyPicker
	currencyPickerRef={(ref) => {
		currencyPickerRef = ref;
	}}
	enable={true}
	darkMode={false}
	currencyCode={"EUR"}
	showFlag={true}
	showCurrencyName={true}
	showCurrencyCode={true}
	onSelectCurrency={(data) => {
		console.log("DATA", data);
	}}
	onOpen={() => {
		console.log("Open");
	}}
	onClose={() => {
		console.log("Close");
	}}
	showNativeSymbol={true}
	showSymbol={false}
	containerStyle={{
		container: {},
		flagWidth: 25,
		currencyCodeStyle: {},
		currencyNameStyle: {},
		symbolStyle: {},
		symbolNativeStyle: {},
	}}
	modalStyle={{
		container: {},
		searchStyle: {},
		tileStyle: {},
		itemStyle: {
			itemContainer: {},
			flagWidth: 25,
			currencyCodeStyle: {},
			currencyNameStyle: {},
			symbolStyle: {},
			symbolNativeStyle: {},
		},
	}}
	title={"Currency"}
	searchPlaceholder={"Search"}
	showCloseButton={true}
	showModalTitle={true}
/>;

Options

PropsDefaultOptions/Info
enable (Boolean)trueShow component that choose the currency.
currencyPickerRef (Function)nullGet the open() and close() modal methods.
darkMode (Boolean)trueDark mode for currency modal.
currencyCode (String)USDCurrency code displayed is selected at start.
onSelectCurrency (Function)nullCalled when the user chooses a currency and returns information for the selected currency.
onOpen (Function)nullCalled when the open modal.
onClose (Function)nullCalled when the close modal.
showNativeSymbol (Boolean)trueShow the native symbol of the currency.
showSymbol (Boolean)falseShow the symbol of the currency.
showFlag (Boolean)trueShow the icon of the currency.
showCurrencyName (Boolean)trueShow the name of the currency.
showCurrencyCode (Boolean)trueShow the code of the currency.
title (String)"Currency"The title of the modal select currency.
showCloseButton (Boolean)trueShow the close button of the modal select currency.
showModalTitle (Boolean)trueShow the title of the modal select currency.
containerStyle (Object)nullStyle for component that choose the currency. Note: See more details below.
modalStyle (Object)nullStyle for modal select currency. Note: See more details below.
renderChildren (Component)nullThe child component replaces the component element of the library

containerStyle

PropsDefaultOptions/Info
container (Object)styleStyle for component container.
flagWidth (number)default: 25Width for the icon currency.
currencyCodeStyle (Object)styleStyle for currency code.
currencyNameStyle (Object)styleStyle for currency name.
symbolStyle (Object)styleStyle for currency symbol.
symbolNativeStyle (Object)styleStyle for currency native symbol.

modalStyle

PropsDefaultOptions/Info
container (Object)styleStyle for modal container
modalAnimation (animationType)slideModal opening/closing animation type
searchStyle (Object)styleStyle for modal search input
tileStyle (Object)styleStyle for modal title
itemStyle (Object)styleStyle for item select currency Note: See more details below.

itemStyle

PropsDefaultOptions/Info
itemContainer (Object)styleStyle for item currency container
flagWidth (number)default: 25Width for the icon currency
currencyCodeStyle (Object)styleStyle for currency code
currencyNameStyle (Object)styleStyle for currency name
symbolStyle (Object)styleStyle for currency symbol
symbolNativeStyle (Object)styleStyle for currency native symbol

renderChildrenStyle

PropsDefaultOptions/Info
container (Object)styleStyle for component container.

Thank you for your interest!