David Jarrin
David Jarrin

Reputation: 1749

React Native Eject but still being able to use React Native code

I've built some little prototypes within Expo with React Native but now I'm in the middle of a real project and I'm now discovering I will definitely need to eject my project for certain components to work.

My question is, once I eject, can I ever write React Native Code without having to init again which I assume will erase any changes I made at the native level?

Any techniques or references are appreciated.

Upvotes: 0

Views: 149

Answers (1)

Bruno Eduardo
Bruno Eduardo

Reputation: 1393

Your question is a bit confusing, so I'll try to answer it as best as I can.

TL;DR: You will be able to write React Native code once you eject from Expo without having to use expo-cli init.

Expo Init

When you say "...can I ever write React Native Code without having to init again..." I assume you mean exp init (or expo-cli init) as opposed to react-native init. These commands merely initialize the project for you, so you shouldn't need to run them more than once.

For more information about how they differ from one another I recommend this GitHub issue thread.

Expo Eject

Expo allows you to eject your pure-JS project from the Expo iOS/Android clients, providing you with native projects that can be opened and built with Xcode and Android Studio. Those projects will have dependencies on ExpoKit, so everything you already built will keep working as it did before.

This means that when you eject your app you'll be writing React Native code outside of the Expo client environment, meaning you'll have access to the native code for Android and iOS. Even so, you will write normal React Native code (Javascript and JSX).

Also once you eject, Expo will add Expo Kit to your project which will give you access to some of Expo's features. For more information check their docs.

Upvotes: 1

Related Questions