-
-
Notifications
You must be signed in to change notification settings - Fork 32.2k
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
Customizing inputProps onBlur and onFocus on TextField #13546
Comments
I guess the component should handle chaining event handlers. They are currently only overridden: |
@eps1lon how do you think the change should be? |
Did you check https://github.com/Deadly0/final-form-material-ui out? I'm using the following integration: import React from 'react'
import PropTypes from 'prop-types'
import TextField from 'web/modules/components/TextField'
function RFTextField(props) {
const {
autoComplete,
helperText,
input: { name, ...input },
InputProps,
meta: { dirty, error, submitError, submitFailed },
...other
} = props
return (
<TextField
error={Boolean((dirty || submitFailed) && (error || submitError))}
{...input}
{...other}
id={name}
name={name}
InputProps={{
inputProps: {
autoComplete,
},
...InputProps,
}}
helperText={dirty || submitFailed ? error || submitError : helperText}
/>
)
}
RFTextField.displayName = 'RFTextField'
RFTextField.propTypes = {
autoComplete: PropTypes.string,
helperText: PropTypes.node,
input: PropTypes.shape({
name: PropTypes.string.isRequired,
}).isRequired,
InputProps: PropTypes.object,
meta: PropTypes.shape({
dirty: PropTypes.bool.isRequired,
error: PropTypes.string,
submitError: PropTypes.string,
submitFailed: PropTypes.bool.isRequired,
}).isRequired,
}
export default RFTextField |
@eps1lon Don't we already handle chaining? |
@serendipity1004 Do you have a reproduction we can have a look at? |
From the component props but not from the Í understand the confusion of @serendipity1004. Just spread |
@eps1lon Oh, yes, we don't handle chaining for |
@eps1lon you are right, if I spread over |
@oliviertassinari @eps1lon For checking when to log the warning is checking |
With a But I would also like to remove the |
I have fixed the chaining in #17037. |
I am using
react-final-form
to create forms (I do not want to use redux form because I am using apollo).The problem is that
react-final-form
requires inputPropsonBlur
andonFocus
function to be injected to setmeta.touched
. If I inject the custom functions into inputProps, TextField loses focus animation (border color change, ripple effect, etc). Is there a way I can integrate externalonBlur
andonFocus
functions with the material ui nativeonBlur
andonFocus
functions?The code looks like below
The text was updated successfully, but these errors were encountered: