Search code examples
react-nativereact-native-svgreact-native-svg-chartsreact-native-chart-kit

Tried to register two views with the same name RNSVGRect


Facing this issue, when I am using two libraries react-native-d3multiline-chart for line chart and for the bar chart I am using react-native-svg-charts. Both the libraries are using same react-native-svg, when I am using react-native-svg, it is showing the above error. How can we fix it?


Solution

  • Use the library npm-force-resolutions, This modifies package-lock.json to force the installation of specific version of a transitive dependency (dependency of dependency), made the following changes to your package.json

    "resolutions": {
         "hoek": "4.2.1"
    }
    
    "scripts": {
      "preinstall": "npx npm-force-resolutions"
    }
    

    remove and install node_modules

    rm -rf node_modules && npm install

    hope this will work for you.