nikitaeverywhere / react-xmasonry

Simple, minimalistic and featured native masonry layout for React JS.
https://zitros.github.io/react-xmasonry
MIT License
91 stars 12 forks source link

Please include ref props types for Typescript #24

Closed hjpunzalan closed 1 year ago

hjpunzalan commented 2 years ago

Hi,

Thank you for this wonderful tool. Could you please add props of ref of xMasonry component in the type file definition. Will it be possible to add gaps for this component?

nikitaeverywhere commented 2 years ago

Hello!

Sorry for the late reply; pull requests are very welcome!

tkmin commented 1 year ago

is anyone there typed ref props properly..? please share it via comment. thanks in advance!

tkmin commented 1 year ago

is anyone there typed ref props properly..? please share it via comment. thanks in advance!

I just needed containerWidth, so I wrote type like this below.. (maybe not a proper way, but it works anyway)

type CustomXMasonryProps = Component<XMasonryProps, {}, any> & { containerWidth: number };
const xMasonryRef = useRef<CustomXMasonryProps>(null);
nikitaeverywhere commented 1 year ago

I see no problem in using <XMasonry ref={...}></XMasonry>. What's the issue with it? Can you please reproduce or suggest a fix? Thanks!

nikitaeverywhere commented 1 year ago

Closing this due to inactivity.