- Read Tutorial
- Watch Guide Video
In this section of the course we're going to start building out our PostFormScreen. Now, this PostFormScreen is going to entail a number of different components. We're going to work with forms, like we've already done earlier in the course with our authentication form but in this case, we're going to use the form to push data up and create records inside of our API's database. We're also going to start diving into working with the permissions on the device.
So we're going to enable the ability to ask for permissions, such as the ability to access the camera roll so that we can get those images, wrap them up so that the server can understand the data we're sending and then render that to the screen. So we're going to be building quite a bit in this section. So let's get started.
The first two things we're going to do in this guide is, we are going to install two dependencies in our application. The first one is going to be called expo-permissions and I have the documentation open right here.
[Capture #1 [1:10]]
The next one is going to be expoimagepicker and this has a helpful little animation to show you exactly how it works on iOS and on Android. So in this guide, we're simply going to install these two libraries, and then after that,
[Code-Block #1]
I want you to go through the documentation and study it and look at the examples and see exactly what they make available to you and that's going to help you to understand not only to build out our application but also to tell you what you need to know so you can work with these libraries in the future. So let's get started with that.
I'm going to pull open Visual Studio Code, and I'll open up the console here and for our first install, we're going to run expo install expo-permissions.
[Code-Block #2]
Now, you may have noticed that sometimes I run expo install and sometimes I run yarn add for installing libraries.
What my rule of thumb is with that is if it's a Expospecific library, like expo-permissions or the ImagePicker, then I run expo install. If it is an outside library, like Lodash, or something like that, then I'll run the yarn add. That's kinda the process that I personally follow.
So let's copy all of this right here and I'm going to run this first install. So this is going to grab all of expo-permissions, and you can see it also matches it to the version of the SDK.
[Capture #2 [2:48]]
This is a version of Expo that we're working with and it looks like that is all working and that ran properly. and let's do the same thing for the ImagePicker.
So I'm going to copy this. Expo install expoimagepicker and then I'll run that command. and it should install that and match it to the SDK that we have here. and the reason for that, the reason why sometimes I will pick to run expo install versus yarn add is that when I run yarn add, all that happens is yarn goes up to the npm js library and it pulls down whatever the latest stable version of the library is, and for most of the modules that you're going to work with, that works great. However, with Expo, Expo does one extra step and it's the reason why I use it for the Expospecific types of libraries, is it first checks to see the SDK that you have.
So if you're like me and you have a bunch of different apps, you could have apps in all different versions of Expo and so if you run one of these install commands, you want to make sure that the library that you're installing, such as a permissions library, matches up with the version of your application.
That's the reason why I have those two different options. So all of this looks like it worked. Everything is installed properly. So now I want you to take a little bit of time and I want you to go through the full ImagePicker and permissions library and it's also going to give you a preview of the code, we're going to write because the example usage that they give is going to be very similar to what we're going to be doing in the next guide as we build out our ImagePicker module.