mohitgupta8888 / react-currency-format Goto Github PK
View Code? Open in Web Editor NEWLicense: MIT License
License: MIT License
Hello,
I want to disable the textbox for some condition and enable for some condition so can you tell me how can it be done??
Received this error when I tried to import the file after running a yarn add react-currency-format
, Could not find a declaration file for module 'react-currency-format'. '....../node_modules/react-currency-format/lib/currency-format.js' implicitly has an 'any' type.
I tried removing and re-installing the package but was still running into the issue. Any help is greatly appreciated.
Hey! I'm the customInput prop and passing in a TextField from Material UI like the docs show and I keep throwing this Failed prop type error:
Warning: Failed prop type: Invalid prop "customInput" of type "object" supplied to "CurrencyFormat:, expected "function"
My component looks like this:
<CurrencyFormat
className={classes.budgetField}
variant='standard'
margin='normal'
required
name='total_budget'
label='Budget Total'
placeholder='0.00'
InputProps={{inputProps: {min: 0}}}
id='total_budget'
value={total_budget}
onValueChange={(values) => {
const {value} = values;
setFormData({
...formData,
total_budget: value,
});
}}
thousandSeparator={true}
decimalScale={2}
allowNegative={false}
prefix={
getSymbolFromCurrency(home_currency) !== undefined
? getSymbolFromCurrency(home_currency)
: '$'
}
customInput={TextField}
/>
The error goes away if I pass TextField as a function like customInput={()=> <TextField {...props}/> }
however, it doesn't render correctly because on every new render the component is rebuilt (I think) and the user loses focus from the field.
Anyway, the component works as is with the error. I was just wondering if there was a way around this. Thanks!
"@material-ui/core": "^4.11.0"
"react": "^16.13.1"
"react-currency-format": "^1.0.0"
node v12.0.0
Please push the latest changes to NPM.
Version 1.0.0 is still the latest here: https://www.npmjs.com/package/react-currency-format
Anyone trying to use this package with React 17+ and has NPM 7+ will fail install and receive the following error:
Could not resolve dependency: npm ERR! peer react@"^0.14 || ^15.0.0-rc || ^15.0.0 || ^16.0.0-rc || ^16.0.0" from [email protected]
In case of use any prefix unable to remove first dash symbol.
Here the example of code
<CurrencyFormat prefix="$" placeholder="placeholder" />
Type "-" symbol and then try to remove it.
I need to define a dynamic max value for this field. Is it possible?
Maybe something like this:
<CurrencyFormat {...} maxValue={9999999} />
I need different behavior from the plugin as per my business requirements & I believe that this requirement is everywhere.
HOW THE PLUGIN IS HANDLING ROUNDING?
WHAT DO I EXPECT?
I want to combine the 3rd and 4th rule into one and that is: If the last digit is 5 then the plugin should increment the 2nd last digit and drops the last digit
So, is there a way to handle this issue?
Possibility to use the getFloatString function like this...
import {getFloatString} from 'react-currency-format';
getFloatString(formattedValue);
This feature could help when we need to handle the value to send to API.
Hi! ๐
Firstly, thanks for your work on this project! ๐
Today I used patch-package to patch [email protected]
for the project I'm working on.
Fixed "Failed prop type: Invalid prop customInput of type object" #15
Here is the diff that solved my problem:
diff --git a/node_modules/react-currency-format/src/currency-format.js b/node_modules/react-currency-format/src/currency-format.js
index 8ce11c8..14a80bb 100644
--- a/node_modules/react-currency-format/src/currency-format.js
+++ b/node_modules/react-currency-format/src/currency-format.js
@@ -37,7 +37,7 @@ const propTypes = {
PropTypes.string
]),
isNumericString: PropTypes.bool,
- customInput: PropTypes.func,
+ customInput: PropTypes.node,
allowNegative: PropTypes.bool,
onValueChange: PropTypes.func,
onKeyDown: PropTypes.func,
This issue body was partially generated by patch-package.
Is it possible to pop up the number keyboard instead of the qwerty one?
Currently it's not possible to access the actual input element through a ref i.e. the input ref is not forwarded from CurrencyFormat
to the input element. This is a problem when you want to do things like place the caret at the beginning or end of the value, or highlight the full value for quick editing. e.g. element.select()
In the constructor of the CurrencyFormat
component add a field called inputRef
which is the ref of the input element.
class CurrencyFormat extends React.Component {
constructor(props) {
this.inputRef = React.createRef()
}
render() {
return (
<input ref={this.inputRef} />
)
}
}
I would be happy to create a PR for this issue. Let me know if this solution is good.
the version number 1.1.0 already exists, please use another one, otherwise the dependency can not be updated.
Hello!
I've encountered this bug, not sure if it's supposed to be like this, so please let me know.
When values arrive like this:
<CurrencyFormat value={-99.49} decimalScale={0} displayType={'text'} />
<CurrencyFormat value={-99.50} decimalScale={0} displayType={'text'} />
<CurrencyFormat value={-99.99} decimalScale={0} displayType={'text'} />
<CurrencyFormat value={-100} decimalScale={0} displayType={'text'} />
From -99.50 to -99.99 it results to NaN00, is it supposed to do that? I would expect it to round to -100
I'm using:
When you delete the value rather than getting $0.00 it returns NaN.
Hey Guys, I want to get name or id property input..
How to get it ?
Thanks
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.