davidohayon669/react-native-youtube

Invariant violation: Native component for "RCTYoutube" does not exist

Closed this issue ยท 24 comments

Facing this issues when trying to use Youtube player in IOS ... I have correctly followed the installation steps and properly linked it ..
react and react-native version i am using is
"react": "16.2.0",
"react-native": "0.52.2"

simulator screen shot - iphone 6 - 2018-02-08 at 19 43 11

Add this: assets/YTPlayerView-iframe-player.html to your projects ios directory

have similar issue on android emulator
"react": "16.0.0",
"react-native": "0.51.0",
what could be a problem?
1

Tried it...didn't work...

@pacikav @rajatbeck You have to somehow link this native library with your React Native project. On the example app in this repo it is demonstrated with react-native link && rnpm link (must have both as global dependencies or local if registered in your project as an npm script.

More about native package's linking
(explains about iOS but Android should behave the same with regard to react-native link)

Same issue here.

Same here :(

you have to link the native projects.

  • react-native link
  • See if its properly included in settings.gradle and build.gradle also see the mainapplication java

this should be properly mentioned in the docs. as sometime react-native link does not work successfully

Solved it.. it was not linked properly.. it worked when tried doing it manually.

@rajatbeck what did you do exactly as manually. i have tried to add YTPlayerView-iframe-player.html to the root directory and all others linking things, but i still get same error.
"react": "16.3.1",
"react-native": "0.55.3",
"react-native-youtube": "^1.1.0",

@celalkasli I simply tried to link it manually, following the manually linking library documentation of react native
https://facebook.github.io/react-native/docs/linking-libraries-ios.html
The above link gives step by step the way to link your libraries manually.

Still, have the problem on Android! Everything linked correctly. On iOS all works.
Android tread here #300

Still having this issue. Any solution found?

@AownRaza are you using Cocoapods?

pod install

@nmartin867 Im doing it for Android

Solved it.. it was not linked properly.. it worked when tried doing it manually.

it's still error after manual link, How to resolve this error ๐Ÿ˜ญ

@rajatbeck The react-native docs say to add the .xcodeproj file...as far as I can tell this package does not have one, so which file did you manually add?

@evanb2 .xcodeproj file is present

/node_modules/react-native-youtube/RCTYouTube.xcodeproj

add this file manually. Hope this solves your problem

absolute37 i just tried to link it manually and everything worked out.
Maybe you are doing something wrong.
I hope you are using npm install react-native-youtube -S
because somehow if you install package through yarn add react-native-youtube it leads to invariant voilation

Restart your server and re-run the app.

Manually linking libRCTYouTube.a in xcode crashes the build. Abandoning this.

edit: forget manually linking, just run pod install and link the HTML file. No longer crashes, but now I'm stuck with a black box.

@SirCameron any solution in IOS,

this are not working .../node_modules/react-native-youtube/RCTYouTube.h:1:9: 'WKYTPlayerView.h' file not found

Screenshot 2019-11-11 at 4 30 52 PM

After installing the library i had this issue, then i did pod install but then i had this error in iOS:
requireNativeComponent: "RCTYouTube" was not found in the UIManager

I had to uninstall the app from the emulator and install it again in order for it to work.

npm install react-native-youtube -S

I am using yarn, Not able to link this library and kit too.
Same error here.

App update, More than react native 60.0 is only solution.then it is working fine.