Search code examples
reactjsreact-nativereact-native-ioscreate-react-native-app

Create React Native App run on device


Okay So I'm extremely confused on how this all works...

I want to run my app on my device and not through Expo.

So I'm reading the Facebook documentation and told me to open up my ios directory and open up the xcode file. While I proceeded to look inside my directory of course I don't find my ios folder...lol (Don't understand why they don't tell us the step to actual create the folder..)

So I'm google and googling and find that I needed to eject. But in that documentation it told me it was permanent... Doesn't sound safe at all.... So I did it anyway and it created my ios folder.

I opened it up on xCode and deploy it to my phone.. Why is that the app looks completely different from the one it ran on expo locally...

If you look at the picture below, they're two different app..lol. Like come on what sort of trickery do I need to go through just to have my app run on my device without going through expo.

  1. Why is it showing 2 different apps?
  2. Future wise, Should I only eject when the app is completely done? Since I can't run it on expo anymore.. hence the permanent changes.. How would I test native device features? This honestly makes no sense.

enter image description here

enter image description here


Solution

  • How to start working on react-native ios without expo.

    1. brew install node
    2. npm install -g react-native-cli
    3. react-native init AwesomeProject
    4. open ios/AwsomeProject.xcodeproj in xcode

    You can also install cocoa pod and use AwsomeProject.xcworkspace.

    1. In account add ur ID Apple Id and download certificate manually
    2. In general menu add your apple id and press run enter image description here

    For next time open terminal

    1. cd project
    2. react-native run-ios --device "iPhone"

    Note: Write your device instead of iPhone. Hope I made things clear for beginners please feel free to correct me if i am wrong.