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

Form.Input typing explicitly does not contain renderAs #424

Open
Adelrisk opened this issue Jul 19, 2023 · 0 comments
Open

Form.Input typing explicitly does not contain renderAs #424

Adelrisk opened this issue Jul 19, 2023 · 0 comments
Labels

Comments

@Adelrisk
Copy link

Describe the bug

Form.Input in the typings file explicitly excludes renderAs

// https://github.com/couds/react-bulma-components/blob/v4.1.0/src/components/form/index.d.ts#L91
declare const Form: {
  Input: <TValue>(
    props: OmitKeys<
      InputProps<TValue> & ElementProps<InputProps<TValue>, 'input'>,
      'renderAs' | 'readonly'
    >,
  ) => React.ReactElement;
}

However, the documentation explicitly describes the availability of renderAs on every component. https://couds.github.io/react-bulma-components/iframe.html?id=core-component-the-renderas-prop--page&viewMode=docs

Under the hood, each Bulma component has a specified default `renderAs` component
that they will use to render, along with all the generated Bulma classes.

In the Javascript file, the functionality appears to be available:

//https://github.com/couds/react-bulma-components/blob/v4.1.0/src/components/form/components/input.js#L78
Input.propTypes = {
// ...
  renderAs: PropTypes.oneOfType([
    PropTypes.func,
    PropTypes.string,
    PropTypes.object,
  ]),
};

Input.defaultProps = {
  renderAs: 'input',
};

To Reproduce
Not applicable. This is a compile-time error.

Expected behavior
The component Form.Input (and other components?) should support renderAs.

Screenshots
If applicable, add screenshots to help explain your problem.

Versions

  • react-bulma-components:: 4.1.0
  • bulma: N/A
  • react: N/A
  • Browser: (e.g. Firefox version 67) N/A

Additional context

Purpose: I'd like to combine the form validation of a Formik Field with these react bulma components.

The current state of the code appears to be the result of a re-write in version 4.0.0 (see #265). Funnily enough, the following commit seems to enable/address this functionality with the comment Allow override of renderAs of Form.Input; remove default HTML attrs propTypes

f0635ef

@Adelrisk Adelrisk added the bug label Jul 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant