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

renderInput #76

Open
2manyvcos opened this issue Jan 17, 2018 · 0 comments · May be fixed by #80
Open

renderInput #76

2manyvcos opened this issue Jan 17, 2018 · 0 comments · May be fixed by #80

Comments

@2manyvcos
Copy link

Hello,

I would like to use this with Semantic UI React's <Input> component.

I know that there is an option to specify a custom input component, but it doesn't work in this situation as described below:

The ref property which is provided to the input is a special field and doesn't get passed to the component itself but rather is handled by React internally.
Unfortunately, Semantic UI wraps the HTML input in a container, so the ref is assigned to the container instead of the HTML input and there is currently no way to fix this.

So I would suggest to add something like a renderInput prop:

const renderFunc = this.props.renderInput || (props) => (<InputTag {...props} />)
input = renderFunc(attrs.input)
return (
  <span ...>
    {input}
    ...
  </span>
)

so that we can do things like this:

import { Input as SemanticInput } from 'semantic-ui-react'

<NumericInput
  ...
  renderInput={({ ref, ...props }) => (
    <SemanticInput
      transparent
      input={{ ref }}
      {...props}
    />
  )}
/>

What do you think?

@2manyvcos 2manyvcos linked a pull request Jan 31, 2018 that will close this 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

Successfully merging a pull request may close this issue.

1 participant