stAMy
stAMy

Reputation: 481

Failed prop type: Invalid prop `type` of value `search` supplied to `Input`

Getting failed prop type due to type="search" on input. Says: "Failed prop type: Invalid prop type of value search supplied to Input, expected one of ["text","number","password","date","date-range","email","tel"]"

 <Input
   type="search"
   onChange={this.onSearchChange}
   iconSize={IconSize.xs}
   color="primary"
/>

The input with type="search" works as intended, but it keeps giving me console errors. Anyone knows why? And how to fix it?

Upvotes: 0

Views: 897

Answers (2)

kkesley
kkesley

Reputation: 3396

The <Input /> is a custom component. From the comment, you said it's your own component. Check your prop validation as currently it only allows ["text","number","password","date","date-range","email","tel"].

You can add "search" in the validation.

Upvotes: 1

Varun Arya
Varun Arya

Reputation: 207

If going through the error message. "Failed prop type: Invalid prop type of value search supplied to Input, expected one of ["text","number","password","date","date-range","email","tel"]

As in your code you have passed value "search" to type property of Input Component. Basically type doesn't recognise value "search" as it expect value to be "text", "number", "password", "date", "date-range", "email" or "tel".

Your Input component will be working fine cause of your some logic written in onSearchChange method.

To fix this error set the value of type which are specified in ["text","number","password","date","date-range","email","tel"].

For ex. if you're using only text for searching set it to "text", for number set it to "number" and so on.

Upvotes: 0

Related Questions