-
Notifications
You must be signed in to change notification settings - Fork 398
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
customInput failed prop type with styled-component passed #272
Comments
I am getting the same warning. |
I am too. |
Had the same issue, but after changing the prop to a function wrapper seems to be workign as expecteed. The code that works: <NumberFormat
type="text"
value={value}
customInput={(props) => <StyledInput {...props} />}
/> Update: |
@blaiprat |
In the end, I approached this in another way, by instead creating the styled components definition using NumberFormat this way. This allows to customise it and works as expected import styled from "styled-components";
import NumberFormat from "react-number-format";
const NumberFormatStyled = styled(NumberFormat)`
background: transparent;
border: 0;
`;
const MyComponent = () => {
return (
<div>
My custom format input
<NumberFormatStyled
type="text"
value={value}
/>
</div>
)
} |
I have created a pull request which fixes this - the const StyledInput = styled.input`
// Your styles
`;
class Input extends React.Component {
render() {
return (
<StyledInput {...this.props} />
);
}
} This is not ideal but is another solution for those who stumble upon this. |
Use elementType PropType for customInput prop (fixes #272)
Hi, sorry but I got this error when I try to pass a styled-component
to the customInput prop. The error that I got is the following
However the app works just fine.
What's the cause of this if I may get a better understanding? Thank you in advance!
The text was updated successfully, but these errors were encountered: