'React Native - Error on importing third party library

I am trying to use a library react-native-tinder-swipe-cards - github

The issue is that it's giving the following error:

"Seems you're trying to access ReactNative.Component from the 'react-native' package. Perhaps you meant to access 'React.Component' from the 'react' package instead?"

I am using the latest version of react native. Although the error tells me what exactly to do, it's not actually part of my application that is causing the error. It's their library that is causing the issue because removing this line:

import SwipeCards from 'react-native-swipe-cards';

Removes the error. Has anyone had a similar problem and can help me resolve this?



Solution 1:[1]

The NPM published version is not up to date with React Native and is using the "old" way to bring in Component (from 'react-native' instead of 'react'). Looking at the github repo the code has actually been updated but nothing has been published to NPM for that update. Your best bet is to either contact the author and get them to publish a update to NPM or use the repo version (npm i git+https//github.com/meteor-factory/react-native-tinder-swipe-cards --save)

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 rmevans9