Set up React Native project without using react-native-cli - ios

So I'm learning React Native now, and I'm wondering how to set up an app manually, without using react-native-cli. The reason is that I want to set up app code within another project, but whenever I try to move code from a react-native-cli app to another folder containing other project code, I get build errors when running npx react-native run-ios (specifically, xcodebuild errors out with exit code 65). Actually, even if you create a project with react-native-cli and then just change the folder name you get the same build error.
I have template repos I use to start React projects, and I'd like to set one up for native projects, but it looks like it's not possible with the react-native-cli workflow. Is there another way to initialize a React Native project? I know the React docs have a section on integrating RN with existing native apps (https://facebook.github.io/react-native/docs/integration-with-existing-apps), but I don't have an existing native app, I'm starting a new one!
I have scoured the documentation and found nothing on this. Is there any way to find out what commands are run by react-native-cli? How can I set up my RN app from scratch?
EDIT: yes I have heard of Expo! It's all over the RN documentation. I'm asking about how to do the things that react-native init does, but with a more specialized/templated project structure.

As per latest react native documentation, the easiest way to get started is with Expo CLI. Expo is a set of tools built around React Native and, while it has many features, the most relevant feature for us right now is that it can get you writing a React Native app within minutes.
Expo also helps in testing app on phone via QR code.

Related

How to integrate ObjectiveC framework (IronSource) into Flutter (iOS Swift)?

I'm trying to integrate IronSource SDK in a iOS Flutter project (Swift project), but I am unable to do that. According to the IronSource documentation, I must point to IronSource.h file to include the bridge I need. And I am able to implement it in normal Xcode swift project, but I am unable to do that in flutter project since this bridge is already used by the flutter and it can be only one file.
So the question is: How can I integrate another ObjC library (IronSource) in the existing flutter ios project?
I am new to iOS development and Im battleing this for about a week now. I cant find anything on the internet that would work so any help will be much appreciated. Thanks
I managed to resolve my issue. It turns out that build paths are not case sensitive and I was using 'ironsource' for my plugin name but IronSourceSDK is using 'IronSource' so it looks like at build time it did not find the correct files.
And when this was working, I had to add 'use_frameworks! :linkage => :static' in the pod file of the plugin.
Then I could depend on it in my swift flutter app normally as any other plugin.

expo-secure-store not working in bare React Native App

I have an app, that is made in bare react native. I am trying to use expo's expo-secure-store. But, it's not working. It is giving me the following error:
[Error: The method or property SecureStore.setItemAsync is not available on ios, are you sure you've linked all the native dependencies properly?]
It was working in 1 of my expo apps.
I have react-native-unimodules installed, but, not expo.
Do I require to install expo too? I think that would defeat the whole purpose.
Are there any other alternatives that I can use? Or someone can tell me how to fix this.
Thanks

Submit an app created with create-react-native-app to the App Store (without XCode?)

Before, react-native 0.45, when you'd create a project, it would generate a XCode project file in the ios folder so that you can open it with XCode and use it to submit your app to the app store.
Since react-native 0.45, react native project are created with the create-react-native-app command and there is no xcode project anymore.
I read that you can "eject" to go back to the old style and get an XCode project. create-react-native-app is supposed to make everything easier, so I suppose there is a way to submit to the app store without ejecting that doesn't make the whole process much more painful than by using XCode.
To be clear: I understand that there are probably ways to submit to the app store without XCode, but aren't them much more painful? I can't believe that react-native would then consider it an improvement to not generate a XCode project anymore.
Could someone point me in the right direction?
Since react-native 0.45, react native project are created with the create-react-native-app command and there is no xcode project anymore.
This is incorrect. create-react-native-app is simply one of two ways to start a React Native project. The react-native init method of starting a project is still there in the docs.
To be clear: I understand that there are probably ways to submit to the app store without XCode, but aren't them much more painful? I can't believe that react-native would then consider it an improvement to not generate a XCode project anymore.
You are not going to get a good answer for this as it's very much down to opinion. StackOverflow is not the right place to ask such a question.
Could someone point me in the right direction?
Same with this question. Please read How to Ask to properly demonstrate what you've tried and exactly what issue you are running into.
As a starting point for learning how to publish, I suggest looking at the create-react-native-app documentation as it gives you two options right there:
Ejecting to generate the ios and android folders with which you can then publish.
Using a third party service like Expo to publish for you.
Their documentation goes a bit more into depth on the options. This is the best summary I can give as an answer without putting any of my opinions into it.

react native for ios seems to include a library from a previous project

So I am trying my first few tutorials with react native and therefore am still quite unfamiliar. I had followed this tutorial for using an npm camera in an IOS app. The camera worked find but I had to go an link this library for the camera. I tried it both the manual approach and rnpm. However, now I have a different tutorial on the go which I was messing around with prior to the camera one, and the simulator throws this error.
undefined is not an object (evaluating 'CameraManager.Aspect'), and further down there is also an error about a file which I know was only in my other tutorial(because I wrote it).
So this seems to me like xCode or the node modules for react are somehow still holding this code. I had previously added an entry to the header search paths under the projects build settings, but I looked at it and this path I needed for the camera is not there. So I don't know where this is coming in from.
I ran react-native run-ios on my project, and I tried cleaning the product in xcode and running from there. So far I haven't had very much luck figuring this out.
Ok so this was a simple human error on my behalf. I will post an answer to it anyhow as it might help some react-native beginners. So I had recently made the switch from linux to OSX, and when I started on there linux I had always run the packager for react native manually, and then I found out on OSX I can just run react-native run-ios in the root of the project and it starts another terminal window with the packager running.
The react-native packager was causing the issue. When I ran the react-native run-ios command the following day(didn't turn off my computer) the packager in the other window was forgotten about and I thought it be smart enough to kill that process and restart a new packager for the other project, but it didn't. Hopefully if anyone makes the same assumption you can save some time with this answer.

react-native integrating with existing ios apps

Have followed the instructions from here:
https://facebook.github.io/react-native/docs/embedded-app-ios.html#content
I am able to install required react sub specs and react spec with pod install
I was able to run the local react server to serve the bundles as well.
But I am seeing the following issues which is preventing my app from starting up in the iOS simulator.
/.../node_modules/react-native/React/Executors/RCTContextExecutor.m:560:7: Comparison of function 'JSGlobalContextSetName' not equal to a null pointer is always true
/.../node_modules/react-native/React/Base/RCTRootView.m:230:17: Method override for the designated initializer of the superclass '-initWithFrame:' not found
Can anybody help decyphering whats going on? Seems like it is specific to the RCTRootView implementation inside react library.
i figured the problem was with where i started the react-native app. It was not running from the project root. fixing that fixed the starting of the app in the simulator and these warnings werent the real root cause.

Resources