harish-everest / react-phone-input-mui

Highly customizable phone :telephone_receiver: input component with auto formatting
MIT License
24 stars 13 forks source link

Not working with MUI v4? #11

Closed cristianoccazinsp closed 2 years ago

cristianoccazinsp commented 2 years ago

I keep getting the following, which seems to be coming from the internal render method of this component:

Error: Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: undefined. You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.

Check the render method of `t`.

    at div
    at t (http://localhost:3000/static/js/bundle.js:235071:7)
    at FormsyPhone (http://localhost:3000/static/js/bundle.js:7113:5)

Note that FormsyPhone is the component that renders ReactPhoneInput

import ReactPhoneInput from 'react-phone-input-material-ui';

class FormsyPhone extends React.Component {
...
return (
      <ReactPhoneInput
        defaultCountry={'ca'}
        Component={TextField}
        onBlur={this.handleBlur}
        onChange={this.handleChange}
        value={getValue() || ''}
        inputProps={fieldProps}
      />
    );
harish-everest commented 2 years ago

@cristianoccazinsp It's working well for me with material-ui v4.

Here is the working repo. https://github.com/harish50/react-phone-input-material-ui-test