-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(native): add children prop #1705
Conversation
This pull request is being automatically deployed with Vercel (learn more). 🔍 Inspect: https://vercel.com/pmndrs/react-spring-io/2oVciidWZTrrXs32vrUKvSgtmmrq |
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. Latest deployment of this branch, based on commit 2c08298:
|
> = ForwardRefExoticComponent<AnimatedProps<ComponentPropsWithRef<T>>> | ||
export type AnimatedComponent<T extends ElementType> = | ||
ForwardRefExoticComponent< | ||
AnimatedProps<ComponentPropsWithRef<T>> & { children: ReactNode } |
There was a problem hiding this comment.
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:
AnimatedProps<ComponentPropsWithRef<T>> & { children: ReactNode } | |
AnimatedProps<ComponentPropsWithRef<T>> & { children?: ReactNode } |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why
As reported in #1572, react-spring does not accept props derived directly from React, like props.children.
What
This PR adds the children prop to AnimatedComponent's types.
Checklist