react-tinder-card icon indicating copy to clipboard operation
react-tinder-card copied to clipboard

Incompatible with RN 0.66.0 and React 17.0.2

Open roots-ai opened this issue 4 years ago • 3 comments

roots-ai avatar Mar 31 '22 14:03 roots-ai

React 18 now needs to you explicitly add a children property e.g. {children?: ReactNode}. I got this type error when I upgraded react. Screen Shot 2022-06-01 at 2 53 44 PM

Workaround

type TinderCardProps = Parameters<typeof TinderCard>[0]
type TinderCardPropsWithChildren = TinderCardProps & { children?: ReactNode }

const TinderCardWithChildren: FC<TinderCardPropsWithChildren> = TinderCard

seeker-3 avatar Jun 01 '22 19:06 seeker-3

Worked like a charm! Just didn't realize that you were supposed to use TinderCardWithChildren in place of the normal TinderCard.

KrishnaM251 avatar Jun 03 '22 00:06 KrishnaM251

Ah sorry, maybe that wasn't clear. It's just a type cast to add the missing type information. Glad that helped!

seeker-3 avatar Jun 06 '22 19:06 seeker-3