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

Bugfix: make animated work with arrow function component #910

Conversation

chenesan
Copy link
Contributor

I found out this bug when I'm working on #903: When we pass arrow function component, it will throw error because in createAnimatedComponent we check Component.prototype.isReactComponent to check if it's component created by create-react-class, but arrow function doesn't have .prototype property. This commit additionally check if .prototype exists to make arrow function component can work with animated().

To test this just try to pass an arrow function component into animated().

@aleclarson
Copy link
Contributor

arrow function doesn't have .prototype property

Wow, that's very weird.. 🤯

@chenesan chenesan force-pushed the bugfix/animated-should-work-with-arrow-func-component branch from 08ea8fa to c4d4cf0 Compare January 24, 2020 14:04
When we pass arrow function component, it will throw error because
in `createAnimatedComponent` we check
`Component.prototype.isReactComponent` to check if it's component
created by `create-react-class`, but arrow function doesn't
have `.prototype` property. This commit additionally check if
`.prototype` exists.
@chenesan chenesan force-pushed the bugfix/animated-should-work-with-arrow-func-component branch from c4d4cf0 to a2d71a7 Compare January 24, 2020 14:35
@aleclarson aleclarson merged commit ba3a33a into pmndrs:feat/spring-class Jan 24, 2020
@aleclarson
Copy link
Contributor

Thanks @chenesan 🎉

@chenesan chenesan deleted the bugfix/animated-should-work-with-arrow-func-component branch January 24, 2020 14:39
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.

2 participants