So you learned how you can use to React Native CLI to create React Native projects.
These are projects which have no connection to expo and which are therefore totally managed by you and 00:12.260 -- 00:19.880 where you can therefore add any third-party package actually, including some expo packages which are available
outside of the managed workflow as well
but you need to configure everything on your own,
that can be easy depending on the package you're using but it also can be harder.
Now there is kind of a middle way between the expo managed workflow and the pure,
you need to do everything on your own, workflow and that's the expo bare workflow.
Now what's the bare workflow here?
The bare workflow includes a React Native app as you would created with the React Native CLI,
so not a managed app with expo as a wrapper but a native app, that however is already preconfigured
to support a lot of the expo packages,
not all but the expo team is working on making more and more available outside of the managed workflow
but a lot of them are already included and you could check the supported APIs page here to get an
idea for which features you can use in the bare workflow as well.
The idea behind the bare workflow is that you have this raw native development experience where you
need to use Android Studio and Xcode, so you don't have the expo CLI and the expo client helping
you, so you need to do that manually with the help of the React Native CLI
but where adding native functionality is easier,
so where you need to do less configuration maybe, where you can use these powerful native packages that
expo offers you where you can use all of that without having the limitations expo gives you,
though I want to put limitations into quotes because you don't have that many limitations actually in
the managed workflow.
So let me show you how to get started with that bare workflow and of course for that, you can also check
the official docs. Here
you need to have the expo CLI installed and we installed that at the beginning of the course of course
for creating our managed project
and you also need to have the React Native CLI installed. In addition and that's also important,
you should generally have the setup which is described here on the React Native docs under React Native
CLI quick start, so make sure you set up your system as described here for the different platforms,
the different operating systems you're targeting, so make sure you install Android Studio and Xcode
and all the dependencies you'll find here because you will use this workflow, you just get a little bit
more than this raw empty project you have here. So once you have all of that installed, you can create
a new bare workflow package with this command or in general by running expo init and then any project
name of your choice, like RNWithExpoBare and make sure you're running this command in a path where
you want to create this project folder.
So if you run this now, this will create a new expo project and this is also the prompt we saw at the
beginning of the course, there
I chose blank
and please note that this of course was part of the managed workflow,
what I chose at the beginning of the course,
now we can choose the bare workflow by going to the bare minimum selection here and hit enter
and what this does is it now creates a new project and we can now enter a name here for the app that's
visible on the home screen, RNBare and here also
RNBare.
So choose that here, hit enter and now this creates a new project,
I don't want to use yarn, I'll use npm instead.
This will create a new project, a new React Native project
pretty much like React Native init would do, so if you only used the React Native CLI but preconfigured
such that you can already use a lot of these supported or all of these supported APIs. Now important,
the project setup we're getting here could also be achieved with this React Native CLI created
set up where I didn't use the expo CLI at all because the magic happens with the help of these
React Native unimodules here.
This is a package in the end provided by the expo team which helps you tap into the native device
features you can get in the managed workflow outside of the managed workflow as well.
Now important, if you visit the github page of the React Native unimodules and you can simply search for
this name to find it, you'll also find instructions on how to add this to an existing React Native app.
Here you find instructions how you need to configure this and all this configuration which is described
here,
so all these things here right, which you need to do if you would want to use this package and therefore
the expo native features in a normal React Native non-expo app,
you would have to do them manually for such a project created with the React Native CLI
and that's exactly what expo init
with this bare workflow does for us, it gives us such a React Native project as if we would have created
it with the React Native CLI and it preconfigures it following all these steps,
so then we don't have to do that.
So that's something we can take advantage of of course,
so let me open this project,
this is now the RNWithExpoBare project I just created and there, you'll find some similarities to
the React Native project we created with the CLI,
pretty much the same config files, the same starting app.js content, now here actually expo used an
older version of React Native to create this which is why this looks a little bit different but in the
end, you'll get the same setup as with the React Native CLI
but as I mentioned with the Android and iOS folder with these Android and iOS projects preconfigured
as described on the unimodules page so that you don't have to do this
and with this preconfiguration, you can now easily add third-party packages, you can add any third-party
package, you could for example now
also again use the React Native image picker,
so what we added before, what we couldn't add to a managed workflow app,
this package here, you can easily add this to a bare workflow app because this is just a React Native app
without expo, so you can add this but now unlike in a normal React Native only app without expo, you
can also bring any of the expo APIs which are listed here, like the expo location package which we used
earlier in the course.
You can now easily install this by following the installation instructions you're linked to here for
the bare workflow, you would then have to follow the installation instructions you find here on the
expo location package, there you learn that you can install it with this command, then run port install
in the iOS directory and no extra setup for Android is required.
So fair enough, not too difficult and therefore you could maybe say you get the best of both worlds,
you have a native app with React Native CLI and you can still tap into some expo features, though
be aware of course that if you run this app, if you do this of course with react-native run-android for
example and therefore this requires Android Studio, it builds it locally on your system, you therefore
take a bit longer, you need to set up everything on your system and for deploying the app and so on
you also have to manage it all here on your local machine, so you get no convenience features which
expo gives you in the managed workflow where this building and testing is super quick, where you can
quickly test it on a real device and so on,
all of that is missing here too.
You have a React Native project without expo but using certain expo APIs is easier,
that's the idea behind the bare workflow and since expo has many amazing APIs, that of course is a
pretty good reason for using it because these APIs, these packages are also pretty guaranteed to be
continued and maintained
which is not necessarily the case for all other third-party packages
you might be adding to your React Native apps.