Search code examples
react-nativeexpocreate-react-native-app

Ejected expo react native app requires expo?


I created a RN with create-react-native-app, and I have now decided to eject. It didn't work initially, and required some packages to be installed (@babel/...), but now, it complains that Module 'expo' does not exist in the Haste module map.

Why does it still require expo, now that it has been ejected? Or have I misunderstood what ejection does?

N.B. during the ejection I chose the option to eject to an RN app, not to ExpoKit. This is on iOS, currently.


Solution

  • When ejecting expo app you'll be asked about using expo-kit or just react-native and it's up to you to choose, plus Module 'expo' does not exist in the Haste module map means you still using expo in your code so double check your code to be sure that you're not importing expo anywhere and try again.

    TL;DR

    Ejected expo react native app requires expo? the short answer is no.

    when using expo app you have the ability to build your app using the expo server so you don't have to have Android Studio or XCode installed all you have to do is $ expo build:[android|ios] and download your built package after the build process is done also you can run your app using expo client app on Android and Ios but once ejecting you'll lose the ability of using expo server as your build environment instead you have to use Android Studio or XCode, but the main difference here is when you choose expo-kit you still have the ability of using expo client to run your app and you still have the ability to use expo modules inside your code but when you choose react-native you can't use expo client instead you have to use the native tools, anyway in all cases once you eject your project you have to build it yourself and you can't undo this step.

    Sidenote

    You can build very powerful apps using only JavaScript without any need to eject especially when using `expo SDK 31+, I'm working on an app now with features like detecting location, live maps, social login and chat and I don't need to eject it at all.

    Please take a look here and here

    Update:

    One last thing you have to remember is that when using expo or expo-kit you can keep developing ios app on any OS but when using react-native you can't do this you MUST have a mac.