SteffeyDev / react-native-popover-view

A well-tested, adaptable, lightweight <Popover> component for react-native
MIT License
613 stars 92 forks source link

animationConfig not valid in typescript 3.6.3 #50

Closed evelant closed 4 years ago

evelant commented 5 years ago

Setting animationConfig to {duration: 100} results in a TS error. Maybe something changed on the RN side of the type definitions?

No overload matches this call.
  Overload 1 of 2, '(props: Readonly<PopoverViewProps>): Popover', gave the following error.
    Property 'toValue' is missing in type '{ duration: number; }' but required in type 'TimingAnimationConfig'.
  Overload 2 of 2, '(props: PopoverViewProps, context?: any): Popover', gave the following error.
    Property 'toValue' is missing in type '{ duration: number; }' but required in type 'TimingAnimationConfig'.

edit: small additional unrelated TS issue, Popover.MODE constants aren't in the .d.ts file resulting in TS errors when they are referenced.

SteffeyDev commented 5 years ago

I don't use TS for any of my projects and someone else added the .d.ts via pull request, I just accepted it as provided. Unfortunately, that means I have no clue how to help you here, but if you can figure it out I'd happily take a pull request.

evelant commented 5 years ago

OK, not sure when I'll have time to get to it but I'll try. As a workaround I just changed the animationConfig to {duration: 100, toValue: 100} and that makes the RN animatable types happy.

SteffeyDev commented 4 years ago

Just converted the whole thing to typescript, so this should be fixed. Re-open if it is still an issue.