Well we finally got through all that use location stuff which is fantastic.
One last very quick thing I want to go through.
Remember we had said that whenever a user comes to the screen and navigates away we should disable location
tracking and at present we are doing that inside of track create screen through the use that is focused
flag.
However we also said that once a user starts recording and then navigates away we still want to record
at present.
If I tap on START RECORDING right here and then go back over to my terminal.
Definitely recording but if I navigate away the recording process stops and I can tell that because
the number five essentially just stops I don't see it anymore console logs inside here.
So how are we going to fix this.
Well it's not really going to be that bad back inside of track create screen.
Remember we've got the.
Is focused.
Flag right here that we're passing in as the first argument use location uses that first argument to
decide whether or not to start or stop tracking.
So if you want to modify whether or not we are tracking we can essentially append on some additional
value here.
So in other words we can say something like is focused or if we are currently recording.
So if we are currently focused on the screen or if we are recording we want to continue tracking our
users location so we can save this and then test out again so if I go back over I now am recording if
I go to track list screen the console log stop.
So clearly I'm no longer recording but if I go back over once again and start recording and then navigate
away it continues on until I go back to that screen once more hit stop.
And now it's back to original.
So I mean navigate away and now it's back to original where no more console logs.
So pretty easy know back inside of track create screen.
One thing only mentioned very quickly is that we've got three references to state DOT recording.
So just to condense our code a little bit we might decide to D structure off that recording property
off of our state variable so we could say colon recording like so now we can go round and change each
these two just recording recording and recording.
Very good.
All right.
That's one more little step forward.
Let's take another pause and continue in just a moment.