Skip to content

Commit c198846

Browse files
committed
Added dynamic input component
1 parent b9318f3 commit c198846

6 files changed

Lines changed: 13704 additions & 9942 deletions

File tree

.gitignore

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,3 +58,14 @@ android/keystores/debug.keystore
5858

5959
# generated by bob
6060
lib/
61+
62+
.yarn
63+
.yarn/*
64+
!.yarn/patches
65+
!.yarn/releases
66+
!.yarn/plugins
67+
!.yarn/sdks
68+
!.yarn/versions
69+
.pnp.*
70+
71+
.env

.yarnrc.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
nodeLinker: node-modules

package.json

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
2-
"name": "react-native-currency-input",
3-
"version": "1.0.1",
2+
"name": "@anicodebr/react-native-currency-input",
3+
"version": "1.0.2",
44
"description": "A simple currency input component for both iOS and Android",
55
"main": "lib/commonjs/index",
66
"module": "lib/module/index",
@@ -24,7 +24,7 @@
2424
"typescript": "tsc --noEmit",
2525
"lint": "eslint \"**/*.{js,ts,tsx}\"",
2626
"prepare": "bob build",
27-
"release": "release-it",
27+
"release": "dotenv release-it --",
2828
"example": "yarn --cwd example",
2929
"pods": "cd example && pod-install --quiet",
3030
"bootstrap": "yarn example && yarn && yarn pods"
@@ -55,6 +55,7 @@
5555
"@types/react": "^16.9.19",
5656
"@types/react-native": "0.62.13",
5757
"commitlint": "^8.3.5",
58+
"dotenv-cli": "^5.0.0",
5859
"eslint": "^7.2.0",
5960
"eslint-config-prettier": "^6.11.0",
6061
"eslint-plugin-prettier": "^3.1.3",
@@ -90,12 +91,15 @@
9091
]
9192
},
9293
"release-it": {
94+
"publishConfig": {
95+
"registry": "https://npm.pkg.github.com"
96+
},
9397
"git": {
9498
"commitMessage": "chore: release ${version}",
9599
"tagName": "v${version}"
96100
},
97101
"npm": {
98-
"publish": true
102+
"publish": false
99103
},
100104
"github": {
101105
"release": true

src/CurrencyInput.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ export default React.forwardRef<TextInput, CurrencyInputProps>((props, ref) => {
1818
minValue,
1919
signPosition = 'afterPrefix',
2020
showPositiveSign,
21+
InputComponent,
2122
...rest
2223
} = props;
2324

@@ -157,8 +158,9 @@ export default React.forwardRef<TextInput, CurrencyInputProps>((props, ref) => {
157158
: formattedValue;
158159
}, [formattedValue, prefix, signPosition, startingWithSign, suffix]);
159160

161+
const DefaultComponent = InputComponent ? InputComponent : TextInput
160162
return (
161-
<TextInput
163+
<DefaultComponent
162164
keyboardType="numeric"
163165
selection={
164166
suffix

src/props.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,11 @@ export interface FormatNumberOptions {
4444
}
4545

4646
export interface CurrencyInputProps extends Omit<TextInputProps, 'value'> {
47+
/**
48+
* Character for thousands delimiter.
49+
*/
50+
InputComponent?: Function;
51+
4752
/**
4853
* Character for thousands delimiter.
4954
*/

0 commit comments

Comments
 (0)