When initializing a new project I see there are 2 options :
react-native init AwesomeProject
create-react-native-app AwesomeProject (I chose this)
I have been trying to install react-native-navigation v2.0. There are instructions to modify the libraries within xcode. I'm unable to open my project in xcode. My new AwesomeProject does not have an .xcodeproj item. I'm having trouble understanding :
do all RN projects have a .xcodeproj item
are there fundamentals differences between the above project initialization commands where I actually won't be able to modify library files via xcode?
Thanks
The .xcodeproj is inside the /ios dir.
I haven't used create-react-native-app in quite some time, but I don't see why it wouldn't have an /ios folder.
Related
I would like to know if it's necessary to rebuild react native project after installing and linking libraries that includes native codes.
Yes, as react-native-link updates some native files that are under the ios/android folder, that won't be checked during a reload/hot-reload/live-reload. All those files aren't checked in your jsBundle and are compiled during a run-android or run-ios.
Of course, if you added a new dependecy to the project and linked it, and you haven't used it anywhere in your code yet, you don't need it. If you are using that dependecy, your project instance will, most likely, die.
if your react native version is below 0.60 then you have to run react-native-link after you install any react-native module. However after react-native version 0.60 and above, this is done automatically using the new "autolinking" feature added.
Read the changelog here:
https://facebook.github.io/react-native/blog/2019/07/03/version-60
However you still need to rebuild your project after you install a native module but you dont need to run the react-native-link command anymore after installing every library after react-native#0.60 and above. Just type react-native run-android
I have made a custom wrapper in android for react-native. When I am using react-native link to install dependancy in android for my Project, it is not doing any changes neither showing any errors. I have followed this document https://www.botreetechnologies.com/blog/how-to-build-a-react-native-android-bridge for same but I have to make changes in android files manually for my Module and package. Do I need to add build.gradle too in android directory? or any other file if I have missed. This is my file structure for bridge.
This is how I am importing my local package in another React Native package's package.json
I am following along the official documentation, copy and pasting the code provided there:
https://facebook.github.io/react-native/docs/0.56/native-components-ios
But I am still running into this error
does anyone know what the docs are missing to get this working?
This is happens because native module not compiled yet, simply execute react-native run-ios in terminal while in project directory.
Note: For latest node version use: npx react-native run-ios
RNTMapManager.m must be created within the XCode project, the docs do not specify that. Open the XCode project and click File -> New -> File and create a new Cocoa Touch Class called "RNTMapManager". Then place the objective-c code within RNTMapManager.m. Rebuild the application and it should work!
To be able to use native components make sure your project was ejected (expo eject)
Once ejected open for example iOS project with XCode and create/add file from Xcode. This way it will update all the dependencies.
Rebuild the project
When I run create-react-native-app AwesomeProject, no XCode project gets generated.
Just this files created :
It's a normal result. create-react-native-app is not supposed to create ios and android folders. It is to be used with Expo client.
If you want to have Xcode files, use react-native-cli:
On the top of this page, click "Building Projects with Native Code" instead of "Quick Start".
run npm run eject at the root of your project folder, it will create ios and android folders.
This will start the process of "ejecting" from Create React Native App's build scripts. You'll be asked a couple of questions about how you'd like to build your project.
1)What does it mean by saying native library? What sort of library ? are ones will be used as graddle dependencies ?
2)How to link these?
I was facing trouble while using link or rnpm.
Linking native library means that you are going to integrate already implemented module into your application or module which completes your react native's module functionality for eg: if you prepare a video player board with all the controls so in order to play the music you have to integrate react-native video (3rd party) because there is no inbuild lib. in react native. After integrating video lib you are good to go to play.
Steps to integrate lib(android):
1) Add package name to new packages()
2) Add dependencies to settings.gradle file and main application's gradle i.e app/gradle file.
3) sync the projects gradle because you made changes in the gradle and it's done.
After cloning/downloading the project:
1) Go to your project's home dir using cmd.
2) run npm install
3) Thereafter run rnpm link or react-native link
4) see ios folder in your project folder and if you find any pod file then run pod install after navigating into ios folder in cmd.
Cheers :)