text
stringlengths
1
81
start
float64
0
10.1k
duration
float64
0
24.9
that all environments will actually have these.
517.94
2.03
And so fetch is something that's not supported by all browsers,
519.97
4.199
but by polyfilling it you can actually include
524.169
2.891
code that will implement fetch if it doesn't exist already.
527.06
2.88
And so things like fetch timers like set interval or console or console.log,
529.94
6.24
console.warn, and stuff like that have been polyfilled so
536.18
3.995
that they work in React Native as well.
540.175
4.144
And also the way that you handle navigation
544.319
1.791
is slightly different in React Native, and we'll
546.11
1.999
talk about that in a future lecture.
548.109
1.993
And so I said that React Native base components are slightly different.
550.102
2.958
And so what do I mean there?
553.06
2.81
So in React Web we had access to things like div or span or P image,
555.87
4.82
and we can just declare those globally.
560.69
2.84
But in React Native we actually have to import from the React Native library,
563.53
4.6
and we'll see how to do that in a little bit.
568.13
2.64
And so divs no longer exist and what we use instead are Views.
570.77
2.84
So View with a capital V is basically a cross-platform, just blank E-Y slate.
573.61
7.58
So basically the same thing as a div.
581.19
3.17
There's no such thing as span or P anymore
584.36
2.31
and so instead we use this text.
586.67
1.887
And so what's unique in React Native is that all text actually
588.557
2.583
must be wrapped by this text tag.
591.14
3.69
As you saw in this previous example lower case button
594.83
2.52
doesn't exist anymore.
597.35
1.45
Instead, we use capitol Button with a slightly different API.
598.8
2.81
And so from React Web, if you want to attach a handler to that
601.61
3.66
you do on click.
605.27
1.2
Whereas, in React Native, you do on press which was actually
606.47
3.78
the bug in the code earlier.
610.25
2.85
And lastly we have these things called scroll views or lists which
613.1
3.87
don't really exist in web world, but they do exist a lot in React Native,
616.97
5.82
and we'll be talking about those in the future as well.
622.79
2.852
Of course there are many, many other components
625.642
1.958
and, if you want to explore them, the documentation is really good.
627.6
3.84
Cool, so let's actually take that example
634.52
2.04
that we wrote last lecture, the to do app, and actually
636.56
3.36
translate it into React Native.
639.92
2.12
And so I have here this implementation, which is exactly the code
642.04
6.82
that we wrote in the previous lecture.
648.86
1.624
And what we're going to do is copy and paste that into the Snack
650.484
2.666
that we saw earlier and go ahead and translate that into React Native.
653.15
3.18
So this is just the command to copy it and let's actually
661.67
4.74
paste that into here.
666.41
3.15
So of course there's going to be many errors just because this is React Web
669.56
3.27
and we're trying to run this in React Native.
672.83
2.22
And so let's go ahead and try to fix those errors.
675.05
3.27
And so first we see stuff like LI, input, button, and those
678.32
4.71
don't exist in React Native.
683.03
1.32
And so we'll have to first replace those React Web
684.35
3.45
components with React Native ones.
687.8
3.85
And so this rendering does not exist anymore.
691.65
2.255
And so let's first do import some stuff from React Native.
693.905
6.375
And we'll be talking about imports and exports a little bit later,
700.28
3.82
but just bear with me for now.
704.1
1.73
And so some things that we're going to need are stuff like View,
705.83
3.16
we'll need a Button and we'll need text.
708.99
2.72
And we'll need some scrolling views and then maybe
715.88
4.71
some more stuff in a little bit.
720.59
2.07
So first let's work on that quick to do component.
722.66
3.36
And so we have a list item here, instead let's actually use a View.
726.02
3.15
Let's actually get rid of this input for now, and we'll add that in a little bit
734.2
4.35
later.
738.55
1.05
But how are we going to change this lowercase button to React Native?
739.6
4.336
Well first we need to replace it with the capital Button, which
743.936
2.624
is React Natives version of the button.
746.56
2.174
It no longer has an on click property and so instead we'll
748.734
2.416
pass an on press prop and then we don't actually wrap the content any more
751.15
6.69
instead we pass a title prop.
757.84
2.48
And so that button's done.
763.026
1.874
What are we going to do for span?
764.9
1.73
Anyone?
766.63
1.536
AUDIENCE: [INAUDIBLE]
768.166
0.874
SPEAKER 1: Yeah, we'll use a text instead.
769.04
1.749
And now our to do is done.
773.41
2.73
So now let's start looking into this app component.
776.14
3.201
So first let's get rid of this render, which does not exist in React Native,
782.17
5.94
and let's start working our way through this big return function here.
788.11
3.48
So first we have a div.
791.59
1.23
Instead of a div let's go ahead and use a View.
792.82
2.25
And then we have a to do count.
798.639
1.291
So what are we going to use instead of this div?
799.93
3.27
We can't use a View otherwise an error will
803.2
1.86
be thrown because remember the only way that we can include text
805.06
3.63
in React Native is by wrapping it in this text component and same thing
808.69
5.921
with this.
814.611
0.499
All right, we see another button and we've seen a button before,
817.924
2.666
so all we have to do is replace that lowercase b with a capital B,
820.59
3.5
change on click to on press and change the content to be title.
824.09
4.495
And then we're done there.
835.007
1.083
All right, UL, unordered lists.
841.39
2.29
So how might we handle this unordered list in React Native?
843.68
5.35
So lists, ULs and ordered lists don't actually
849.03
4.15
exist in React Native, and the way that we handled those instead
853.18
2.89
are by using the scrolling components because we don't know
856.07
6.815
how long that list is going to get and so we better
862.885
2.125
assume it's going to get pretty long and be able to scroll through them
865.01
2.07
if we needed.
867.08
1.31
And so unordered lists we replace with scroll view
868.39
4.18
and now we have what we were looking for.
872.57
3.01