You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We are using this library for creating a color picker popover in React. We followed the example but it gives some errors:
Types are wrong and the the event for changing the color does not work.
Types work when you declare the types in the file itself, but it is not a good practice.
exportdefaultColorPickerPopover;declare global {namespaceJSX{interfaceIntrinsicElements{"hex-color-picker": {color: string;onEventColorChanged: (event: CustomEvent<{value: string}>)=>void;};}}}
The function does not work cause the event name is wrong, and the color can be undefined. We haven't figured yet out what's the proper name for the event. Also, it seems it is not working cause we are not using jsx-native-events, and we don't want to use it cause it has been five years without any activity.
As we don't want to use react-colorful cause it also is not maintained, it is heavier than vanilla and we were trying to solve this issue, although it was not 100% fixed, We tried another way: making the color picker a React component using @lit/react.
We are using this library for creating a color picker popover in React. We followed the example but it gives some errors:
Types are wrong and the the event for changing the color does not work.
Our component is as follows:
And we declare the types on
custom.d.ts
:With the following
tsconfig.js
:Types work when you declare the types in the file itself, but it is not a good practice.
The function does not work cause the event name is wrong, and the color can be undefined. We haven't figured yet out what's the proper name for the event. Also, it seems it is not working cause we are not using
jsx-native-events
, and we don't want to use it cause it has been five years without any activity.We can find the parameters from here.
As we don't want to use
react-colorful
cause it also is not maintained, it is heavier than vanilla and we were trying to solve this issue, although it was not 100% fixed, We tried another way: making the color picker a React component using@lit/react
.As you can see, we rightly gave the name we wanted to the custom event and now it works fine.
What do you think about updating the React example?
The text was updated successfully, but these errors were encountered: