Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Warning: Failed prop type: Invalid prop customInput of type object #15

Open
kzunino opened this issue Oct 24, 2020 · 2 comments
Open

Warning: Failed prop type: Invalid prop customInput of type object #15

kzunino opened this issue Oct 24, 2020 · 2 comments

Comments

@kzunino
Copy link

kzunino commented Oct 24, 2020

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

@RafalGN
Copy link

RafalGN commented Apr 14, 2021

Any luck trying to solve this problem? I have the same issue

@jailsonpaca
Copy link

I have the same issue!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants