I want to use react-native-youtube
but it shows the error Native component for "RCTYouTube" does not exist
, i try to find the solution it looks like i have to link the library manually if the library with native code.
But i have no idea with this link talk about Manual linking Step1
https://facebook.github.io/react-native/docs/linking-libraries-ios.html
I use type command create-react-native-app testyoutube
to create my react native project, Visual Studio Code
is my tool.
I'm not familiar with Xcode
. I try to open my project folder testyoutube
in Xcode
. It will show an alert Could not open file.
If i want to follow Manual linking Step1
what step should i do ?
Here is my folder structure:
Any help would be appreciated. Thanks in advance.
To expand upon Adeel's answer:
Locate the RCTYouTube.xcodeproj at {your project root} /node_modules/react-native-youtube.
Use XCode to open your iOS project's .xcworkspace (or .xcodeproj if .xcworkspace does not exist).
Locate the 'Libraries' folder in the project navigator pane on the left hand side of the window and drag the RCTVideo.xcodeproj file inside it.
Select your project's target from the targets list pane on the inner left hand side of the window then scroll down to the 'Linked Libraries and Frameworks' section.
Click the plus symbol at the bottom of the section and use the search bar to find 'libRTCYouTube.a', select it from the results, and hit the 'Add' button.
Your library should now be linked!
You have two options to link libraries with your Xcode/Android project.
Automatic linking (run in your terminal in the root folder of your react-native project):
react-native link
Manual Setup: It's actually very simple. Open your react native xcode project (.xcodeproject file) with Xcode.
On the left side you have the project navigator. Drag the Xcode project from react-native-youtube inside the Libraries group.
Project Navigator
Next step is to add the library to you project. Click on the left side on your xcode project in the project navigator. Go to the libraries section and add the RCTYoutube library.
After you have setup everything up, rebuild the project and you are good to go!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With