Our form is looking great here for editing employees.
I mean the next thing they're going to work on is giving us our selves the ability to text the user
their schedule.
Now I'm going to tell you right now this might be a little bit underwhelming like texting people.
Gee that sounds like something that's really hard right.
Well this is one of the awesome things about Riak native.
It is incredibly easy to text people or at least to initiate the texting process.
We're not going to like automatically send off a text message to the Target employee.
We're going to kick our users over to their native text messaging client on the device and we'll let
them send the final message.
So it's going to be perhaps a little bit underwhelming but sometimes in programming that's actually
a very good thing to have happen.
So let's check out the package that's going to help us out inside my browser.
I've navigated over to NPM J.S. dot com.
This is where we can find documentation on all the different packages on NPM.
I'm going to look up a specific package called re-act native communications
and I'll navigate right to it.
So here is reac need of communications and then scroll down a little bit.
The fantastic thing about this package is that it works both for iOS and Android so we can use this
to not only text people but also to initiate phone calls e-mails.
So here is all the stuff about e-mails and then here's what we really care about texting as well.
And this is pretty much it.
That's all we've got to do.
We're going to call text passen the phone number that we want to text something to.
And the body of the text message.
So definitely something we don't need to overcomplicate here.
Let's first install this as an NPM package and my command line will do NPM install save re-act native
communications and I'm sure that's going to finish installing really quickly here.
So while that's going I'm back in my employee edit form inside of here I want to add a new button to
do our texting.
So here's my render method.
I've got the employee form here's the card section for with my button.
I am a little bit you know I don't know if I can make a separate card section for the thing.
I think I will.
Let's make a new card section for this second button that we're going to add.
I'm going to put a little bit of spacing between these just to make it all easier to read.
So add on and on press will say on text press about that
and then the text for the button lot in text schedule like so.
So now whenever someone touches this button we're going to call the helper method on text press.
Let's add that in right now on text.
Prus
and then back up at the top I will import.
Let's first make sure that the installation was successful.
Yep it is.
So I will import
communications from re-act native communications and then here comes the kind of disgustingly easy part.
I know I should try to make this make this a lot harder than it than it is.
We'll take our phone and our shift from our prop's object and we'll call it communications.
Text the phone number and I'll do it interpretated string here because all customize the message just
a little bit.
Your upcoming shift is on shift.
So I did use string interpolation here your template strings so make sure you get those back ticks instead
of regular quotes there.
Also I think that this message right here.
If Yeslam is complaining to do not sweat it this is not not something to worry about.
It's just saying hey it also has this export that you could grab.
Totally optional.
I really like having communications don't text as opposed to just not just text by itself.
Anyways let's test this out in our emulator.
So refresh
let's sign in
all go over to Jane and I'll text Jane the schedule and whenever I press this it looks like not quite
getting any response here.
So let's figure out what's going wrong in the next section