question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

createAnimatedComponent should support stateless functional components [React Hooks]

See original GitHub issue

For Discussion

I am starting to play with hooks in react native following guide posted by hramos https://github.com/facebook/react-native/issues/21967#issuecomment-434113687

Off the bat I got an error

createAnimatedComponent does not support stateless functional components; use a class instead.

This was as a result of me converting my simplest components (that don’t rely on anything related to hooks) to functions and I assume will be an issue further down the road since vision of react for the future is to use less classes and more function components.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:10 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
hramoscommented, Nov 13, 2018

I don’t think this requires a new issue, you can comment on the original issue itself.

0reactions
tbermancommented, Aug 14, 2019

I just tried this w/ a forwardRef and received the same error, and looking at the code of how forwardRef works, it is unclear it would pass this check. Does the forwardRef trick still work for people running on 16.8?

Read more comments on GitHub >

github_iconTop Results From Across the Web

reactjs - Pass functional component to Animated ...
Coming from an app that uses react hooks, basically all of my component are functional. Is there a way / helper that can...
Read more >
useAnimatedProps | React Native Reanimated
useAnimatedProps. This hook is a counterpart of useAnimatedStyle hook, but works for a non-style view properties. It allows for defining a set of...
Read more >
Move to functional components from the class components.
We will be focusing on two hooks here and how to use them to convert class component to a functional component. useState. It...
Read more >
Use Functional component as Animated Component - FyndX
In React Native at this moment Animated.createAnimatedComponent can be used only with class based components but not with functional components.
Read more >
Using the State Hook - React
or this: function Example(props) { // You can use Hooks here! return <div />; }. You might have previously known these as “stateless...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found