nandorojo / solito

🧍‍♂️ React Native + Next.js, unified.
https://solito.dev
MIT License
3.53k stars 180 forks source link

Can't use react-native-reanimated with Expo Router Starter #450

Closed hubciorz closed 1 year ago

hubciorz commented 1 year ago

Is there an existing issue for this?

Do you want this issue prioritized?

Current Behavior

When I try to use useAnimatedStyle from react-native-reanimated in the next.js part in a fresh installation of npx create-solito-app@latest -t with-expo-router, I get this error:

Unhandled Runtime Error
Error: useAnimatedStyle was used without a dependency array or Babel plugin. Please explicitly pass a dependency array, or enable the Babel/SWC plugin.

For more, see the docs: https://docs.swmansion.com/react-native-reanimated/docs/fundamentals/web-support#web-without-a-babel-plugin

Expected Behavior

I should be able to use it without an error.

Steps To Reproduce

  1. Create a fresh solito project with npx create-solito-app@latest -t with-expo-router
  2. Add some component that uses useAnimatedStyle in packages folder
  3. Add a corresponding screen definition in apps/next
  4. Run yarn web and go to http://localhost:3000/path_to_the_screen

Versions

- Solito: 4.0.1
- Next.js: 13.4.19
- Expo: 49.0.0
- React Native: 0.72.2

Screenshots

Zrzut ekranu 2023-11-19 o 23 00 54

Reproduction

No response

nandorojo commented 1 year ago

Not sure how much more clear the error message could be (I wrote it). It explains how to fix it.

Pass an array to the hook as a dependency array.

hubciorz commented 1 year ago

Sorry, I was confused because the link redirects to a 404.

image
nandorojo commented 1 year ago

Ah, they changed their docs 🤦‍♂️

hubciorz commented 1 year ago

Yep. It should be https://docs.swmansion.com/react-native-reanimated/docs/guides/web-support#web-without-a-babel-plugin instead.

nandorojo commented 1 year ago

Got it, would be a good upstream PR then