jquense / react-formal

Sophisticated HTML form management for React
http://jquense.github.io/react-formal
MIT License
526 stars 52 forks source link

Form.Field of select type expects value to be a number? #103

Closed rclai closed 8 years ago

rclai commented 8 years ago

I have no idea why I'm getting this error:

warning.js:36 Warning: Failed prop type: Invalid prop `value` of type `string` supplied to `Select`, expected `number`.
    in Select (created by ChildBridge)
    in ChildBridge (created by MessageTrigger)
    in MessageTrigger (created by MessageListener)
    in MessageListener (created by ChildBridge)
    in ChildBridge (created by Binding)
    in Binding (created by Field)
    in Field (created by Unknown)
    in Unknown (created by Styled(undefined))
    in Styled(undefined) (created by CustomerInfoModal)
    in div (created by styled.div)
    in styled.div (created by CustomerInfoModal)
    in div (created by styled.div)
    in styled.div (created by CustomerInfoModal)
    in div (created by styled.div)
    in styled.div (created by CustomerInfoModal)
    in form (created by Form)
    in MessageContainer (created by MessageListener)
    in MessageListener (created by Form)
    in BindingContext (created by Form)
    in Form (created by Uncontrolled(Form))
    in Uncontrolled(Form) (created by Styled(Uncontrolled(Form)))
    in Styled(Uncontrolled(Form)) (created by CustomerInfoModal)
    in div (created by ModalPortal)
    in div (created by ModalPortal)
    in ModalPortal

Where Select is simply this:

const Select = (props) => {
  return <Form.Field type="select" {...props} />
}

and being used as follows:

render() {
  return (
    // ...Form is up here
    <Select name="referralSource">
      <option value={''}>Select Referral</option>
      <option value="thomasnet">ThomasNet</option>
      <option value="customer">Customer</option>
      <option value="vendor">Vendor</option>
      <option value="search">Search</option>
    </Select>
    // ...Form end tag
  );
}

and my yup schema is:

const schema = yup.object({
  referralSource: yup.mixed().oneOf(['', 'thomasnet', 'customer', 'vendor', 'search']),
});
rclai commented 7 years ago

Thanks. Have you made a release yet?

artemkochnev commented 7 years ago

@jquense is there currently any plan to push out a new version with this fix?