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

Invariant Violation: View config getter callback for component input must be a function (received undefined) React Native Expo #848

Open
art3mHQ opened this issue Jul 11, 2024 · 2 comments

Comments

@art3mHQ
Copy link

art3mHQ commented Jul 11, 2024

Got an error while running on ios React Native (Expo)

 ERROR  Invariant Violation: View config getter callback for component `input` must be a function (received `undefined`). Make sure to start component names with a capital letter.

This error is located at:
    in input (created by NumberFormatBase)
    in NumberFormatBase (created by PatternFormat)
    in PatternFormat (created by PickUpForm)

after trying to use like that

<PatternFormat
    displayType="input"
    format="(###) ###-##-##"
    mask="_"
    onValueChange={(value) => setTel(value.formattedValue)}
    data-cy="phone"
    value={tel}
    placeholder="(099) 000-00-00"
/>

run into this issue only on ios

Chrome web version works fine

@Mathitarazonad
Copy link

I faced the same issue on mobile application, and I think it's because displayText="input" tries to render an <input /> element and React Native of course doesn't support this. So I fixed by changing displayText="text" and passed to the react-number-format component a renderText prop to handle an input component to change the value, like this:

  <PatternFormat
       displayType="text"
      format="(###) ###-##-##"
      mask="_"
      onValueChange={(value) => setTel(value.formattedValue)}
      data-cy="phone"
      value={tel}
      placeholder="(099) 000-00-00"
      renderText={(currentValue) => (<TextInput value={currentValue} />)}
  />

@art3mHQ
Copy link
Author

art3mHQ commented Jul 19, 2024

Thank you for responce, but i cant manage to make it work like you show, it did not throw an error but did not accept any input and not showing place holder

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants