Skip to content
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

Merged
merged 3 commits into from
Oct 10, 2021
Merged

fix(native): add children prop #1705

merged 3 commits into from
Oct 10, 2021

Conversation

CodyJasonBennett
Copy link
Member

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

  • Documentation updated
  • Demo added
  • Ready to be merged

Sorry, something went wrong.

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
@vercel
Copy link

vercel bot commented Oct 4, 2021

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/pmndrs/react-spring-io/2oVciidWZTrrXs32vrUKvSgtmmrq
✅ Preview: https://react-spring-io-git-fix-native-children-pmndrs.vercel.app

@codesandbox-ci
Copy link

codesandbox-ci bot commented Oct 4, 2021

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:

Sandbox Source
spring-card Configuration
spring-goo-blobs Configuration
spring-flip-card Configuration
spring-slide Configuration
spring-draggable-list Configuration
spring-cards-stack Configuration
spring-viewpager Configuration
spring-simple-transition Configuration
spring-image-fade Configuration
spring-list-reordering Configuration
spring-masonry Configuration
spring-animating-auto Configuration
spring-multistage-transition Configuration
spring-chain Configuration
spring-svg-filter Configuration
spring-css-keyframes Configuration
spring-tree Configuration
spring-notification-hub Configuration
initial-rocket Configuration
spring-notification-hub Configuration
spring-notification-hub Configuration

@joshuaellis joshuaellis merged commit d64db1d into master Oct 10, 2021
@joshuaellis joshuaellis deleted the fix/native-children branch October 10, 2021 10:57
> = 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 🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants