0

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

Vikas Yadav
  • 3,094
  • 2
  • 20
  • 21
Victor Le
  • 1,758
  • 3
  • 17
  • 25
  • The second picture is your splash screen that shows before your app loads. – Matt Aft Dec 28 '17 at 01:34
  • @MattAft So i guess there was some sort of error that cause it to get stuck. – Victor Le Dec 28 '17 at 01:38
  • 2
    If you don't see any errors in xcode, try deploying on phone using a release build, I've heard it sometimes loads really slow. Also regarding expo, you don't need to eject to be able to use it on your phone, you only eject if you don't want to use expo anymore, for example if you want to use a native library that expo doesn't have. – Matt Aft Dec 28 '17 at 01:48
  • Also make sure you've done all this: https://facebook.github.io/react-native/docs/running-on-device.html – Matt Aft Dec 28 '17 at 01:49
  • If you're not using Expo, You don't need to re-eject again when you made changes on your code, but you need to run it using react-native run-ios OR react-native run-android. There's also an option for hot reloading that you can enable when you shake the device. – Tenten Ponce Dec 28 '17 at 02:19
  • @MattAft Hmm okay so just to confirm, you're saying that I can get the app downloaded onto my phone without using expo / eject command? How would I create the ios directory then? The documentation you gave me didn't say anything about creating that folder. It just says go into the non-existent folder lol – Victor Le Dec 28 '17 at 02:41
  • Expo doesn't expose ios/android specific directories, you do need to eject in order to get them. Be careful though, the Expo SDK does not work after ejecting. So ever `import {} from 'expo'` will not work. Can you share your project structure? The second screen is just the splash page. What's the contents of: `index.ios.js`, `index.android.js`, `index.js` and `App.js`? – Dan Dec 28 '17 at 09:19
  • @Dan hey dan, thanks for responding but I was able to figure everything out. Expo is just a wrapper from my understand and it's not really needed. the react-native cli does everything that I needed it to. I thought that running it on the device wouldn't give me the remote JS debugger unless I ran it through Expo. I ended up ejecting and work off of that directory excluding EXPO. I do have one question though and that is why does the initial loading take forever? After some time, it eventually lands on my actual app. Is this normal for a react native project to run on my personal device? – Victor Le Dec 28 '17 at 21:48

1 Answers1

1

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.

Pratik Khadka
  • 908
  • 8
  • 20