felamaslen / form-ratings

3 stars 0 forks source link

FormRatings Gives Warning on Any Input #11

Open lcundiff opened 2 years ago

lcundiff commented 2 years ago

When I pass in a number to initialize rating, I get this error message:

Failed prop type: Invalid prop `formik.values.rating` of type `number` supplied to `RatingsField`, expected `object`

When I pass in an object I get this error message:

Failed prop type: Invalid prop `value` of type `object` supplied to `RatingsField`, expected `number`

When I pass in null, it says that FormRatings is a required field. Is this library maintained? Used the following example code:

 render((
  <Formik
    initialValues={initialValues}
    onSubmit={onSubmit}
  > {({ errors, touched }) => (
      <Form>
        <div>
          <h3>Rating (quality)</h3>
          <Field name="ratingQuality" as={FormRatings} />
        </div>
        <div>
          <button type="submit">Save</button>
        </div>
      </Form>
    )}
  </Formik>
)`
Seth10001 commented 2 years ago

Looks like the prop type just needs to be updated here:

https://github.com/felamaslen/form-ratings/blob/587f5f15db2ebbed27ea32211ae36c66ff7d2a44/src/index.tsx#L63

Maybe RatingsField.formik could be updated to any?

lcundiff commented 1 year ago

bump @felamaslen

garudaputro commented 1 year ago

any solution for this? i've same issue