Skip to content

Invariant Violation caused by react-native-svg dependency #4

@choibles

Description

@choibles

Hey there –

First off, thanks for the library!

Had a puzzling FATAL crash recently occur when building my react-native iOS app, which makes use of react-native-svg-flagkit. I hadn't seen this issue before yesterday.. so it's possibly related to some updates in OS/SDK? (running macOS 10.15.4 and Xcode 11.5).

The error read: Unhandled JS Exception: Invariant Violation: Tried to register two views with the same name RNSVGRect

Sounded like a duplicate reference to react-native-svg, which was possible if one of my npm packages was pulling it in, since I'd already included react-native-svg in my own package.json.

After some investigation, I noticed that this library was pulling in react-native-svg into its own /node_modules folder, and after I deleted this "duplicate" module with the following command, the build worked:

rm -rf node_modules/react-native-svg-flagkit/node_modules/react-native-svg

Credit to this thread which tipped me off to the issue. Also appears that updating react-native-svg to a peer dependency (per this pull request) could potentially address the issue for the future.

Just wanted to leave an FYI for anyone experiencing the same issue, as well as document a potential fix for the package maintainers.

Cheers

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions