react-final-form icon indicating copy to clipboard operation
react-final-form copied to clipboard

Cannot create Field element due to `component` type

Open cchawn opened this issue 8 years ago • 2 comments

Are you submitting a bug report or a feature request?

Bug report

What is the current behavior?

Getting a Flow type error when passing in a SupportedType string to a Field's component prop.

This is the error:

Cannot create Field element because in property component:
 • Either string [1] is incompatible with React.StatelessFunctionalComponent [2].
 • Or string [1] is incompatible with statics of React.Component [3].

      82│             <Field
      83│               name="radioInput"
      84│               id={id}
 [1]  85│               component="input"
      86│               type="radio"
      87│               value={value}
      88│             />

     /private/tmp/flow/flowlib_1090ee00/react.js
 [2] 153│   | React$StatelessFunctionalComponent<Props>
 [3] 154│   | Class<React$Component<Props, any>>;

What is the expected behavior?

Since "input" is a valid SupportedType, component="input" should not raise a Flow error.

https://github.com/final-form/react-final-form/blob/7e98131a81964d7c218dc710c7ecb156b1d52ce5/src/types.js.flow#L91 https://github.com/final-form/react-final-form/blob/7e98131a81964d7c218dc710c7ecb156b1d52ce5/src/types.js.flow#L13

Sandbox

This is an issue with the Flow types, here is an example: https://goo.gl/b9iQCk

What's your environment?

flow-bin@^0.77.0:
  version "0.77.0"

react-final-form@^3.6.5:
  version "3.6.5"

final-form@^4.8.3:
  version "4.8.3"

Other information

This issue says the problem is resolved, but it isn't... https://github.com/final-form/react-final-form/issues/291

cchawn avatar Aug 22 '18 15:08 cchawn

#318

consegrado avatar Aug 22 '18 17:08 consegrado

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

lock[bot] avatar Nov 15 '19 15:11 lock[bot]