Incompatible props when using with react-timezone-select #252
Unanswered
codeforcesmeme
asked this question in
Q&A
Replies: 1 comment 9 replies
-
Update: I did solve the problem(s) looking at the codebase of both packages I added the types Complete example (for documentation, if I remove the codesandbox in the future) import { useState } from "react";
import TimezoneSelect, { ITimezone } from "react-timezone-select";
import { useChakraSelectProps } from "chakra-react-select";
import "./styles.css";
export default function App() {
const [timezone, setTimezone] = useState<ITimezone>(
Intl.DateTimeFormat().resolvedOptions().timeZone
);
const selectProps = useChakraSelectProps<unknown, boolean>({
value: timezone,
onChange: () => {}
});
return (
<div className="App">
<h2>
<code>react-timezone-select</code> + <code>chakra-react-select</code>
</h2>
<div className="timezone--wrapper">
<TimezoneSelect
{...selectProps}
value={timezone}
onChange={setTimezone}
/>
</div>
</div>
);
} |
Beta Was this translation helpful? Give feedback.
9 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi, I've been using this wrapper with a system that uses chakra-ui and it's been amazing, thank you for maintaining this.
Recently we wanted to integrate this https://github.com/ndom91/react-timezone-select component and thought I could use the hook
useChakraSelectProps
to seamlessly integrate the two but there were a lot of type conflicts, why is that, is it something on my part to define/edit?I created a small reproducible example here: https://codesandbox.io/s/react-timezone-chakra-select-h6p6j0 with a functional one (without chakra-react-select) is in
App-default.tsx
.The type errors are mainly two, one in the
onChange
of the hook and others arearia-errormessage
aria-invalid
and some others.I'm not entirely sure whether the errors are due types/generics shenanigans in either chakra-react-select or react-timezone-select but thought to post here and maybe mention @ndom91 as well.
Beta Was this translation helpful? Give feedback.
All reactions