react-bulma-components
react-bulma-components copied to clipboard
Form.Input typing explicitly does not contain renderAs
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
https://github.com/couds/react-bulma-components/pull/265/commits/f0635ef8bef334d4c380507c9dbcb7e8de888b90