rainbow-me / react-native-animated-charts

Set of components and helpers for building complex and beautifully animated charts
MIT License
931 stars 111 forks source link

I get a error of Invariant Violation: Tried to register two views with the same name GestureHandlerRootView #83

Open 6ixline opened 2 years ago

6ixline commented 2 years ago

I get a error of Invariant Violation: Tried to register two views with the same name GestureHandlerRootView when i use react-native-animated-charts if i uninstall it everything work fine but whenever i import { ChartDot, ChartPath, ChartPathProvider } from '@rainbow-me/animated-charts'; to use it i get the error

ddikodroid commented 2 years ago

maybe related to this https://github.com/software-mansion/react-native-gesture-handler/issues/451#issuecomment-707353254

theIYD commented 2 years ago

Facing the same error.

Using GestureHandlerRootView to wrap the root for the bottom sheet package on Android.

Using Expo 45 with react-native-gesture-handler@2.2.1.

alwye commented 2 years ago

I might've managed to resolve this issue, although it wasn't a perfect solution.

My package.json required react-native-gesture-handler@~2.2.1

I noticed in my yarn.lock file that two versions were required simultaneously: ~2.2.1 directly and ^1.7.0 by react-native-animated-charts, which is this library:

"@rainbow-me/animated-charts@^1.0.0-alpha.6":
  version "1.0.0-alpha.6"
  resolved "https://registry.yarnpkg.com/@rainbow-me/animated-charts/-/animated-charts-1.0.0-alpha.6.tgz#b21a6886d4f662b7c12c10d3d2398f9e0d73d5bc"
  integrity sha512-mJMKiHLxuU5FPIn/WR+klzA4Ug68zI+eCaqiBjd+s1QGfO2EF/za1PgN0GtCmm5iFDqdnE8FEoRk8RAI5p9WtQ==
  dependencies:
    react-native-gesture-handler "^1.7.0"
    react-native-haptic-feedback "^1.10.0"
    react-native-reanimated "^2.0.0-alpha.5"
    react-native-svg "^12.1.0"

What I changed to fix the issue:

I had to change my dependency defined in package.json to the older version:

{
    ...,
    "dependencies": {
        ...,
        "react-native-gesture-handler": "^1.7.0"
    }
}

I consider this a temporary solution and ideally the underlying dependency should be updated here:

https://github.com/rainbow-me/react-native-animated-charts/blob/master/package.json#L20

tradebulls commented 2 years ago

Delete following package -- @rainbow-me/node-modules/react-native-gesture-handler. Rebuild the project and the issue is solved. Let me know if this helps

alwye commented 2 years ago

@tradebulls it might only work for manual builds. If you’re EAS (Expo Application Services) or any other kind of automated builds, that will fail

Guilherme-Mourelhe commented 2 years ago

Delete following package -- @rainbow-me/node-modules/react-native-gesture-handler. Rebuild the project and the issue is solved. Let me know if this helps

Use npm dedupe at node_modules and this It worked for me, thank God! Thanks bro.

crstnmac commented 1 year ago

Facing the same error.

Using GestureHandlerRootView to wrap the root for the bottom sheet package on Android.

Using Expo 45 with react-native-gesture-handler@2.2.1.

Did you find any possible fix for this???