简体   繁体   中英

React-Native Build Error after linking react-native-svg

I've had the error when trying to display a AreaChart in react-native that No View Manager defined for class RNSVGLine and found that for many people linking react-native to react-native-svg solved this issue. For me it just made me achieve a build error.

Unlinking it solves the build problem, but it is back to the previous error.

import { AreaChart } from 'react-native-svg-charts'

This is the import and the package and it is installed using npm.

return (
        <AreaChart
            style={ { height: 200 } }
            dataPoints={ data }
            fillColor={ 'rgba(134, 65, 244, 0.2)' }
            strokeColor={ 'rgb(134, 65, 244)' }
            contentInset={ { top: 30, bottom: 30 } }
            curve={shape.curveNatural}
        />
    );

and this is where I try to render it.

I have no more ideas of what to do, going in the MainApplication.java and manually importing it does not solve the problem for me.

The problem was that the compiled library version was not the same as the support library version. This was set in the android/build.gradle and app/build.gradle and in the .json file. After that linking react-native to react-native-svg no longer had the build error and worked.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM