Still cannot use `react-native link` after ejecting a Create React Native App

183 Views Asked by At

I started with a create-react-native app. Then, I wanted to add a dependency. So, I ran react-native link:

`react-native link` can not be used in Create React Native App projects. If you need to include a library that relies on custom native code, you might have to eject first. See https://github.com/react-community/create-react-native-app/blob/master/EJECTING.md for more information.

So, I ran npm run eject and it successfully ejected. There are many changes to the package.json and some scripts have been added.

But, if I now run react-native link, I still get the same error!! How can I successfully run this command? How does it determine that I'm still using create-react-native?

I'm guessing there's some flag somewhere that still says it's using create-react-native, but I don't know where it is. Any help is appreciated.

1

There are 1 best solutions below

0
On
react-native link

only works when you have added any new package eg:- npm i react-native-vector-icons. then you need to import package name to various class manually but if you dont want to do it you can directly run the command react-native link react-native-vector-icons OR react-native link

this will automatically add import the package to your ios and android files. Try these steps it will work.