Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions targets/native/src/animated.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ForwardRefExoticComponent } from 'react'
import { ForwardRefExoticComponent, ReactNode } from 'react'
import { ViewStyle, RecursiveArray } from 'react-native'
import {
AssignableKeys,
Expand All @@ -19,9 +19,10 @@ export type WithAnimated = {
} & AnimatedPrimitives

/** The type of an `animated()` component */
export type AnimatedComponent<
T extends ElementType
> = ForwardRefExoticComponent<AnimatedProps<ComponentPropsWithRef<T>>>
export type AnimatedComponent<T extends ElementType> =
ForwardRefExoticComponent<
AnimatedProps<ComponentPropsWithRef<T>> & { children: ReactNode }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change seems to have broken the following code for me:

<animated.View style={{ opacity }} onTouchEnd={handleDismiss} />

It now gives this error:

error TS2741: Property 'children' is missing in type '{ style: { opacity: SpringValue<number>; }; onTouchEnd: () => void; }' but required in type '{ children: ReactNode; }'.

I think that this should have been:

Suggested change
AnimatedProps<ComponentPropsWithRef<T>> & { children: ReactNode }
AnimatedProps<ComponentPropsWithRef<T>> & { children?: ReactNode }

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indeed, could you open a PR?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah I should probably have linked that one, sorry 😅

#1925

It's merged now 🚀

>

/** The props of an `animated()` component */
export type AnimatedProps<Props extends object> = {
Expand Down