Temzasse / react-modal-sheet

Flexible bottom sheet component built with Framer Motion to provide buttery smooth UX while keeping accessibility in mind 🪐
https://temzasse.github.io/react-modal-sheet/
MIT License
783 stars 74 forks source link

`onClick` is missing from backdrop props #131

Closed 12joan closed 1 year ago

12joan commented 1 year ago

Issue summary

Adding an onClick handler to the Backdrop component seems to be a supported use case, but onClick is missing from the component's prop type.

Code sandbox

https://codesandbox.io/s/practical-swartz-6h6shx?file=/src/App.tsx:132-171

Type '{ onClick: () => void; }' is not assignable to type 'IntrinsicAttributes & SheetBackdropProps & RefAttributes<any>'.
  Property 'onClick' does not exist on type 'IntrinsicAttributes & SheetBackdropProps & RefAttributes<any>'.ts(2322)

Expected behaviour

If components like Backdrop are passing rest props to the underlying HTML element, then the prop types for that HTML element should be included in the component prop type.

Temzasse commented 1 year ago

Most sheet components are motion components from Framer Motion so instead of onClick they have onTap.

12joan commented 1 year ago

@Temzasse Thanks for pointing that out! 😅

Maybe this could be documented here for people like me who aren't familiar with Framer Motion?