viclafouch / mui-tel-input

📌 A phone number input designed for MUI (Material ui) V6 built with libphonenumber-js
https://viclafouch.github.io/mui-tel-input
MIT License
160 stars 65 forks source link

All optional attributes are required #59

Closed jorgegarba closed 1 year ago

jorgegarba commented 1 year ago

I just installed the library and using it in the same way as your documentation, the component gets annoyed requiring all optional attributes as follows:

Type '{ value: string; onChange: (newPhone: any) => void; }' is missing the following properties from type 'Pick<MuiTelInputProps, "color" | "translate" | "margin" | "hidden" | "size" | "style" | "disabled" | "name" | "value" | "variant" | "classes" | "className" | ... 279 more ... | "continents">': color, translate, margin, hidden, and 274 more.ts(2740)

I didn't make any change to the simple usage. Is there a possibility that you have a bug?

Thanks in advance

viclafouch commented 1 year ago

Humm can you please share a sandbox plz ?

jorgegarba commented 1 year ago

Hi @viclafouch I just created de SandBox

https://codesandbox.io/s/muitelinput-bug-allrequired-yy3iss?file=/src/App.tsx

It is causing the same error, and the code is as follows:

import "./styles.css";
import { MuiTelInput } from "mui-tel-input";
import { useState } from "react";

export default function App() {
  const [phone, setPhone] = useState("");
  return (
    <div className="App">
      <h1>Hello CodeSandbox</h1>
      <h2>Start editing to see some magic happen!</h2>
      <hr />
      <MuiTelInput value={phone} onChange={() => {}} />
    </div>
  );
}
viclafouch commented 1 year ago

Everything is working for me, just don't forget to install @emotion/react @emotion/styled and @mui/material.

jorgegarba commented 1 year ago

Oh I see, so sorry for this false issue. I'm using MUI, but missing those libs. Thank you so much. Closing the issue