All language subtitles for tactiq-free-transcript-f8Z9JyB2EIE

af Afrikaans
ak Akan
sq Albanian
am Amharic
ar Arabic Download
hy Armenian
az Azerbaijani
eu Basque
be Belarusian
bem Bemba
bn Bengali
bh Bihari
bs Bosnian
br Breton
bg Bulgarian
km Cambodian
ca Catalan
ceb Cebuano
chr Cherokee
ny Chichewa
zh-CN Chinese (Simplified)
zh-TW Chinese (Traditional)
co Corsican
hr Croatian
cs Czech
da Danish
nl Dutch
en English
eo Esperanto
et Estonian
ee Ewe
fo Faroese
tl Filipino
fi Finnish
fr French
fy Frisian
gaa Ga
gl Galician
ka Georgian
de German
el Greek
gn Guarani
gu Gujarati
ht Haitian Creole
ha Hausa
haw Hawaiian
iw Hebrew
hi Hindi
hmn Hmong
hu Hungarian
is Icelandic
ig Igbo
id Indonesian
ia Interlingua
ga Irish
it Italian
ja Japanese
jw Javanese
kn Kannada
kk Kazakh
rw Kinyarwanda
rn Kirundi
kg Kongo
ko Korean
kri Krio (Sierra Leone)
ku Kurdish
ckb Kurdish (Soranî)
ky Kyrgyz
lo Laothian
la Latin
lv Latvian
ln Lingala
lt Lithuanian
loz Lozi
lg Luganda
ach Luo
lb Luxembourgish
mk Macedonian
mg Malagasy
ms Malay
ml Malayalam
mt Maltese
mi Maori
mr Marathi
mfe Mauritian Creole
mo Moldavian
mn Mongolian
my Myanmar (Burmese)
sr-ME Montenegrin
ne Nepali
pcm Nigerian Pidgin
nso Northern Sotho
no Norwegian
nn Norwegian (Nynorsk)
oc Occitan
or Oriya
om Oromo
ps Pashto
fa Persian
pl Polish
pt-BR Portuguese (Brazil)
pt Portuguese (Portugal)
pa Punjabi
qu Quechua
ro Romanian
rm Romansh
nyn Runyakitara
ru Russian
sm Samoan
gd Scots Gaelic
sr Serbian
sh Serbo-Croatian
st Sesotho
tn Setswana
crs Seychellois Creole
sn Shona
sd Sindhi
si Sinhalese
sk Slovak
sl Slovenian
so Somali
es Spanish
es-419 Spanish (Latin American)
su Sundanese
sw Swahili
sv Swedish
tg Tajik
ta Tamil
tt Tatar
te Telugu
th Thai
ti Tigrinya
to Tonga
lua Tshiluba
tum Tumbuka
tr Turkish
tk Turkmen
tw Twi
ug Uighur
uk Ukrainian
ur Urdu
uz Uzbek
vi Vietnamese
cy Welsh
wo Wolof
xh Xhosa
yi Yiddish
yo Yoruba
zu Zulu
Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated: 1 00:00:00,199 --> 00:00:02,600 the existence of react native makes 2 00:00:02,600 --> 00:00:04,680 react one of the most valuable skills 3 00:00:04,680 --> 00:00:08,160 you can learn think about it about 75% 4 00:00:08,160 --> 00:00:09,800 of what you already know from building 5 00:00:09,800 --> 00:00:11,840 websites carries over to mobile 6 00:00:11,840 --> 00:00:13,880 development and that's exactly what you 7 00:00:13,880 --> 00:00:15,719 learn in this video I used to compare 8 00:00:15,719 --> 00:00:18,560 react native to react but now it's more 9 00:00:18,560 --> 00:00:21,720 like nygs because now on mobile you can 10 00:00:21,720 --> 00:00:24,439 do everything from file based routing 11 00:00:24,439 --> 00:00:27,000 and component driven architecture to API 12 00:00:27,000 --> 00:00:29,480 routes even react server components 13 00:00:29,480 --> 00:00:32,520 react native is evolving fast and this 14 00:00:32,520 --> 00:00:34,680 crash course will help you keep up hi 15 00:00:34,680 --> 00:00:37,280 there I'm Adrien and welcome to the 16 00:00:37,280 --> 00:00:39,600 ultimate react native crash course in 17 00:00:39,600 --> 00:00:41,719 this course you'll learn react native 18 00:00:41,719 --> 00:00:44,480 from scratch Master the latest features 19 00:00:44,480 --> 00:00:47,600 and build a modern fully functional app 20 00:00:47,600 --> 00:00:49,879 we'll start with a quick look at react 21 00:00:49,879 --> 00:00:52,280 native's Journey why react native is the 22 00:00:52,280 --> 00:00:54,320 go-to choice and how it actually works 23 00:00:54,320 --> 00:00:56,760 an introduction to Expo the official 24 00:00:56,760 --> 00:00:59,120 react native framework mastering core 25 00:00:59,120 --> 00:01:01,879 building blocks file structures routing 26 00:01:01,879 --> 00:01:04,400 and more and then we'll dive straight 27 00:01:04,400 --> 00:01:07,520 into building a fully featured movie app 28 00:01:07,520 --> 00:01:09,680 with a home screen that has the top 29 00:01:09,680 --> 00:01:11,479 trends feature showing the hottest 30 00:01:11,479 --> 00:01:13,799 movies using an algorithm that you'll 31 00:01:13,799 --> 00:01:16,320 write and that will power using the open 32 00:01:16,320 --> 00:01:18,759 source tool called aite and you'll also 33 00:01:18,759 --> 00:01:20,960 be able to see some latest movies here 34 00:01:20,960 --> 00:01:22,960 then of course there's the custom tab 35 00:01:22,960 --> 00:01:25,680 navigation as search screen to find any 36 00:01:25,680 --> 00:01:28,200 movie in seconds and a full movie 37 00:01:28,200 --> 00:01:30,360 Details page where you can get all the 38 00:01:30,360 --> 00:01:33,439 info you need and more but this course 39 00:01:33,439 --> 00:01:35,399 isn't just about building an app it's 40 00:01:35,399 --> 00:01:37,600 about building it the right way by 41 00:01:37,600 --> 00:01:40,920 writing clean scalable and maintainable 42 00:01:40,920 --> 00:01:42,799 code and to make your journey even 43 00:01:42,799 --> 00:01:45,200 easier I've put together a free react 44 00:01:45,200 --> 00:01:47,320 native roadmap that covers the essential 45 00:01:47,320 --> 00:01:49,200 tools you need to know the projects you 46 00:01:49,200 --> 00:01:51,520 should build and the exact path to 47 00:01:51,520 --> 00:01:53,200 getting hired as a react native 48 00:01:53,200 --> 00:01:55,240 developer you can download it now it's 49 00:01:55,240 --> 00:01:56,920 completely free and the link is in the 50 00:01:56,920 --> 00:01:59,119 description so by the time you finish 51 00:01:59,119 --> 00:02:01,840 this course you won't just know react 52 00:02:01,840 --> 00:02:03,799 native you'll be shipping relaps with 53 00:02:03,799 --> 00:02:11,879 confidence so let's build something 54 00:02:11,879 --> 00:02:15,000 great before react native building 55 00:02:15,000 --> 00:02:17,040 mobile applications for multiple 56 00:02:17,040 --> 00:02:20,160 platforms was a nightmare you had to 57 00:02:20,160 --> 00:02:22,840 write separate code bases for IOS and 58 00:02:22,840 --> 00:02:25,360 Android which meant double the work 59 00:02:25,360 --> 00:02:27,879 higher costs and slower development 60 00:02:27,879 --> 00:02:30,920 Cycles but with react native you can 61 00:02:30,920 --> 00:02:33,200 write a single code base that works 62 00:02:33,200 --> 00:02:35,720 seamlessly on both platforms making 63 00:02:35,720 --> 00:02:38,200 development faster cheaper and more 64 00:02:38,200 --> 00:02:40,680 efficient and it's not just me saying 65 00:02:40,680 --> 00:02:44,159 this big companies like meta Discord 66 00:02:44,159 --> 00:02:47,760 Microsoft Tesla Amazon Airbnb and even 67 00:02:47,760 --> 00:02:50,480 Call of Duty use react native to build 68 00:02:50,480 --> 00:02:52,879 their mobile apps react native has 69 00:02:52,879 --> 00:02:55,400 evolved so much that you'll find fewer 70 00:02:55,400 --> 00:02:57,760 people flattering these days and with 71 00:02:57,760 --> 00:03:00,280 the release of react's new architecture 72 00:03:00,280 --> 00:03:02,400 performance has been improved 73 00:03:02,400 --> 00:03:04,959 significantly so the next time someone 74 00:03:04,959 --> 00:03:08,599 says Hey react native apps are slow just 75 00:03:08,599 --> 00:03:11,799 take a deep breath and say not anymore 76 00:03:11,799 --> 00:03:14,560 flut boy let me break it down first 77 00:03:14,560 --> 00:03:17,840 there's the new JSI JavaScript interface 78 00:03:17,840 --> 00:03:20,560 which replaces the old bridge allowing 79 00:03:20,560 --> 00:03:22,840 JavaScript to communicate directly with 80 00:03:22,840 --> 00:03:25,080 the native code for a faster and 81 00:03:25,080 --> 00:03:27,640 smoother performance then there are the 82 00:03:27,640 --> 00:03:30,159 new turbo modules that load native 83 00:03:30,159 --> 00:03:32,519 modules only when needed reducing 84 00:03:32,519 --> 00:03:35,799 startup time and memory usage and third 85 00:03:35,799 --> 00:03:38,280 there's a new thing called fabric which 86 00:03:38,280 --> 00:03:41,519 optimizes UI rendering making animations 87 00:03:41,519 --> 00:03:44,480 gestures and updates faster and more 88 00:03:44,480 --> 00:03:47,879 efficient with JSI turbo modules and 89 00:03:47,879 --> 00:03:51,120 fabric react native apps are now as fast 90 00:03:51,120 --> 00:03:53,920 and smooth as the native ones and aside 91 00:03:53,920 --> 00:03:56,000 from its new architecture crossplatform 92 00:03:56,000 --> 00:03:58,680 support and Native components react 93 00:03:58,680 --> 00:04:01,200 native also comes with hard reloading 94 00:04:01,200 --> 00:04:03,079 allowing you to see the changes you code 95 00:04:03,079 --> 00:04:05,480 instantly a huge community that just 96 00:04:05,480 --> 00:04:08,159 keeps on growing and an easy learning 97 00:04:08,159 --> 00:04:10,000 curve which means that if you already 98 00:04:10,000 --> 00:04:12,040 know JavaScript and react you can 99 00:04:12,040 --> 00:04:14,439 quickly pick up react native and that's 100 00:04:14,439 --> 00:04:17,238 exactly what we'll do today in this 101 00:04:17,238 --> 00:04:20,199 video we'll use Expo to build a react 102 00:04:20,199 --> 00:04:22,720 native application and before you say 103 00:04:22,720 --> 00:04:26,120 wait real developers don't use Expo hold 104 00:04:26,120 --> 00:04:28,759 on if you check react natives official 105 00:04:28,759 --> 00:04:31,360 documentation Expo is the recommended 106 00:04:31,360 --> 00:04:35,000 way to get started read that again but 107 00:04:35,000 --> 00:04:37,039 what the heck even is Expo you're 108 00:04:37,039 --> 00:04:39,880 familiar with tools like vit right well 109 00:04:39,880 --> 00:04:42,639 Expo is just that only for react native 110 00:04:42,639 --> 00:04:45,759 apps it provides many tools and services 111 00:04:45,759 --> 00:04:48,000 that simplify development and help you 112 00:04:48,000 --> 00:04:50,960 build your app more easily Expo is the 113 00:04:50,960 --> 00:04:54,600 react native what nextjs is the react 114 00:04:54,600 --> 00:04:56,759 it's a framework that simplifies react 115 00:04:56,759 --> 00:04:58,919 native development by handling the 116 00:04:58,919 --> 00:05:01,120 development enir setup which means that 117 00:05:01,120 --> 00:05:02,840 you don't need to separately install 118 00:05:02,840 --> 00:05:05,479 Android Studio native dependencies and 119 00:05:05,479 --> 00:05:07,919 pre-built components for navigation 120 00:05:07,919 --> 00:05:10,680 gestures camera maps and more it also 121 00:05:10,680 --> 00:05:12,800 supports something known as overthe a 122 00:05:12,800 --> 00:05:15,400 updates so your app users can get the 123 00:05:15,400 --> 00:05:18,120 latest code without needing App Store 124 00:05:18,120 --> 00:05:21,560 approvals and this is huge with Expo you 125 00:05:21,560 --> 00:05:24,319 can deploy your app in minutes but don't 126 00:05:24,319 --> 00:05:26,639 just take my word for it companies like 127 00:05:26,639 --> 00:05:30,479 Discord Burger King coinbase X box and 128 00:05:30,479 --> 00:05:32,800 more than 2,000 companies are using Expo 129 00:05:32,800 --> 00:05:36,800 for their tools and Expo just like njs 130 00:05:36,800 --> 00:05:39,199 just keeps on getting better so if you 131 00:05:39,199 --> 00:05:41,039 still think react native CLI is the 132 00:05:41,039 --> 00:05:43,520 better option well think twice so now 133 00:05:43,520 --> 00:05:45,120 that you understand the importance of 134 00:05:45,120 --> 00:05:47,720 react native and apparently how easy it 135 00:05:47,720 --> 00:05:50,240 is to build apps with it let me show you 136 00:05:50,240 --> 00:05:52,160 I'll first teach you some basic react 137 00:05:52,160 --> 00:05:54,600 native Concepts and then very quickly 138 00:05:54,600 --> 00:05:57,360 into this video you'll build a real 139 00:05:57,360 --> 00:06:00,400 mobile movie application so let's Dive 140 00:06:00,400 --> 00:06:03,560 Right In all right let's Jump Right In 141 00:06:03,560 --> 00:06:05,280 we've already talked about the benefits 142 00:06:05,280 --> 00:06:07,720 and drawbacks of react native and how 143 00:06:07,720 --> 00:06:10,400 Expo can make your life easier now it's 144 00:06:10,400 --> 00:06:12,280 time to dive into the code and see how 145 00:06:12,280 --> 00:06:15,680 it works if you worked with react GS 146 00:06:15,680 --> 00:06:17,680 before you'll find that react native 147 00:06:17,680 --> 00:06:20,599 uses a similar syntax but of course 148 00:06:20,599 --> 00:06:22,280 there are some differences you should be 149 00:06:22,280 --> 00:06:24,880 aware of so let me show you the ins and 150 00:06:24,880 --> 00:06:26,880 outs of react native code we can check 151 00:06:26,880 --> 00:06:28,880 out how it looks and how it functions 152 00:06:28,880 --> 00:06:31,599 when compared to to react GS to help you 153 00:06:31,599 --> 00:06:33,840 understand the similarities but also the 154 00:06:33,840 --> 00:06:35,880 differences between the two so super 155 00:06:35,880 --> 00:06:37,720 quickly you'll understand the react 156 00:06:37,720 --> 00:06:39,919 native's components and how to use them 157 00:06:39,919 --> 00:06:42,400 when coding in react native you use 158 00:06:42,400 --> 00:06:45,599 JavaScript just like with react but 159 00:06:45,599 --> 00:06:48,000 instead of rendering HTML elements 160 00:06:48,000 --> 00:06:50,919 you'll be rendering native mobile 161 00:06:50,919 --> 00:06:53,199 components take a look at this basic 162 00:06:53,199 --> 00:06:55,720 react native component here we're 163 00:06:55,720 --> 00:06:58,000 importing two important components from 164 00:06:58,000 --> 00:07:01,639 react native Library View and text then 165 00:07:01,639 --> 00:07:03,520 we create a functional component called 166 00:07:03,520 --> 00:07:05,800 app that Returns the text component 167 00:07:05,800 --> 00:07:07,560 wrapped inside of a view what's 168 00:07:07,560 --> 00:07:09,840 interesting here is that we're using jsx 169 00:07:09,840 --> 00:07:12,280 syntax which makes it super easy to 170 00:07:12,280 --> 00:07:14,759 create and visualize our components in a 171 00:07:14,759 --> 00:07:17,479 more HTML like way but if you take a 172 00:07:17,479 --> 00:07:19,319 closer look you can quickly see that 173 00:07:19,319 --> 00:07:22,960 this is neither a P tag nor an H tag nor 174 00:07:22,960 --> 00:07:24,400 anything that we're used to while 175 00:07:24,400 --> 00:07:27,199 writing code that runs in the browser in 176 00:07:27,199 --> 00:07:30,520 react native we use text instead said 177 00:07:30,520 --> 00:07:32,160 it's pretty straightforward the text 178 00:07:32,160 --> 00:07:34,599 component is used to display text in the 179 00:07:34,599 --> 00:07:36,759 app and you can style it using the same 180 00:07:36,759 --> 00:07:39,599 CSS like syntax as in react you can set 181 00:07:39,599 --> 00:07:42,160 the font size color and weight using the 182 00:07:42,160 --> 00:07:45,039 style prop react native also offers a 183 00:07:45,039 --> 00:07:47,560 Styles sheet utility that allows you to 184 00:07:47,560 --> 00:07:49,720 Define styles by creating a single 185 00:07:49,720 --> 00:07:52,120 JavaScript object this is super handy in 186 00:07:52,120 --> 00:07:54,319 larger applications as it optimizes 187 00:07:54,319 --> 00:07:56,800 performance but as we all know tailin 188 00:07:56,800 --> 00:08:00,000 CSS is rising in popularity so so in 189 00:08:00,000 --> 00:08:02,440 react native World native wind came into 190 00:08:02,440 --> 00:08:04,400 the picture allowing you to write 191 00:08:04,400 --> 00:08:06,759 Tailwind likee CSS Styles in react 192 00:08:06,759 --> 00:08:09,080 native isn't this crazy it feels like 193 00:08:09,080 --> 00:08:11,479 you're writing a regular web app but 194 00:08:11,479 --> 00:08:13,240 instead you're developing apps for 195 00:08:13,240 --> 00:08:15,479 mobile now let's talk a bit about the 196 00:08:15,479 --> 00:08:18,520 view component think of it as a box or 197 00:08:18,520 --> 00:08:21,360 container that holds other components 198 00:08:21,360 --> 00:08:24,039 similar to the development in HTML but 199 00:08:24,039 --> 00:08:25,759 with some added functionality specific 200 00:08:25,759 --> 00:08:28,280 to mobile apps The View component is 201 00:08:28,280 --> 00:08:31,000 often used to create layout structures 202 00:08:31,000 --> 00:08:32,240 for other 203 00:08:32,240 --> 00:08:34,799 components it has many different props 204 00:08:34,799 --> 00:08:36,279 that can be used to control its 205 00:08:36,279 --> 00:08:37,719 appearance and 206 00:08:37,719 --> 00:08:40,159 behavior and one thing to note is that 207 00:08:40,159 --> 00:08:43,000 the view component uses flexbox layout 208 00:08:43,000 --> 00:08:45,839 by default which makes it really easy to 209 00:08:45,839 --> 00:08:47,839 control how its children components are 210 00:08:47,839 --> 00:08:50,440 laid out so you can use flexbox 211 00:08:50,440 --> 00:08:53,040 properties like Flex Direction justify 212 00:08:53,040 --> 00:08:55,800 content and align items to achieve any 213 00:08:55,800 --> 00:08:57,839 layout you want but what if you want to 214 00:08:57,839 --> 00:08:59,680 add some interactivity to your re act 215 00:08:59,680 --> 00:09:02,160 native apps well get excited because 216 00:09:02,160 --> 00:09:04,160 there are some amazing components that 217 00:09:04,160 --> 00:09:06,320 do just that components for creating 218 00:09:06,320 --> 00:09:08,959 buttons links and other interactive 219 00:09:08,959 --> 00:09:11,760 elements the first one on the list is 220 00:09:11,760 --> 00:09:13,920 touchable opacity which is great if you 221 00:09:13,920 --> 00:09:15,800 want to create a simple button think of 222 00:09:15,800 --> 00:09:18,120 it like a cousin to a react button 223 00:09:18,120 --> 00:09:20,680 component but with even more room for 224 00:09:20,680 --> 00:09:22,920 customization and instead of an onclick 225 00:09:22,920 --> 00:09:25,160 in react native you're not clicking it 226 00:09:25,160 --> 00:09:27,440 you're pressing it so let's provide an 227 00:09:27,440 --> 00:09:30,320 on press the second similar component is 228 00:09:30,320 --> 00:09:32,760 called a touchable highlight which 229 00:09:32,760 --> 00:09:35,680 allows views to respond to touch in a 230 00:09:35,680 --> 00:09:38,640 unique way when touched the component 231 00:09:38,640 --> 00:09:41,279 reduces the opacity of the wrapped div 232 00:09:41,279 --> 00:09:43,680 revealing the underlying color and then 233 00:09:43,680 --> 00:09:45,839 there's the touchable without feedback 234 00:09:45,839 --> 00:09:47,279 which is there if you need to create an 235 00:09:47,279 --> 00:09:50,040 element that is clickable but you don't 236 00:09:50,040 --> 00:09:52,240 want it to have any visual feedback when 237 00:09:52,240 --> 00:09:55,079 pressed it is super useful when creating 238 00:09:55,079 --> 00:09:57,360 links or images that don't need any 239 00:09:57,360 --> 00:09:59,640 additional effects and apart from these 240 00:09:59,640 --> 00:10:01,600 touchable components there's also 241 00:10:01,600 --> 00:10:03,839 activity indicator which allows you to 242 00:10:03,839 --> 00:10:06,600 show a spinner or a loading indicator 243 00:10:06,600 --> 00:10:08,519 within your app sure there's also a 244 00:10:08,519 --> 00:10:10,360 simple button allowing you to set 245 00:10:10,360 --> 00:10:12,880 properties like the title color and an 246 00:10:12,880 --> 00:10:14,920 on press that is called when the button 247 00:10:14,920 --> 00:10:16,720 is pressed but whenever you need some 248 00:10:16,720 --> 00:10:19,399 more Advanced Styling or behavior you'll 249 00:10:19,399 --> 00:10:21,040 find yourself using the touchable 250 00:10:21,040 --> 00:10:23,560 components much more often as they offer 251 00:10:23,560 --> 00:10:26,480 greater flexibility now the next super 252 00:10:26,480 --> 00:10:28,399 important component on the list of 253 00:10:28,399 --> 00:10:29,880 components I want toach teacher right 254 00:10:29,880 --> 00:10:32,079 now and which we'll use later on within 255 00:10:32,079 --> 00:10:34,560 our app is called a 256 00:10:34,560 --> 00:10:37,760 flatlist a flatlist is perfect for 257 00:10:37,760 --> 00:10:40,839 rendering long lists of items that need 258 00:10:40,839 --> 00:10:43,160 to be scrolled it's like the map 259 00:10:43,160 --> 00:10:45,480 function in react but with some extra 260 00:10:45,480 --> 00:10:47,519 features like optimized scroll 261 00:10:47,519 --> 00:10:50,079 performance and item separation the way 262 00:10:50,079 --> 00:10:52,360 it works is you of course import it from 263 00:10:52,360 --> 00:10:54,800 react native and then you define some 264 00:10:54,800 --> 00:10:56,760 data such as an array of objects you 265 00:10:56,760 --> 00:10:59,600 want to map over then you put it all in 266 00:10:59,600 --> 00:11:03,200 a view and you call it flatlist a 267 00:11:03,200 --> 00:11:05,880 flatlist by default already accepts some 268 00:11:05,880 --> 00:11:08,240 props such as the data prop to which you 269 00:11:08,240 --> 00:11:10,079 can pass an array of data you want to 270 00:11:10,079 --> 00:11:13,079 map over and then a render item prop 271 00:11:13,079 --> 00:11:15,839 which allows you to Define exactly how 272 00:11:15,839 --> 00:11:18,200 you want to represent each item in the 273 00:11:18,200 --> 00:11:21,079 array pretty cool right now when should 274 00:11:21,079 --> 00:11:23,560 you use a flat list and when should you 275 00:11:23,560 --> 00:11:25,079 just map over the 276 00:11:25,079 --> 00:11:27,959 elements well for larger lists where you 277 00:11:27,959 --> 00:11:29,839 want to have smooth scrolling 278 00:11:29,839 --> 00:11:32,040 go for the flat list while for the 279 00:11:32,040 --> 00:11:34,120 smaller lists the map function will do 280 00:11:34,120 --> 00:11:35,880 the job there's also something known as 281 00:11:35,880 --> 00:11:38,680 a scroll view you can think of it like a 282 00:11:38,680 --> 00:11:40,760 magic box that can hold multiple 283 00:11:40,760 --> 00:11:42,800 components and Views providing you a 284 00:11:42,800 --> 00:11:45,160 scrolling container for them it's like 285 00:11:45,160 --> 00:11:47,600 the Overflow scroll property of a div in 286 00:11:47,600 --> 00:11:50,560 HTML allowing you to easily navigate 287 00:11:50,560 --> 00:11:52,920 through a list of items or large amounts 288 00:11:52,920 --> 00:11:54,600 of content in our app you can put it 289 00:11:54,600 --> 00:11:56,839 within a view call it scroll View and 290 00:11:56,839 --> 00:11:58,600 then render some elements within it by 291 00:11:58,600 --> 00:12:00,600 using the scroll view component you can 292 00:12:00,600 --> 00:12:02,720 make sure that users can easily explore 293 00:12:02,720 --> 00:12:04,959 all the content making your app more 294 00:12:04,959 --> 00:12:06,880 intuitive and there's also a component 295 00:12:06,880 --> 00:12:08,839 which you'll find yourself using super 296 00:12:08,839 --> 00:12:12,160 often called safe area view which gives 297 00:12:12,160 --> 00:12:14,519 you some sort of a safe Zone to render 298 00:12:14,519 --> 00:12:16,800 your apps content within without it 299 00:12:16,800 --> 00:12:18,959 being covered by the devices Hardware 300 00:12:18,959 --> 00:12:21,800 features like the notch home indicator 301 00:12:21,800 --> 00:12:23,959 or a status bar it's great for building 302 00:12:23,959 --> 00:12:25,720 apps that are supported on different 303 00:12:25,720 --> 00:12:28,160 devices with different screen sizes and 304 00:12:28,160 --> 00:12:30,959 shapes the way you use it is whenever 305 00:12:30,959 --> 00:12:32,959 you think something might be too long or 306 00:12:32,959 --> 00:12:34,920 awkwardly placed you just wrap it within 307 00:12:34,920 --> 00:12:37,279 a safe area View and while that default 308 00:12:37,279 --> 00:12:40,440 safe area view is amazing for most cases 309 00:12:40,440 --> 00:12:42,320 sometimes it does fall short for some 310 00:12:42,320 --> 00:12:45,360 devices making it not the optimal choice 311 00:12:45,360 --> 00:12:47,920 so I often like to use a package called 312 00:12:47,920 --> 00:12:50,560 react native safe area context which 313 00:12:50,560 --> 00:12:53,199 works across all devices even for the 314 00:12:53,199 --> 00:12:55,040 Bottom bar but you don't have to worry 315 00:12:55,040 --> 00:12:56,839 about remembering all of that right now 316 00:12:56,839 --> 00:12:58,480 I'll show it to you once you start 317 00:12:58,480 --> 00:13:01,360 developing your own first app but bear 318 00:13:01,360 --> 00:13:03,399 with me for a moment I first want you to 319 00:13:03,399 --> 00:13:05,839 know which components exist so we can 320 00:13:05,839 --> 00:13:07,839 later on use them more easily for 321 00:13:07,839 --> 00:13:09,800 example we'll surely have to display 322 00:13:09,800 --> 00:13:12,120 some images within our app right so how 323 00:13:12,120 --> 00:13:14,519 can we do that in react native well 324 00:13:14,519 --> 00:13:16,519 thankfully once again it is super 325 00:13:16,519 --> 00:13:18,760 similar to how it looks like in react 326 00:13:18,760 --> 00:13:20,199 you just use the image component 327 00:13:20,199 --> 00:13:22,360 provided by react native you pass the 328 00:13:22,360 --> 00:13:24,480 source to it which can be a path or a 329 00:13:24,480 --> 00:13:27,079 URL and you're good but if you want to 330 00:13:27,079 --> 00:13:29,760 display an image as a background then 331 00:13:29,760 --> 00:13:31,600 you should use the image background 332 00:13:31,600 --> 00:13:33,839 component which works in the same way 333 00:13:33,839 --> 00:13:36,240 but just renders it as a background it's 334 00:13:36,240 --> 00:13:38,560 specifically designed to allow other 335 00:13:38,560 --> 00:13:41,040 components to be layered on top of it 336 00:13:41,040 --> 00:13:43,279 whereas just the image is used for 337 00:13:43,279 --> 00:13:45,519 displaying images on their own and both 338 00:13:45,519 --> 00:13:47,000 of these can handle different image 339 00:13:47,000 --> 00:13:50,839 formats like pngs jpegs gifs and web PS 340 00:13:50,839 --> 00:13:53,920 but nons support SVG files because of 341 00:13:53,920 --> 00:13:56,320 some native rendering limitations so if 342 00:13:56,320 --> 00:13:58,240 you want to use svgs there's a 343 00:13:58,240 --> 00:14:00,240 thirdparty package called react native 344 00:14:00,240 --> 00:14:03,079 SVG once again don't try to remember it 345 00:14:03,079 --> 00:14:04,959 I'll show it to you once again later on 346 00:14:04,959 --> 00:14:07,399 so you can use it within your own code 347 00:14:07,399 --> 00:14:09,680 okay now that you know how to use images 348 00:14:09,680 --> 00:14:12,199 what about models well thankfully react 349 00:14:12,199 --> 00:14:14,399 native has components for that too it's 350 00:14:14,399 --> 00:14:17,040 called a model just import it from react 351 00:14:17,040 --> 00:14:19,839 native set visible to True add an 352 00:14:19,839 --> 00:14:22,399 animation type and Define what happens 353 00:14:22,399 --> 00:14:24,759 when you close it pretty simple there's 354 00:14:24,759 --> 00:14:26,839 also an alert component which you can 355 00:14:26,839 --> 00:14:29,519 again just very conveniently report from 356 00:14:29,519 --> 00:14:32,120 react native and call it by saying 357 00:14:32,120 --> 00:14:35,199 alert. alert provide a title and 358 00:14:35,199 --> 00:14:37,199 functions which you want to execute on 359 00:14:37,199 --> 00:14:39,920 cancel or on okay and if you're creating 360 00:14:39,920 --> 00:14:41,720 forms you might want to create some kind 361 00:14:41,720 --> 00:14:44,440 of a toggle in react native and for that 362 00:14:44,440 --> 00:14:46,880 you can use a switch component once 363 00:14:46,880 --> 00:14:50,079 again it is super simple imported create 364 00:14:50,079 --> 00:14:52,519 a state for it same as in 365 00:14:52,519 --> 00:14:55,440 react create a function that manages it 366 00:14:55,440 --> 00:14:56,959 and then simply call it like this within 367 00:14:56,959 --> 00:15:00,240 your code provide some colors its value 368 00:15:00,240 --> 00:15:02,079 and what happens when you click it 369 00:15:02,079 --> 00:15:03,880 there's also a component that I use 370 00:15:03,880 --> 00:15:06,720 super often called the status bar both 371 00:15:06,720 --> 00:15:09,160 react native and Expo have their own 372 00:15:09,160 --> 00:15:11,040 versions that allow you to control how 373 00:15:11,040 --> 00:15:12,920 status bar should look like for each 374 00:15:12,920 --> 00:15:15,279 screen within the app I prefer using the 375 00:15:15,279 --> 00:15:17,560 one from Expo you can define a view with 376 00:15:17,560 --> 00:15:19,959 some text and just beneath it you can 377 00:15:19,959 --> 00:15:22,440 define a status bar but what am I even 378 00:15:22,440 --> 00:15:24,680 trying to do I'm just listing all of the 379 00:15:24,680 --> 00:15:26,759 different components that you can use to 380 00:15:26,759 --> 00:15:29,120 build your mobile applications well I I 381 00:15:29,120 --> 00:15:31,160 guess I'm just trying to show you that 382 00:15:31,160 --> 00:15:33,639 there are some differences like P tags 383 00:15:33,639 --> 00:15:36,600 and H tags are now becoming text divs 384 00:15:36,600 --> 00:15:39,199 are becoming views but other than that 385 00:15:39,199 --> 00:15:42,120 there are so many components that feel 386 00:15:42,120 --> 00:15:44,399 like you're writing react code within 387 00:15:44,399 --> 00:15:46,959 react native allowing you to build 388 00:15:46,959 --> 00:15:49,160 mobile applications from touchable 389 00:15:49,160 --> 00:15:52,360 opacities for buttons to models alerts 390 00:15:52,360 --> 00:15:55,360 and more the list doesn't stop there of 391 00:15:55,360 --> 00:15:57,240 course I don't want to waste your time 392 00:15:57,240 --> 00:15:58,600 we're not going to go through every 393 00:15:58,600 --> 00:16:00,680 single component that exists in this 394 00:16:00,680 --> 00:16:03,120 video but I did take some time and I 395 00:16:03,120 --> 00:16:05,319 wrote down the most important ones 396 00:16:05,319 --> 00:16:07,120 within the free react native guide 397 00:16:07,120 --> 00:16:08,920 Linked In the description so if you want 398 00:16:08,920 --> 00:16:10,399 to check them out there see the 399 00:16:10,399 --> 00:16:12,279 differences and similarities and just 400 00:16:12,279 --> 00:16:13,839 have a place where you can recap what 401 00:16:13,839 --> 00:16:16,040 you learned that guide is what you need 402 00:16:16,040 --> 00:16:17,839 but now that you know the most important 403 00:16:17,839 --> 00:16:20,240 components and Concepts in react native 404 00:16:20,240 --> 00:16:22,160 let's Dive Right into action I'll show 405 00:16:22,160 --> 00:16:24,120 you how to set up your app what files 406 00:16:24,120 --> 00:16:26,360 and folders are involved and everything 407 00:16:26,360 --> 00:16:35,040 else that matters step by step 408 00:16:35,040 --> 00:16:37,839 step all right before we dive into the 409 00:16:37,839 --> 00:16:39,680 development of the movies app let me 410 00:16:39,680 --> 00:16:41,639 quickly tell you what you'll build and 411 00:16:41,639 --> 00:16:43,680 learn along the way you'll get the 412 00:16:43,680 --> 00:16:46,319 firsthand opportunity to put into code 413 00:16:46,319 --> 00:16:48,040 many components I was just telling you 414 00:16:48,040 --> 00:16:50,279 about a couple of minutes ago core react 415 00:16:50,279 --> 00:16:52,560 native components like view touchable 416 00:16:52,560 --> 00:16:55,720 opacity image flat list scroll view safe 417 00:16:55,720 --> 00:16:58,399 area view text input and more different 418 00:16:58,399 --> 00:17:01,120 Navigation like stack navigation tab 419 00:17:01,120 --> 00:17:03,560 navigation with custom styling and 420 00:17:03,560 --> 00:17:06,000 advanced file based routing including 421 00:17:06,000 --> 00:17:09,439 nested and dynamic routes custom Hooks 422 00:17:09,439 --> 00:17:11,599 and fonts to make your app more flexible 423 00:17:11,599 --> 00:17:14,480 and reusable types and interfaces with 424 00:17:14,480 --> 00:17:16,799 typescript for better type safety 425 00:17:16,799 --> 00:17:18,919 responsive design to ensure the app 426 00:17:18,919 --> 00:17:21,640 looks great on any screen of course 427 00:17:21,640 --> 00:17:24,240 Tailwind CSS for clean and scalable 428 00:17:24,240 --> 00:17:27,599 design backend with aite to handle data 429 00:17:27,599 --> 00:17:30,120 and user interactions and many other 430 00:17:30,120 --> 00:17:33,280 best practices we'll go step by step and 431 00:17:33,280 --> 00:17:35,120 I'll teach you to implement amazing 432 00:17:35,120 --> 00:17:37,120 stuff which you'll see yourself using 433 00:17:37,120 --> 00:17:39,799 across any future apps you build like a 434 00:17:39,799 --> 00:17:41,480 search feature with optimized 435 00:17:41,480 --> 00:17:43,880 performance fetching movies data from a 436 00:17:43,880 --> 00:17:47,280 thirdparty API smooth loading and air 437 00:17:47,280 --> 00:17:49,919 handling and then a trending movies 438 00:17:49,919 --> 00:17:52,559 algorithm that tracks user searches and 439 00:17:52,559 --> 00:17:54,720 helps us recommend the most popular 440 00:17:54,720 --> 00:17:57,600 movies based on real user activity 441 00:17:57,600 --> 00:17:59,880 pretty cool right will use aight to 442 00:17:59,880 --> 00:18:01,600 store that user activity for this 443 00:18:01,600 --> 00:18:03,760 algorithm to work so let's quickly 444 00:18:03,760 --> 00:18:05,960 create an account click the link down in 445 00:18:05,960 --> 00:18:07,720 the description to be able to follow 446 00:18:07,720 --> 00:18:10,000 along and see exactly what I'm seeing 447 00:18:10,000 --> 00:18:12,240 create your account at the top right or 448 00:18:12,240 --> 00:18:14,679 just sign in as you can see I'm using 449 00:18:14,679 --> 00:18:17,320 app right for many of my projects and 450 00:18:17,320 --> 00:18:18,919 now you can just create a new one for 451 00:18:18,919 --> 00:18:20,919 this one I'll call it 452 00:18:20,919 --> 00:18:25,039 JSM RN movie app you can do something 453 00:18:25,039 --> 00:18:27,400 similar and you can choose the region 454 00:18:27,400 --> 00:18:29,320 and click create now with can set up our 455 00:18:29,320 --> 00:18:31,559 project's file and folder structure and 456 00:18:31,559 --> 00:18:34,840 very soon we'll put this project to 457 00:18:34,840 --> 00:18:37,400 use let's get started with developing 458 00:18:37,400 --> 00:18:39,360 our app by first setting up our 459 00:18:39,360 --> 00:18:41,360 development environment I've created a 460 00:18:41,360 --> 00:18:43,960 new empty folder on my desktop called it 461 00:18:43,960 --> 00:18:46,679 mobile movie app and opened it up within 462 00:18:46,679 --> 00:18:48,880 my IDE throughout this course I'll be 463 00:18:48,880 --> 00:18:51,320 using webstorm the most powerful 464 00:18:51,320 --> 00:18:53,520 JavaScript and typescript IDE until 465 00:18:53,520 --> 00:18:55,880 recently it was paid so not everyone was 466 00:18:55,880 --> 00:18:58,799 able to use it but as of now it is 467 00:18:58,799 --> 00:19:01,200 completely free for noncommercial use 468 00:19:01,200 --> 00:19:02,799 I'll leave the link in the description 469 00:19:02,799 --> 00:19:04,640 you can check it out and download it for 470 00:19:04,640 --> 00:19:06,600 your operating system once you install 471 00:19:06,600 --> 00:19:08,480 it you can set it up to look exactly how 472 00:19:08,480 --> 00:19:10,480 you want it to look currently I'm using 473 00:19:10,480 --> 00:19:13,080 the material deep ocean theme and lately 474 00:19:13,080 --> 00:19:15,640 I prefer using it over vs code so once 475 00:19:15,640 --> 00:19:17,520 you create an empty folder in whichever 476 00:19:17,520 --> 00:19:19,400 editor you're using we can create our 477 00:19:19,400 --> 00:19:21,720 new react native application if you head 478 00:19:21,720 --> 00:19:24,799 over to react native. deev click get 479 00:19:24,799 --> 00:19:26,640 started you'll notice that there are a 480 00:19:26,640 --> 00:19:28,080 couple of different ways in which you 481 00:19:28,080 --> 00:19:29,799 can initialize your react native 482 00:19:29,799 --> 00:19:31,440 projects and as I've mentioned in the 483 00:19:31,440 --> 00:19:33,200 crash course the recommended way of 484 00:19:33,200 --> 00:19:35,480 course is Expo it'll provide us with a 485 00:19:35,480 --> 00:19:37,440 lot of important features out of the box 486 00:19:37,440 --> 00:19:39,440 making our development experience that 487 00:19:39,440 --> 00:19:41,880 much better so to start your react 488 00:19:41,880 --> 00:19:43,840 native app with Expo the only thing you 489 00:19:43,840 --> 00:19:46,120 have to do is run this command in your 490 00:19:46,120 --> 00:19:48,799 terminal so let's write it together by 491 00:19:48,799 --> 00:19:52,039 opening up the terminal and running MPX 492 00:19:52,039 --> 00:19:56,919 create D xo- app add latest and then add 493 00:19:56,919 --> 00:19:58,679 slash to install it in the current 494 00:19:58,679 --> 00:20:00,880 directory now it'll proceed to install 495 00:20:00,880 --> 00:20:02,760 all the necessary packages that we need 496 00:20:02,760 --> 00:20:04,679 to run a react native application and 497 00:20:04,679 --> 00:20:06,000 you can see that it's also starting to 498 00:20:06,000 --> 00:20:08,600 create our file and folder structure 499 00:20:08,600 --> 00:20:10,679 very soon I'll explain exactly what all 500 00:20:10,679 --> 00:20:12,679 of these files and folders mean and what 501 00:20:12,679 --> 00:20:14,880 they do once it gets installed you'll be 502 00:20:14,880 --> 00:20:16,919 able to run it now going back to the 503 00:20:16,919 --> 00:20:19,559 docs it says Hey run this command and 504 00:20:19,559 --> 00:20:21,400 then continue with Expo and when you 505 00:20:21,400 --> 00:20:23,200 click it it'll show you how you can set 506 00:20:23,200 --> 00:20:24,840 up your development environment no 507 00:20:24,840 --> 00:20:26,720 matter which device you're using in this 508 00:20:26,720 --> 00:20:29,400 case I'll be using a real iOS device but 509 00:20:29,400 --> 00:20:31,440 you can also use an Android then it's 510 00:20:31,440 --> 00:20:33,400 asking you how you would like to develop 511 00:20:33,400 --> 00:20:35,480 and we'll be using Expo go so depending 512 00:20:35,480 --> 00:20:37,120 on your operating system you'll be able 513 00:20:37,120 --> 00:20:39,480 to scan the QR code to download it or 514 00:20:39,480 --> 00:20:41,799 visit the expoo page on the App Store 515 00:20:41,799 --> 00:20:43,400 once you install it you'll be able to 516 00:20:43,400 --> 00:20:45,039 create your account and your screen 517 00:20:45,039 --> 00:20:47,240 should look something like this so the 518 00:20:47,240 --> 00:20:49,240 first thing we have to do is start a 519 00:20:49,240 --> 00:20:52,039 development server by running MPX Expo 520 00:20:52,039 --> 00:20:54,240 start so back within our terminal let's 521 00:20:54,240 --> 00:20:57,640 do just that run MPX expose start and 522 00:20:57,640 --> 00:20:59,159 you'll be able to see different letters 523 00:20:59,159 --> 00:21:01,039 that allow you to do different things 524 00:21:01,039 --> 00:21:02,880 but you don't have to press any of them 525 00:21:02,880 --> 00:21:05,600 what you have to do is just scan this QR 526 00:21:05,600 --> 00:21:08,440 code so I'll open up my camera and scan 527 00:21:08,440 --> 00:21:11,480 it right here it'll say bundling and in 528 00:21:11,480 --> 00:21:13,840 a couple of seconds the app will run on 529 00:21:13,840 --> 00:21:17,720 your phone there we go we are live as I 530 00:21:17,720 --> 00:21:20,080 mentioned we don't need to rely on heavy 531 00:21:20,080 --> 00:21:22,679 tools like Android Studio or xcode 532 00:21:22,679 --> 00:21:24,720 instead we're using this easiest method 533 00:21:24,720 --> 00:21:27,000 to develop apps with react native which 534 00:21:27,000 --> 00:21:29,000 of course includes this Expo app on your 535 00:21:29,000 --> 00:21:30,840 phone and as you can see I can switch 536 00:21:30,840 --> 00:21:32,520 between different pages touch different 537 00:21:32,520 --> 00:21:34,520 elements on the screen and it feels like 538 00:21:34,520 --> 00:21:37,279 I'm using a real mobile application now 539 00:21:37,279 --> 00:21:38,760 if you're not seeing what I'm seeing on 540 00:21:38,760 --> 00:21:40,520 the screen then that must mean that 541 00:21:40,520 --> 00:21:42,080 you're having some problems and 542 00:21:42,080 --> 00:21:43,720 thankfully there is a couple of quick 543 00:21:43,720 --> 00:21:46,279 fixes first make sure that you're on the 544 00:21:46,279 --> 00:21:48,679 same Wi-Fi network on your computer and 545 00:21:48,679 --> 00:21:51,400 your device and if it still doesn't work 546 00:21:51,400 --> 00:21:52,640 it may be due to the router 547 00:21:52,640 --> 00:21:55,200 configuration common for public networks 548 00:21:55,200 --> 00:21:57,799 on iOS you might have to Grant the local 549 00:21:57,799 --> 00:22:00,200 network permission to the Expo Go app or 550 00:22:00,200 --> 00:22:03,200 you can try using this MPX Expo start-- 551 00:22:03,200 --> 00:22:05,240 tunnel or just read whatever the Expo 552 00:22:05,240 --> 00:22:07,520 app is saying and try resolving it step 553 00:22:07,520 --> 00:22:09,640 by step but with that in mind we are now 554 00:22:09,640 --> 00:22:11,679 ready to make our first change to do 555 00:22:11,679 --> 00:22:14,120 that we can head over within our app 556 00:22:14,120 --> 00:22:17,559 tabs index. TSX and if you see this 557 00:22:17,559 --> 00:22:20,400 welcome theme text you can say something 558 00:22:20,400 --> 00:22:21,640 like 559 00:22:21,640 --> 00:22:25,080 welcome to my movie app because that's 560 00:22:25,080 --> 00:22:27,279 exactly what we're building if you save 561 00:22:27,279 --> 00:22:29,200 it you can see that it'll change 562 00:22:29,200 --> 00:22:31,360 immediately and we can remove this wave 563 00:22:31,360 --> 00:22:33,039 so this means that we have established a 564 00:22:33,039 --> 00:22:35,440 connection between our code and our 565 00:22:35,440 --> 00:22:37,279 device so we can see all the changes 566 00:22:37,279 --> 00:22:39,600 live now that our project is running let 567 00:22:39,600 --> 00:22:41,440 me quickly explain what each one of the 568 00:22:41,440 --> 00:22:43,520 files and folders here does so you have 569 00:22:43,520 --> 00:22:44,960 a better understanding of the entire 570 00:22:44,960 --> 00:22:47,000 codebase so you can more confidently 571 00:22:47,000 --> 00:22:48,559 make changes to your application later 572 00:22:48,559 --> 00:22:50,320 on let's start from the bottom to the 573 00:22:50,320 --> 00:22:53,360 top first we have the TS config which 574 00:22:53,360 --> 00:22:55,240 contains the rules that typescript will 575 00:22:55,240 --> 00:22:57,200 use to enforce type safety throughout 576 00:22:57,200 --> 00:22:59,360 the project and no worries you don't 577 00:22:59,360 --> 00:23:00,919 need to know typescript to be able to 578 00:23:00,919 --> 00:23:02,640 proceed with this course I'll teach it 579 00:23:02,640 --> 00:23:05,919 to you as we go next we have the read me 580 00:23:05,919 --> 00:23:07,440 which is a text file containing some 581 00:23:07,440 --> 00:23:09,440 information about the project then 582 00:23:09,440 --> 00:23:11,400 there's the package lock and 583 00:23:11,400 --> 00:23:13,960 package.json which contains the project 584 00:23:13,960 --> 00:23:16,840 scripts dependencies and additional 585 00:23:16,840 --> 00:23:19,720 metadata after that there's the app. 586 00:23:19,720 --> 00:23:21,559 Json file which contains the 587 00:23:21,559 --> 00:23:23,600 configuration options for the project 588 00:23:23,600 --> 00:23:26,919 and is often called the app config these 589 00:23:26,919 --> 00:23:29,200 options change the behavior of your 590 00:23:29,200 --> 00:23:31,559 project while developing building 591 00:23:31,559 --> 00:23:33,520 submitting or updating your app 592 00:23:33,520 --> 00:23:35,960 everything starts with an expo object 593 00:23:35,960 --> 00:23:37,919 which is the root object containing all 594 00:23:37,919 --> 00:23:39,919 the app configuration then of course 595 00:23:39,919 --> 00:23:42,120 there's the app name shown on the home 596 00:23:42,120 --> 00:23:44,600 screen or the app screen very important 597 00:23:44,600 --> 00:23:46,880 in case you want to make it custom then 598 00:23:46,880 --> 00:23:48,679 there's the slug which is a unique 599 00:23:48,679 --> 00:23:51,440 identifier for the project used by Expo 600 00:23:51,440 --> 00:23:53,440 it's used when defining the URL if you 601 00:23:53,440 --> 00:23:55,559 want to show your project in the web 602 00:23:55,559 --> 00:23:57,960 there's the version of the project the 603 00:23:57,960 --> 00:24:00,000 orientation ation which defines whether 604 00:24:00,000 --> 00:24:01,799 your app should initially open in 605 00:24:01,799 --> 00:24:04,559 portrait landscape or the default screen 606 00:24:04,559 --> 00:24:06,880 orientation mode the icon is the full 607 00:24:06,880 --> 00:24:09,279 path to the image you want to display 608 00:24:09,279 --> 00:24:11,799 the scheme is a custom URL to enable 609 00:24:11,799 --> 00:24:14,480 deep linking in this case let's set it 610 00:24:14,480 --> 00:24:17,360 to movies so later on we can do 611 00:24:17,360 --> 00:24:21,520 something like movies Colin sl/ some 612 00:24:21,520 --> 00:24:23,720 path there's also the user interface 613 00:24:23,720 --> 00:24:26,320 style which we can leave to automatic 614 00:24:26,320 --> 00:24:28,760 this determines the dark or light mode 615 00:24:28,760 --> 00:24:31,279 and then there's this new Arch enabled 616 00:24:31,279 --> 00:24:33,200 which enables the new architecture of 617 00:24:33,200 --> 00:24:35,399 react native for better performance it 618 00:24:35,399 --> 00:24:36,760 was that thing that I talked to you 619 00:24:36,760 --> 00:24:38,760 about in the crash course part regarding 620 00:24:38,760 --> 00:24:41,880 JSI turbo modules and more and what's 621 00:24:41,880 --> 00:24:44,360 best is that Expo immediately supports 622 00:24:44,360 --> 00:24:46,360 this new architecture without you having 623 00:24:46,360 --> 00:24:49,120 to do anything along with this you're 624 00:24:49,120 --> 00:24:51,200 also getting the newest react features 625 00:24:51,200 --> 00:24:54,360 like transitions moving on we have IOS 626 00:24:54,360 --> 00:24:56,480 specific features that you can extend 627 00:24:56,480 --> 00:24:58,960 specifically on iOS devices in this case 628 00:24:58,960 --> 00:25:00,399 you can define whether it supports 629 00:25:00,399 --> 00:25:03,000 tablet devices and then there are also 630 00:25:03,000 --> 00:25:06,080 Android specific properties such as apps 631 00:25:06,080 --> 00:25:09,240 adaptive icon path to the image color 632 00:25:09,240 --> 00:25:11,679 and more and similarly there's also 633 00:25:11,679 --> 00:25:13,600 additional options for the web now 634 00:25:13,600 --> 00:25:15,919 coming out of the app. Json there's of 635 00:25:15,919 --> 00:25:18,080 course the git ignore which allows us to 636 00:25:18,080 --> 00:25:20,600 ignore some environment variables or git 637 00:25:20,600 --> 00:25:22,679 related things there's the scripts 638 00:25:22,679 --> 00:25:25,279 folder currently having just one part 639 00:25:25,279 --> 00:25:27,000 which allows us to reset the project to 640 00:25:27,000 --> 00:25:28,600 the bare minimum code and and then 641 00:25:28,600 --> 00:25:30,640 there's some boilerplate code like 642 00:25:30,640 --> 00:25:35,080 custom hooks constants some components 643 00:25:35,080 --> 00:25:38,240 assets and finally the app folder which 644 00:25:38,240 --> 00:25:40,559 allows us to route to different pages 645 00:25:40,559 --> 00:25:42,000 similarly to 646 00:25:42,000 --> 00:25:44,520 nextjs or in this case we're not calling 647 00:25:44,520 --> 00:25:47,080 them Pages we're calling them screens 648 00:25:47,080 --> 00:25:49,279 you can see this tabs group in which we 649 00:25:49,279 --> 00:25:51,360 have more files within here you'll be 650 00:25:51,360 --> 00:25:53,080 able to manage the layouts for different 651 00:25:53,080 --> 00:25:55,200 pages and very soon I'll show you 652 00:25:55,200 --> 00:25:57,919 exactly how it works there is a lot of 653 00:25:57,919 --> 00:26:00,240 code but you don't have to memorize all 654 00:26:00,240 --> 00:26:02,520 of this boilerplate code because I'll 655 00:26:02,520 --> 00:26:04,360 teach you how everything works from 656 00:26:04,360 --> 00:26:07,159 scratch so let's use this nice script 657 00:26:07,159 --> 00:26:09,640 that Expo has given to us called reset 658 00:26:09,640 --> 00:26:11,679 project which will set the project to 659 00:26:11,679 --> 00:26:13,360 its bare minimum I'll stop the 660 00:26:13,360 --> 00:26:15,279 application from running and then I will 661 00:26:15,279 --> 00:26:19,480 run mpm run reset Das project it's going 662 00:26:19,480 --> 00:26:21,000 to ask you whether you want to move 663 00:26:21,000 --> 00:26:23,640 everything to the example folder I'll 664 00:26:23,640 --> 00:26:26,200 say no just go ahead and delete it so as 665 00:26:26,200 --> 00:26:27,840 you can see all of these folders have 666 00:26:27,840 --> 00:26:30,440 been deleted deled and some new files 667 00:26:30,440 --> 00:26:32,960 very Bare Bones have been created we can 668 00:26:32,960 --> 00:26:36,600 once again run MPX expose start to start 669 00:26:36,600 --> 00:26:37,720 the development 670 00:26:37,720 --> 00:26:39,840 server and then you can just press the 671 00:26:39,840 --> 00:26:42,559 letter R to reload it automatically on 672 00:26:42,559 --> 00:26:44,720 your device now if you check it out 673 00:26:44,720 --> 00:26:46,919 it'll look much simpler the app only 674 00:26:46,919 --> 00:26:49,760 consists of a very simple layout and an 675 00:26:49,760 --> 00:26:52,919 even simpler index. TSX page where we 676 00:26:52,919 --> 00:26:56,000 can say welcome and we can dive right 677 00:26:56,000 --> 00:26:58,520 into extending it to build our MO movie 678 00:26:58,520 --> 00:27:02,559 application great job on completing the 679 00:27:02,559 --> 00:27:05,120 setup we're done with the general setup 680 00:27:05,120 --> 00:27:07,440 of the application but there are still 681 00:27:07,440 --> 00:27:09,640 some things we got to set up such as 682 00:27:09,640 --> 00:27:12,000 additional packages for styling and 683 00:27:12,000 --> 00:27:13,880 configuration that will make our job 684 00:27:13,880 --> 00:27:16,840 easier later on one of those packages is 685 00:27:16,840 --> 00:27:19,360 called native wind native wind doesn't 686 00:27:19,360 --> 00:27:21,520 even have its own landing page it just 687 00:27:21,520 --> 00:27:23,720 says do you like using Tailwind CSS to 688 00:27:23,720 --> 00:27:26,399 style your apps well this helps you do 689 00:27:26,399 --> 00:27:28,760 that in react native so we use it for 690 00:27:28,760 --> 00:27:31,120 that exact reason you can install it by 691 00:27:31,120 --> 00:27:33,559 opening up a new terminal keep this one 692 00:27:33,559 --> 00:27:35,279 running because it's the one running our 693 00:27:35,279 --> 00:27:37,840 app and run mpm 694 00:27:37,840 --> 00:27:43,480 install native wind Tailwind CSS react 695 00:27:43,480 --> 00:27:48,440 native reanimated and react native safe 696 00:27:48,440 --> 00:27:51,120 area context these are some packages 697 00:27:51,120 --> 00:27:52,240 that are going to make our styling 698 00:27:52,240 --> 00:27:53,919 easier let's give them a few moments 699 00:27:53,919 --> 00:27:56,640 until they install and once that is done 700 00:27:56,640 --> 00:28:01,080 run MPX Tailwind CSS init this will 701 00:28:01,080 --> 00:28:03,559 generate our configuration file you can 702 00:28:03,559 --> 00:28:05,600 find it within your code right here 703 00:28:05,600 --> 00:28:08,519 Tailwind Doc config.js and you'll get a 704 00:28:08,519 --> 00:28:10,840 default configuration but to make sure 705 00:28:10,840 --> 00:28:12,640 it works properly with a react native 706 00:28:12,640 --> 00:28:15,159 setup we'll need to update it a bit here 707 00:28:15,159 --> 00:28:17,120 you want to include all the files that 708 00:28:17,120 --> 00:28:19,000 you want ta into to style so in this 709 00:28:19,000 --> 00:28:21,200 case everything within the app folder 710 00:28:21,200 --> 00:28:25,120 that ends with JS jsx or TS or TSX and 711 00:28:25,120 --> 00:28:27,760 we're also adding a babble preset so 712 00:28:27,760 --> 00:28:29,880 just copy it from native winds Expo 713 00:28:29,880 --> 00:28:31,919 setup and just override what you had in 714 00:28:31,919 --> 00:28:34,080 the tailin config file finally create a 715 00:28:34,080 --> 00:28:36,960 new file within the app folder and call 716 00:28:36,960 --> 00:28:40,840 it global. CSS and within it you'll have 717 00:28:40,840 --> 00:28:44,399 to import three things or rather add 718 00:28:44,399 --> 00:28:47,159 three Tailwind directives Tailwind base 719 00:28:47,159 --> 00:28:49,399 Tailwind components and Tailwind 720 00:28:49,399 --> 00:28:51,600 utilities after that we'll have to set 721 00:28:51,600 --> 00:28:54,880 up the Babel preset so copy this config 722 00:28:54,880 --> 00:28:56,720 and create a new file in the root of 723 00:28:56,720 --> 00:28:59,120 your directory called 724 00:28:59,120 --> 00:29:03,760 Babel Doc config.js and paste what you 725 00:29:03,760 --> 00:29:06,519 just copied after that we'll also have 726 00:29:06,519 --> 00:29:09,360 to modify our Metro config so just copy 727 00:29:09,360 --> 00:29:13,480 it open up your terminal and run MPX 728 00:29:13,480 --> 00:29:18,799 Expo customize metro. config.js 729 00:29:18,799 --> 00:29:22,159 this will generate that config file so 730 00:29:22,159 --> 00:29:24,200 you'll be able to find it right here and 731 00:29:24,200 --> 00:29:25,840 you can override it with what we just 732 00:29:25,840 --> 00:29:28,760 copied from native wind get default 733 00:29:28,760 --> 00:29:31,320 config with Native wind we wrap that 734 00:29:31,320 --> 00:29:33,760 configuration and we set it up you don't 735 00:29:33,760 --> 00:29:35,360 have to worry about understanding what's 736 00:29:35,360 --> 00:29:37,279 happening here this is just the setup to 737 00:29:37,279 --> 00:29:39,519 make the styling work finally we can 738 00:29:39,519 --> 00:29:44,240 head over into our appor layout. DSX and 739 00:29:44,240 --> 00:29:48,039 right here we can import the/ global. 740 00:29:48,039 --> 00:29:50,279 CSS so we can actually apply some of 741 00:29:50,279 --> 00:29:52,559 these Styles and then at the root of 742 00:29:52,559 --> 00:29:55,880 your project create a new file called 743 00:29:55,880 --> 00:29:59,360 native wind- EnV . 744 00:29:59,360 --> 00:30:03,159 D.S and within it add a triple for slash 745 00:30:03,159 --> 00:30:05,320 open up a new self-closing component 746 00:30:05,320 --> 00:30:08,519 called reference and add types equal to 747 00:30:08,519 --> 00:30:11,080 Native wind types this will enable tab 748 00:30:11,080 --> 00:30:13,679 script to recognize tailin CSS classes 749 00:30:13,679 --> 00:30:16,440 preventing constant error messages and 750 00:30:16,440 --> 00:30:18,640 very quickly head over into your Metro 751 00:30:18,640 --> 00:30:21,279 config and make sure that the input 752 00:30:21,279 --> 00:30:23,840 points to the right path to our global. 753 00:30:23,840 --> 00:30:28,919 CSS file so it is not/ global. CSS 754 00:30:28,919 --> 00:30:30,640 rather it 755 00:30:30,640 --> 00:30:36,399 isapp SL globals with an s. CSS this has 756 00:30:36,399 --> 00:30:39,840 to match this global. CSS file once you 757 00:30:39,840 --> 00:30:42,519 do it close all of your files and open 758 00:30:42,519 --> 00:30:44,679 up your terminal to make sure that 759 00:30:44,679 --> 00:30:46,559 everything we've done right now actually 760 00:30:46,559 --> 00:30:48,399 works you'll have to restart your 761 00:30:48,399 --> 00:30:50,480 application by pressing contrl 762 00:30:50,480 --> 00:30:53,320 C and this can get boring pretty soon 763 00:30:53,320 --> 00:30:55,240 but whenever something is not working or 764 00:30:55,240 --> 00:30:57,159 your changes are not being reflected 765 00:30:57,159 --> 00:30:59,679 just go ahead and set it it'll help so 766 00:30:59,679 --> 00:31:03,360 start your app with a command MPX Expos 767 00:31:03,360 --> 00:31:05,919 start-- clear this will make sure that 768 00:31:05,919 --> 00:31:07,480 everything we've done actually gets 769 00:31:07,480 --> 00:31:09,919 taken into account and then press R to 770 00:31:09,919 --> 00:31:11,760 reload your application it'll first 771 00:31:11,760 --> 00:31:13,600 bundle it and then depending on your 772 00:31:13,600 --> 00:31:15,760 internet speed it'll download the code 773 00:31:15,760 --> 00:31:17,440 and it'll display it right here on the 774 00:31:17,440 --> 00:31:20,240 screen so while that is happening let me 775 00:31:20,240 --> 00:31:23,240 head over into the index. DSX file and 776 00:31:23,240 --> 00:31:25,159 now hopefully we can style our 777 00:31:25,159 --> 00:31:27,440 applications using Tailwind instead of 778 00:31:27,440 --> 00:31:30,120 these default Styles let's remove these 779 00:31:30,120 --> 00:31:33,399 default inline Styles and instead let's 780 00:31:33,399 --> 00:31:36,320 give it a class name and say something 781 00:31:36,320 --> 00:31:37,840 like Flex 782 00:31:37,840 --> 00:31:42,440 D1 justify Das Center and items - Center 783 00:31:42,440 --> 00:31:44,440 which should keep it centered like it 784 00:31:44,440 --> 00:31:46,880 did before and we can also style this 785 00:31:46,880 --> 00:31:50,159 welcome by giving it a class name of 786 00:31:50,159 --> 00:31:53,799 text- 5xl and by the way notice how my 787 00:31:53,799 --> 00:31:56,440 webstorm IDE is giving me all of these 788 00:31:56,440 --> 00:31:58,880 options in a super nice way so I 789 00:31:58,880 --> 00:32:01,880 immediately know exactly which Styles 790 00:32:01,880 --> 00:32:03,760 will each one of these tailin CSS 791 00:32:03,760 --> 00:32:05,679 properties apply we can also give it a 792 00:32:05,679 --> 00:32:09,360 text blue of 500 as well as font Das 793 00:32:09,360 --> 00:32:11,880 bolt if you save it in a matter of 794 00:32:11,880 --> 00:32:13,320 seconds you'll be able to see the 795 00:32:13,320 --> 00:32:16,120 changes reflected on your device now 796 00:32:16,120 --> 00:32:18,240 instead of saying something like text 797 00:32:18,240 --> 00:32:20,360 Dash and then manually defining the 798 00:32:20,360 --> 00:32:24,159 color like hash2 3 1 2 3 this is not 799 00:32:24,159 --> 00:32:25,880 going to work right whenever you change 800 00:32:25,880 --> 00:32:28,200 one color you have to change it across 801 00:32:28,200 --> 00:32:30,880 hundreds of different files so what you 802 00:32:30,880 --> 00:32:33,120 typically do when using Tailwind is 803 00:32:33,120 --> 00:32:35,080 Define custom themes within your 804 00:32:35,080 --> 00:32:37,720 configuration file so head over into 805 00:32:37,720 --> 00:32:42,039 Tailwind Doc config.js and extend your 806 00:32:42,039 --> 00:32:45,120 theme with some additional colors such 807 00:32:45,120 --> 00:32:51,600 as a primary color of something like # 808 00:32:51,600 --> 00:32:54,639 0314 now going back to your app you can 809 00:32:54,639 --> 00:32:58,360 just say text- primary and and it'll 810 00:32:58,360 --> 00:33:00,320 automatically take that color into 811 00:33:00,320 --> 00:33:03,480 account pretty cool right so where did I 812 00:33:03,480 --> 00:33:06,279 find this color well just below you'll 813 00:33:06,279 --> 00:33:08,440 be able to find a link to a complete 814 00:33:08,440 --> 00:33:10,720 figma design of this project you can go 815 00:33:10,720 --> 00:33:12,880 through it a bit and if you go ahead and 816 00:33:12,880 --> 00:33:15,440 click a couple of times on different 817 00:33:15,440 --> 00:33:17,799 elements it'll tell you what is the 818 00:33:17,799 --> 00:33:20,240 color of that specific element so for 819 00:33:20,240 --> 00:33:24,080 example we have this accent color of AB8 820 00:33:24,080 --> 00:33:27,120 BFF so we can copy it and back in the 821 00:33:27,120 --> 00:33:30,000 code we can add that accent color just 822 00:33:30,000 --> 00:33:32,760 like this and then you can use it very 823 00:33:32,760 --> 00:33:35,480 easily within your code by saying text 824 00:33:35,480 --> 00:33:38,000 Dash accent there are also a couple of 825 00:33:38,000 --> 00:33:40,159 other colors from this design that I 826 00:33:40,159 --> 00:33:42,600 want to add maybe the dark background 827 00:33:42,600 --> 00:33:44,720 color or this gray color right here that 828 00:33:44,720 --> 00:33:47,080 we want to use you can find them on the 829 00:33:47,080 --> 00:33:48,799 design yourself and then copy them 830 00:33:48,799 --> 00:33:50,639 within your app such as this variant of 831 00:33:50,639 --> 00:33:53,080 the dark color or we can do it together 832 00:33:53,080 --> 00:33:54,960 right now there aren't too many 833 00:33:54,960 --> 00:33:57,000 alongside the primary color we'll also 834 00:33:57,000 --> 00:33:58,519 have the secondary 835 00:33:58,519 --> 00:34:01,840 which is going to be hh1 151 836 00:34:01,840 --> 00:34:04,519 312 we'll also have a couple of 837 00:34:04,519 --> 00:34:07,279 variations of the light color such as 838 00:34:07,279 --> 00:34:11,040 the 100 variation of hash 839 00:34:11,040 --> 00:34:15,199 d6c 7 FF we can also have a 200 variant 840 00:34:15,199 --> 00:34:21,000 of hash A8 B5 DB as well as 300 which is 841 00:34:21,000 --> 00:34:26,480 going to be set to Hash 9 C A4 a and we 842 00:34:26,480 --> 00:34:28,199 can have a couple of variations of the 843 00:34:28,199 --> 00:34:31,040 dark color one for the bottom navigation 844 00:34:31,040 --> 00:34:33,239 bar and one for the background so I'll 845 00:34:33,239 --> 00:34:37,440 say 100 # 221 846 00:34:37,440 --> 00:34:43,079 f3d as well as 200 variation of # 0 F0 847 00:34:43,079 --> 00:34:45,679 d23 if you save it all of these 848 00:34:45,679 --> 00:34:47,760 variations of different colors will be 849 00:34:47,760 --> 00:34:50,399 extended in our theme so now we can very 850 00:34:50,399 --> 00:34:53,480 easily use them by saying text- dark 851 00:34:53,480 --> 00:34:56,280 D200 for example and with that we have 852 00:34:56,280 --> 00:34:58,520 just set up native one inside of your 853 00:34:58,520 --> 00:35:00,320 project allowing us to style our 854 00:35:00,320 --> 00:35:02,040 applications more easily you'll 855 00:35:02,040 --> 00:35:03,560 definitely want to save this entire 856 00:35:03,560 --> 00:35:05,119 process somewhere as this is something 857 00:35:05,119 --> 00:35:07,359 you'll have to do with every single app 858 00:35:07,359 --> 00:35:10,440 and as you saw it's not easy as ABCs if 859 00:35:10,440 --> 00:35:12,599 you mess one thing the Styles will not 860 00:35:12,599 --> 00:35:15,119 be getting applied so I'll include the 861 00:35:15,119 --> 00:35:17,240 entire native one setup within that 862 00:35:17,240 --> 00:35:19,920 react native guide down below so you can 863 00:35:19,920 --> 00:35:21,880 always refer back to it even when you're 864 00:35:21,880 --> 00:35:23,560 building your own applications in the 865 00:35:23,560 --> 00:35:25,440 future great job on setting up the 866 00:35:25,440 --> 00:35:28,960 styling next routing oh and I almost 867 00:35:28,960 --> 00:35:30,440 forgot to mention something that is 868 00:35:30,440 --> 00:35:32,560 super relevant here if you're struggling 869 00:35:32,560 --> 00:35:35,119 with tawin CSS and you think that would 870 00:35:35,119 --> 00:35:37,599 hinder your work on the react native app 871 00:35:37,599 --> 00:35:39,400 just recently I have published the 872 00:35:39,400 --> 00:35:41,800 updated version of the Tailwind CSS 873 00:35:41,800 --> 00:35:43,680 crash course which teaches you 874 00:35:43,680 --> 00:35:44,599 everything you need to know about 875 00:35:44,599 --> 00:35:46,960 Tailwind in less than an hour so if you 876 00:35:46,960 --> 00:35:48,680 want to revisit your Tailwind styling 877 00:35:48,680 --> 00:35:50,319 game before we proceed with the rest of 878 00:35:50,319 --> 00:35:52,520 the course checking it out might be a 879 00:35:52,520 --> 00:35:58,240 good idea 880 00:35:58,240 --> 00:36:00,920 it's time to do the routing and as I 881 00:36:00,920 --> 00:36:03,720 mentioned before routing in react native 882 00:36:03,720 --> 00:36:07,240 Works similarly to routing in nextjs but 883 00:36:07,240 --> 00:36:09,079 even if you haven't tried it in xjs 884 00:36:09,079 --> 00:36:10,520 don't worry because I'll show you 885 00:36:10,520 --> 00:36:12,680 exactly what that means it simply means 886 00:36:12,680 --> 00:36:15,400 that your file within the app folder 887 00:36:15,400 --> 00:36:18,079 represents your route and the file name 888 00:36:18,079 --> 00:36:21,119 is a URL pointing to that route for 889 00:36:21,119 --> 00:36:24,359 example the app. index DSX represents 890 00:36:24,359 --> 00:36:26,720 Your Home Route the starting point of 891 00:36:26,720 --> 00:36:28,520 your app and and if you want to create 892 00:36:28,520 --> 00:36:30,400 another route like let's say you want to 893 00:36:30,400 --> 00:36:32,960 onboard users to your app you can create 894 00:36:32,960 --> 00:36:35,839 a new file and let's call it onboarding 895 00:36:35,839 --> 00:36:40,520 ttsx and within it you can run RN FES 896 00:36:40,520 --> 00:36:42,240 which is a simple react native 897 00:36:42,240 --> 00:36:45,160 functional export with component Styles 898 00:36:45,160 --> 00:36:47,040 so just a quick boiler plate so we don't 899 00:36:47,040 --> 00:36:49,560 have to write it by hand if this didn't 900 00:36:49,560 --> 00:36:51,240 work for you that must mean that you 901 00:36:51,240 --> 00:36:53,240 don't have the react and react native 902 00:36:53,240 --> 00:36:56,079 extension for plugins installed so just 903 00:36:56,079 --> 00:36:58,000 search for your plugins and search for 904 00:36:58,000 --> 00:37:00,119 react or react native plugins once 905 00:37:00,119 --> 00:37:01,599 you've created this route we have to 906 00:37:01,599 --> 00:37:03,800 figure out how we can get to it from the 907 00:37:03,800 --> 00:37:06,400 index route so let's head over into the 908 00:37:06,400 --> 00:37:09,119 index and just below the view that says 909 00:37:09,119 --> 00:37:12,319 welcome let's put a link coming from 910 00:37:12,319 --> 00:37:15,440 Expo router and let's give it an href of 911 00:37:15,440 --> 00:37:17,960 SL onboarding and it can simply say 912 00:37:17,960 --> 00:37:20,240 onboarding if we save it you can see it 913 00:37:20,240 --> 00:37:22,240 right here on your screen and if you try 914 00:37:22,240 --> 00:37:24,000 clicking on it you can see that it says 915 00:37:24,000 --> 00:37:26,800 unmatched route but let's first reload 916 00:37:26,800 --> 00:37:28,599 I'll open up my terminal and press the 917 00:37:28,599 --> 00:37:31,480 letter R and click on onboarding and 918 00:37:31,480 --> 00:37:33,480 there we go we have been redirected to 919 00:37:33,480 --> 00:37:35,280 the onboarding screen and now you can 920 00:37:35,280 --> 00:37:37,760 use all your devices native back and 921 00:37:37,760 --> 00:37:39,839 forward functionalities such as on 922 00:37:39,839 --> 00:37:42,040 iPhone it is normal to scroll from left 923 00:37:42,040 --> 00:37:44,880 to right to go back this works 924 00:37:44,880 --> 00:37:47,200 seamlessly similarly let's say you want 925 00:37:47,200 --> 00:37:49,480 to create a route that shows the details 926 00:37:49,480 --> 00:37:51,960 of a movie well we can create a new 927 00:37:51,960 --> 00:37:55,319 folder and let's call it movie and 928 00:37:55,319 --> 00:37:57,920 Within movie we can create a dynamic 929 00:37:57,920 --> 00:38:01,319 route so that means creating a file in 930 00:38:01,319 --> 00:38:03,560 which we wrap its name within square 931 00:38:03,560 --> 00:38:06,079 brackets and you can Define what the 932 00:38:06,079 --> 00:38:08,640 actual parameter is in this case I'll 933 00:38:08,640 --> 00:38:12,319 wrap it in a square brackets of id. 934 00:38:12,319 --> 00:38:16,680 TSX here you can once again run 935 00:38:16,680 --> 00:38:19,119 rnf and this will create a boilerplate 936 00:38:19,119 --> 00:38:21,240 function which we have to fix a bit I'll 937 00:38:21,240 --> 00:38:25,680 call it details export default details 938 00:38:25,680 --> 00:38:28,079 and we have a stylesheet at the bottom 939 00:38:28,079 --> 00:38:30,079 so now the question is how can we know 940 00:38:30,079 --> 00:38:32,640 on which movies Details page we're on 941 00:38:32,640 --> 00:38:35,280 are we on the Iron Man's Details page or 942 00:38:35,280 --> 00:38:37,880 bathman for example well we can extract 943 00:38:37,880 --> 00:38:40,760 the route Pam information in Expo like 944 00:38:40,760 --> 00:38:43,839 this by saying const D structure 945 00:38:43,839 --> 00:38:46,240 whatever name or title you put within 946 00:38:46,240 --> 00:38:48,680 the square brackets and then get it from 947 00:38:48,680 --> 00:38:52,319 use local search prams coming from the 948 00:38:52,319 --> 00:38:54,839 Expo router if you do this now you can 949 00:38:54,839 --> 00:38:58,960 use this ID variable so I'll say movie 950 00:38:58,960 --> 00:39:01,680 details and then I'll render the dynamic 951 00:39:01,680 --> 00:39:05,839 ID right here so now back in our index. 952 00:39:05,839 --> 00:39:09,119 DSX we can create another link and this 953 00:39:09,119 --> 00:39:14,960 one will point to slov slash 954 00:39:14,960 --> 00:39:18,839 Avengers and we can say Avenger 955 00:39:18,839 --> 00:39:21,760 movie if we go back you can now see this 956 00:39:21,760 --> 00:39:24,560 new link and don't forget to reload so 957 00:39:24,560 --> 00:39:26,480 one more time just press the letter R 958 00:39:26,480 --> 00:39:28,760 and wait until it reloads so we make 959 00:39:28,760 --> 00:39:30,760 sure that this new route we created is 960 00:39:30,760 --> 00:39:32,319 recognized you'll have to do this 961 00:39:32,319 --> 00:39:34,760 whenever you add some new pages now if 962 00:39:34,760 --> 00:39:36,880 you click on the second link you'll see 963 00:39:36,880 --> 00:39:39,839 that we go to the movie Details page but 964 00:39:39,839 --> 00:39:42,119 it knows that we are on the Avengers 965 00:39:42,119 --> 00:39:44,079 movie details you can play with that a 966 00:39:44,079 --> 00:39:46,240 bit more to fully understand how routing 967 00:39:46,240 --> 00:39:49,560 works but what I'll do for now is remove 968 00:39:49,560 --> 00:39:51,960 those two examples that we have 969 00:39:51,960 --> 00:39:54,640 created by entirely removing the movie 970 00:39:54,640 --> 00:39:57,640 folder as well as the onboarding file 971 00:39:57,640 --> 00:39:59,680 that's because I want to teach you how 972 00:39:59,680 --> 00:40:02,160 you would begin creating the screens for 973 00:40:02,160 --> 00:40:04,720 your entire application by first looking 974 00:40:04,720 --> 00:40:07,560 at the design this right here is a 975 00:40:07,560 --> 00:40:10,400 typical react native application well it 976 00:40:10,400 --> 00:40:12,160 definitely has a design better than most 977 00:40:12,160 --> 00:40:14,119 of the apps out there but you get the 978 00:40:14,119 --> 00:40:16,839 idea we have the homepage some kind of a 979 00:40:16,839 --> 00:40:19,839 search page and also a Details page for 980 00:40:19,839 --> 00:40:21,119 whatever it is that we're searching 981 00:40:21,119 --> 00:40:23,720 through we also have a bottom navigation 982 00:40:23,720 --> 00:40:27,720 for the home screen search saved and the 983 00:40:27,720 --> 00:40:29,960 profile and of course there's also off 984 00:40:29,960 --> 00:40:32,040 so if you'd like me to extend this react 985 00:40:32,040 --> 00:40:33,800 native course to include authentication 986 00:40:33,800 --> 00:40:36,160 2 let me know down below but with that 987 00:40:36,160 --> 00:40:38,680 in mind we now have to figure out how 988 00:40:38,680 --> 00:40:40,960 many screens we have and for each one of 989 00:40:40,960 --> 00:40:42,800 these screens we have to give it a 990 00:40:42,800 --> 00:40:45,560 proper route first of all there's the 991 00:40:45,560 --> 00:40:49,280 home screen the search screen the save 992 00:40:49,280 --> 00:40:52,160 or bookmark screen the profile screen 993 00:40:52,160 --> 00:40:54,680 and finally the movie detail screen out 994 00:40:54,680 --> 00:40:56,560 of these four screens we only want to 995 00:40:56,560 --> 00:40:59,240 show the navigation for the first four 996 00:40:59,240 --> 00:41:01,640 screens and not the movie details 997 00:41:01,640 --> 00:41:03,480 because we'll get to the movie details 998 00:41:03,480 --> 00:41:05,880 by of course clicking on the movie card 999 00:41:05,880 --> 00:41:08,319 Expo allows us to do just that with 1000 00:41:08,319 --> 00:41:11,599 route grouping we can prevent a segment 1001 00:41:11,599 --> 00:41:13,920 from showing in the URL by using the 1002 00:41:13,920 --> 00:41:17,160 group syntax which is just a pair of 1003 00:41:17,160 --> 00:41:19,880 parentheses so for example if we have 1004 00:41:19,880 --> 00:41:24,240 app Root home. TSX it'll match to home 1005 00:41:24,240 --> 00:41:25,920 and if we don't put it into a route 1006 00:41:25,920 --> 00:41:28,800 group then we'll have to say root home 1007 00:41:28,800 --> 00:41:31,119 which we don't want to do so groups are 1008 00:41:31,119 --> 00:41:33,800 great for organizing sections of the app 1009 00:41:33,800 --> 00:41:35,599 so let me show you how we can group our 1010 00:41:35,599 --> 00:41:37,760 routes within the application first 1011 00:41:37,760 --> 00:41:40,160 let's create a group route folder for 1012 00:41:40,160 --> 00:41:44,319 our tabs I'll call it in parentheses 1013 00:41:44,319 --> 00:41:48,040 tabs within tabs we can create a newcore 1014 00:41:48,040 --> 00:41:51,520 layout. DSX so now we want to ensure 1015 00:41:51,520 --> 00:41:54,119 that we show the mobile navigation only 1016 00:41:54,119 --> 00:41:56,000 on that screen keep in mind that there 1017 00:41:56,000 --> 00:41:59,319 can only be one index. TSX route and 1018 00:41:59,319 --> 00:42:01,200 right now it is right here in the root 1019 00:42:01,200 --> 00:42:03,359 of the directory but we actually want to 1020 00:42:03,359 --> 00:42:05,839 put it within tabs because the homage is 1021 00:42:05,839 --> 00:42:08,560 a part of the tabs layout next let's 1022 00:42:08,560 --> 00:42:10,599 create the other three routes by 1023 00:42:10,599 --> 00:42:13,480 creating a new file and naming it 1024 00:42:13,480 --> 00:42:17,599 profile. TSX let's quickly run 1025 00:42:17,599 --> 00:42:20,079 rnfe which will quickly spin up a new 1026 00:42:20,079 --> 00:42:21,079 functional 1027 00:42:21,079 --> 00:42:24,079 component and let's create a second file 1028 00:42:24,079 --> 00:42:26,520 right here or a second screen should I 1029 00:42:26,520 --> 00:42:31,000 say and let's call it saved. TSX also 1030 00:42:31,000 --> 00:42:34,440 run rnf and finally create the last 1031 00:42:34,440 --> 00:42:39,839 screen let's call it search. TSX and run 1032 00:42:39,839 --> 00:42:42,760 rnfe now for the movie details since 1033 00:42:42,760 --> 00:42:45,680 it's outside of that tab layout we want 1034 00:42:45,680 --> 00:42:47,760 to create it within the app by creating 1035 00:42:47,760 --> 00:42:51,800 a new movies folder and within movies 1036 00:42:51,800 --> 00:42:56,359 create a new Dynamic route of id. DSX 1037 00:42:56,359 --> 00:42:58,880 Within square brackets there you can 1038 00:42:58,880 --> 00:43:01,760 also run rnf and make sure to fix the 1039 00:43:01,760 --> 00:43:04,720 name to movie 1040 00:43:04,720 --> 00:43:06,559 details there we 1041 00:43:06,559 --> 00:43:10,680 go perfect now we want to hide this ugly 1042 00:43:10,680 --> 00:43:12,240 header that we have right here at the 1043 00:43:12,240 --> 00:43:15,240 top that says index how can we do that 1044 00:43:15,240 --> 00:43:17,280 well we can head over into the app 1045 00:43:17,280 --> 00:43:20,240 layout. DSX that is this one that we had 1046 00:43:20,240 --> 00:43:23,000 from before not the one within tabs and 1047 00:43:23,000 --> 00:43:26,200 here we can expand the stack component 1048 00:43:26,200 --> 00:43:27,960 and within it we we can render something 1049 00:43:27,960 --> 00:43:31,000 known as a stack. screen which is a 1050 00:43:31,000 --> 00:43:33,440 self-closing component where we can give 1051 00:43:33,440 --> 00:43:37,680 it a name and say that it'll be a string 1052 00:43:37,680 --> 00:43:40,319 of tabs this is the route Group which we 1053 00:43:40,319 --> 00:43:43,760 created and we can also give it options 1054 00:43:43,760 --> 00:43:46,680 of header shown is false and we also 1055 00:43:46,680 --> 00:43:51,559 want to repeat this stack. screen for 1056 00:43:51,559 --> 00:43:54,720 our movie Details page by saying name is 1057 00:43:54,720 --> 00:43:59,119 equal to movie SL ID like this and we 1058 00:43:59,119 --> 00:44:00,040 can 1059 00:44:00,040 --> 00:44:04,520 say options header shown is set to false 1060 00:44:04,520 --> 00:44:07,240 if you save this and reload because the 1061 00:44:07,240 --> 00:44:10,040 header is still here well to hide it 1062 00:44:10,040 --> 00:44:12,280 completely we have to head over into the 1063 00:44:12,280 --> 00:44:15,920 underscore layout of the tabs folder and 1064 00:44:15,920 --> 00:44:17,240 then you can run 1065 00:44:17,240 --> 00:44:20,480 rnfe right here to create a new layout 1066 00:44:20,480 --> 00:44:22,720 instead of returning a view right here 1067 00:44:22,720 --> 00:44:25,319 let's instead return something known as 1068 00:44:25,319 --> 00:44:29,280 tabs coming from Expo router within tabs 1069 00:44:29,280 --> 00:44:32,800 you can render a tabs. screen component 1070 00:44:32,800 --> 00:44:35,280 it is a self-closing component that has 1071 00:44:35,280 --> 00:44:38,160 a name in this case it's index for the 1072 00:44:38,160 --> 00:44:40,160 homepage and then you can provide 1073 00:44:40,160 --> 00:44:43,319 additional options here you can also 1074 00:44:43,319 --> 00:44:46,480 provide a Heather shown is set to false 1075 00:44:46,480 --> 00:44:49,000 as well as a title sets to something 1076 00:44:49,000 --> 00:44:52,119 like home as this is the homepage now if 1077 00:44:52,119 --> 00:44:54,400 you reload your application by opening 1078 00:44:54,400 --> 00:44:55,960 up your terminal and pressing the letter 1079 00:44:55,960 --> 00:44:58,079 R you'll see that there is no header 1080 00:44:58,079 --> 00:45:01,040 shown on top and if I comment out this 1081 00:45:01,040 --> 00:45:03,200 tabs. screen you can see that we still 1082 00:45:03,200 --> 00:45:06,359 have index so it is hiding that single 1083 00:45:06,359 --> 00:45:08,760 route and then this one stack that 1084 00:45:08,760 --> 00:45:12,040 screen if you comment it out this one is 1085 00:45:12,040 --> 00:45:14,599 actually hiding the group route so we 1086 00:45:14,599 --> 00:45:17,040 are right now Under tabs 1087 00:45:17,040 --> 00:45:19,800 Index this one right here hides the 1088 00:45:19,800 --> 00:45:22,280 route groups header and this one right 1089 00:45:22,280 --> 00:45:25,760 here hides that specific screens header 1090 00:45:25,760 --> 00:45:27,599 and it also gives it a name which is 1091 00:45:27,599 --> 00:45:30,200 then shown right here at the bottom so 1092 00:45:30,200 --> 00:45:32,440 tabs allow you to modify how your bottom 1093 00:45:32,440 --> 00:45:34,400 navigation looks like now why did I say 1094 00:45:34,400 --> 00:45:37,640 modify and not create your tabs 1095 00:45:37,640 --> 00:45:39,800 navigation well that's because you can 1096 00:45:39,800 --> 00:45:41,400 see even though we have only declared 1097 00:45:41,400 --> 00:45:43,359 the Home Route immediately right of the 1098 00:45:43,359 --> 00:45:46,599 bat three additional routes are here and 1099 00:45:46,599 --> 00:45:49,040 they work out of the box we didn't do 1100 00:45:49,040 --> 00:45:52,079 anything but yet react native recognized 1101 00:45:52,079 --> 00:45:54,200 that we have three other routes right 1102 00:45:54,200 --> 00:45:57,200 here profile saved search and the the 1103 00:45:57,200 --> 00:45:59,480 home and at the bottom we can switch 1104 00:45:59,480 --> 00:46:02,119 between them but what tabs allow to do 1105 00:46:02,119 --> 00:46:04,400 is to further customize them so let me 1106 00:46:04,400 --> 00:46:06,119 say tabs. 1107 00:46:06,119 --> 00:46:09,359 screen make it self-closing and let's 1108 00:46:09,359 --> 00:46:11,880 give it a name of search as well as the 1109 00:46:11,880 --> 00:46:15,240 options of title search and header shown 1110 00:46:15,240 --> 00:46:17,520 set to false so now we can see it has a 1111 00:46:17,520 --> 00:46:20,000 capital S right here and let's duplicate 1112 00:46:20,000 --> 00:46:21,280 it two more 1113 00:46:21,280 --> 00:46:25,359 times this one for the saved so let me 1114 00:46:25,359 --> 00:46:28,720 call it name saved and title of Saved 1115 00:46:28,720 --> 00:46:30,599 make sure that you called it exactly as 1116 00:46:30,599 --> 00:46:33,119 you did right here and the last one will 1117 00:46:33,119 --> 00:46:36,160 be profile and I'll call it 1118 00:46:36,160 --> 00:46:38,680 profile so now no matter in which route 1119 00:46:38,680 --> 00:46:40,760 we are you can see that the header is 1120 00:46:40,760 --> 00:46:43,960 hidden but this results in a super basic 1121 00:46:43,960 --> 00:46:46,160 boring navigation to make it look more 1122 00:46:46,160 --> 00:46:48,280 similar to what we have on the design we 1123 00:46:48,280 --> 00:46:50,119 have to customize it by defining 1124 00:46:50,119 --> 00:46:52,200 different icons for each tab of the 1125 00:46:52,200 --> 00:46:54,760 navigation screen so I took the time to 1126 00:46:54,760 --> 00:46:57,119 find some cool images and icons so I can 1127 00:46:57,119 --> 00:46:59,319 share them with you below this lesson 1128 00:46:59,319 --> 00:47:01,400 you'll find this Project's video kit 1129 00:47:01,400 --> 00:47:02,880 which includes the link to the project 1130 00:47:02,880 --> 00:47:05,880 repo which then includes the readme that 1131 00:47:05,880 --> 00:47:08,880 has the assets so simply go here and 1132 00:47:08,880 --> 00:47:11,280 download them once you download them 1133 00:47:11,280 --> 00:47:13,559 simply unzip them head over within your 1134 00:47:13,559 --> 00:47:15,839 project and delete the current assets 1135 00:47:15,839 --> 00:47:18,440 folder as we don't need it then simply 1136 00:47:18,440 --> 00:47:20,559 drag and drop all of these folders 1137 00:47:20,559 --> 00:47:24,400 within your movie app there we go I'll 1138 00:47:24,400 --> 00:47:25,920 now explain everything that we brought 1139 00:47:25,920 --> 00:47:29,319 in here first we have the assets the 1140 00:47:29,319 --> 00:47:30,960 assets contain the font that we'll be 1141 00:47:30,960 --> 00:47:34,680 using some icons such as the home logo 1142 00:47:34,680 --> 00:47:37,680 person and more and also some images 1143 00:47:37,680 --> 00:47:39,920 like the background image the Highlight 1144 00:47:39,920 --> 00:47:42,240 logo and more we also have some 1145 00:47:42,240 --> 00:47:45,200 constants such as the icons and images 1146 00:47:45,200 --> 00:47:47,319 where we export all of these images from 1147 00:47:47,319 --> 00:47:49,960 a single file with a specific name so 1148 00:47:49,960 --> 00:47:52,359 it's easier to import them later on and 1149 00:47:52,359 --> 00:47:54,400 we also have some interfaces so the 1150 00:47:54,400 --> 00:47:56,839 typescript knows what kind of fields 1151 00:47:56,839 --> 00:47:59,160 will each one of our documents have so 1152 00:47:59,160 --> 00:48:01,040 with that in mind let's head back over 1153 00:48:01,040 --> 00:48:05,000 to our tabs layout to make our Tabs go 1154 00:48:05,000 --> 00:48:07,800 from this right here at the bottom to 1155 00:48:07,800 --> 00:48:10,440 something that looks more like this we 1156 00:48:10,440 --> 00:48:12,880 can start customizing them let's start 1157 00:48:12,880 --> 00:48:16,079 with the Home tab button react native 1158 00:48:16,079 --> 00:48:18,559 specifically the Tab screen allows us to 1159 00:48:18,559 --> 00:48:21,559 specify how the tab bar icon will look 1160 00:48:21,559 --> 00:48:24,839 like you can provide a callback function 1161 00:48:24,839 --> 00:48:26,960 where you get access to the state of 1162 00:48:26,960 --> 00:48:28,920 that specific icon whether it has 1163 00:48:28,920 --> 00:48:31,760 currently been clicked or not and then 1164 00:48:31,760 --> 00:48:34,480 here we can return an empty react 1165 00:48:34,480 --> 00:48:37,520 fragment for now and within it we can 1166 00:48:37,520 --> 00:48:40,640 return maybe like a background image 1167 00:48:40,640 --> 00:48:43,280 what do you think so first I'll return 1168 00:48:43,280 --> 00:48:46,760 an image background coming from react 1169 00:48:46,760 --> 00:48:51,440 native that'll have a source equal to 1170 00:48:51,440 --> 00:48:54,359 images make sure to click enter right 1171 00:48:54,359 --> 00:48:56,880 here before you finish typing them to a 1172 00:48:56,880 --> 00:48:59,119 to import them from constants my 1173 00:48:59,119 --> 00:49:00,960 webstorm did that very nicely for me 1174 00:49:00,960 --> 00:49:02,480 here so you can see that I imported 1175 00:49:02,480 --> 00:49:06,880 images from add/ constants SL images and 1176 00:49:06,880 --> 00:49:09,760 then we can say images. highlight 1177 00:49:09,760 --> 00:49:11,640 highlight is this little part so when 1178 00:49:11,640 --> 00:49:13,520 we're currently on that screen you can 1179 00:49:13,520 --> 00:49:16,359 show this little pill likee shape next 1180 00:49:16,359 --> 00:49:18,359 within this image background we can 1181 00:49:18,359 --> 00:49:21,040 render a regular image coming from react 1182 00:49:21,040 --> 00:49:24,640 native with a source equal to 1183 00:49:24,640 --> 00:49:28,079 images. home and we can give it a tint 1184 00:49:28,079 --> 00:49:30,599 color equal to 1185 00:49:30,599 --> 00:49:33,480 # 151 1186 00:49:33,480 --> 00:49:39,119 312 as well as a class name equal to 1187 00:49:39,119 --> 00:49:42,200 size-5 and we can close it right here 1188 00:49:42,200 --> 00:49:45,400 and we can also give it a text property 1189 00:49:45,400 --> 00:49:48,359 that'll simply render the word home okay 1190 00:49:48,359 --> 00:49:50,359 so now this is looking a bit off 1191 00:49:50,359 --> 00:49:53,200 definitely not what we expected so let's 1192 00:49:53,200 --> 00:49:56,240 style it a bit I'll give this Source a 1193 00:49:56,240 --> 00:50:02,599 class name equal to flex Flex - row w- 1194 00:50:02,599 --> 00:50:04,480 full Flex 1195 00:50:04,480 --> 00:50:11,000 D1 m-w of 112 pixels I found this value 1196 00:50:11,000 --> 00:50:15,079 to work the best with a Min height of 14 1197 00:50:15,079 --> 00:50:16,960 a margin top of 1198 00:50:16,960 --> 00:50:21,040 four justify Dash center items Das 1199 00:50:21,040 --> 00:50:23,760 Center to fully Center it rounded Das 1200 00:50:23,760 --> 00:50:27,160 full and overflow Das 1201 00:50:27,160 --> 00:50:28,960 there we go so now we have this real 1202 00:50:28,960 --> 00:50:31,440 pill like shape if it's active let's 1203 00:50:31,440 --> 00:50:34,640 also render an actual icon it is under 1204 00:50:34,640 --> 00:50:37,680 icons. home but also make sure to import 1205 00:50:37,680 --> 00:50:40,119 the icons from constants and now we can 1206 00:50:40,119 --> 00:50:43,280 see this icon and we can style this text 1207 00:50:43,280 --> 00:50:46,319 by giving it a class name of text- 1208 00:50:46,319 --> 00:50:48,359 secondary 1209 00:50:48,359 --> 00:50:51,400 text-base font D 1210 00:50:51,400 --> 00:50:54,799 semibold and margin left off 1211 00:50:54,799 --> 00:50:57,760 two okay so this is looking good now we 1212 00:50:57,760 --> 00:50:59,839 want to repeat this for every single 1213 00:50:59,839 --> 00:51:02,000 icon and instead of copying this code 1214 00:51:02,000 --> 00:51:04,119 and duplicating it four times let's 1215 00:51:04,119 --> 00:51:07,200 actually extract it into its own custom 1216 00:51:07,200 --> 00:51:10,319 component so this is not a react native 1217 00:51:10,319 --> 00:51:12,160 specific thing it is just how we do 1218 00:51:12,160 --> 00:51:14,640 things around react so take this as a 1219 00:51:14,640 --> 00:51:17,160 mini lesson whenever you have to repeat 1220 00:51:17,160 --> 00:51:20,000 this multiple times it's better to 1221 00:51:20,000 --> 00:51:23,160 extract it okay so now I'll take this 1222 00:51:23,160 --> 00:51:26,240 entire image background and I'll create 1223 00:51:26,240 --> 00:51:28,760 a new component out of it by saying 1224 00:51:28,760 --> 00:51:32,839 const tab icon is equal to a functional 1225 00:51:32,839 --> 00:51:35,720 component that returns this image 1226 00:51:35,720 --> 00:51:37,720 background which I can just space right 1227 00:51:37,720 --> 00:51:39,520 here but it seems like we have an error 1228 00:51:39,520 --> 00:51:42,000 so let's put this component to use by 1229 00:51:42,000 --> 00:51:44,440 rendering it right here instead of the 1230 00:51:44,440 --> 00:51:47,079 code that was previously on here tab 1231 00:51:47,079 --> 00:51:49,319 icon and immediately we get the same 1232 00:51:49,319 --> 00:51:52,559 output but it looks so much better but 1233 00:51:52,559 --> 00:51:54,319 now here's the problem whenever you 1234 00:51:54,319 --> 00:51:55,960 extract something into a custom 1235 00:51:55,960 --> 00:51:57,040 component 1236 00:51:57,040 --> 00:51:59,359 well how are you going to reuse it right 1237 00:51:59,359 --> 00:52:01,160 because now if I head into the options 1238 00:52:01,160 --> 00:52:03,920 of the search screen and I say something 1239 00:52:03,920 --> 00:52:07,559 like tab bar icon where again we can 1240 00:52:07,559 --> 00:52:10,880 Define how it looks like and then I 1241 00:52:10,880 --> 00:52:12,559 specify that I want to show some kind of 1242 00:52:12,559 --> 00:52:15,799 an icon well what happens it's going to 1243 00:52:15,799 --> 00:52:17,920 be the same one as in the home so of 1244 00:52:17,920 --> 00:52:20,200 course we want to figure out a way of 1245 00:52:20,200 --> 00:52:22,839 how we can differentiate those two 1246 00:52:22,839 --> 00:52:24,799 places where that component is being 1247 00:52:24,799 --> 00:52:28,599 used and here this is a mini lesson on 1248 00:52:28,599 --> 00:52:31,079 reusability you want to figure out how 1249 00:52:31,079 --> 00:52:34,480 to make a custom component reusable and 1250 00:52:34,480 --> 00:52:37,160 you can do that of course through props 1251 00:52:37,160 --> 00:52:38,920 so many things here are always going to 1252 00:52:38,920 --> 00:52:40,880 be the same such as the image background 1253 00:52:40,880 --> 00:52:43,480 component the classes we're going to use 1254 00:52:43,480 --> 00:52:46,079 and the colors of the text but what will 1255 00:52:46,079 --> 00:52:50,079 change is going to be the icon the text 1256 00:52:50,079 --> 00:52:52,240 and maybe the state of the focus are we 1257 00:52:52,240 --> 00:52:54,839 currently on home or are we on search so 1258 00:52:54,839 --> 00:52:56,559 whatever changes from component to 1259 00:52:56,559 --> 00:52:59,400 component you have to pass it as a prop 1260 00:52:59,400 --> 00:53:02,720 I'll pass a focus State equal to focused 1261 00:53:02,720 --> 00:53:06,440 as well as an icon equal to icons. home 1262 00:53:06,440 --> 00:53:09,640 as well as a title equal to home and 1263 00:53:09,640 --> 00:53:11,799 I'll put it into multiple lines so it's 1264 00:53:11,799 --> 00:53:14,319 easier to read I'll copy it and I'll 1265 00:53:14,319 --> 00:53:17,040 paste it right here for the search but 1266 00:53:17,040 --> 00:53:19,040 for the search of course it's not going 1267 00:53:19,040 --> 00:53:21,680 to be just icons. home it's going to be 1268 00:53:21,680 --> 00:53:24,680 icons. search and the title will be set 1269 00:53:24,680 --> 00:53:26,680 to search 1270 00:53:26,680 --> 00:53:28,400 and now we can also just copy this 1271 00:53:28,400 --> 00:53:31,480 entire tab bar icon and add it for the 1272 00:53:31,480 --> 00:53:35,359 other two icons this one the third one 1273 00:53:35,359 --> 00:53:38,440 will actually be called save so I'll say 1274 00:53:38,440 --> 00:53:42,880 tab icon icons Dove and the title can be 1275 00:53:42,880 --> 00:53:45,920 saved the icon name is save without the 1276 00:53:45,920 --> 00:53:48,599 D but I decided to add the D right here 1277 00:53:48,599 --> 00:53:51,640 saved and finally the last one will be 1278 00:53:51,640 --> 00:53:54,520 the profile so here we can render 1279 00:53:54,520 --> 00:53:58,760 focused icons. person and the title will 1280 00:53:58,760 --> 00:54:02,200 be profile now if I save this you can 1281 00:54:02,200 --> 00:54:05,319 still see that all four of them say home 1282 00:54:05,319 --> 00:54:07,640 but now let me collapse them just so you 1283 00:54:07,640 --> 00:54:10,359 can see how tidy this looks like there 1284 00:54:10,359 --> 00:54:13,200 we go so now we have four different tab 1285 00:54:13,200 --> 00:54:15,839 screens with different titles and icons 1286 00:54:15,839 --> 00:54:18,079 and the only thing we have to do is 1287 00:54:18,079 --> 00:54:20,240 extract those props right here at the 1288 00:54:20,240 --> 00:54:24,640 top focused icon and title for now we 1289 00:54:24,640 --> 00:54:26,680 can make them of the type any and we 1290 00:54:26,680 --> 00:54:28,400 have to use them whenever something has 1291 00:54:28,400 --> 00:54:31,160 to be dynamic so instead of icons. 1292 00:54:31,160 --> 00:54:34,040 something I'll simply render the icon 1293 00:54:34,040 --> 00:54:36,119 through passing through props and here 1294 00:54:36,119 --> 00:54:38,720 instead of saying home I will render the 1295 00:54:38,720 --> 00:54:41,400 title if I now save this you can see 1296 00:54:41,400 --> 00:54:43,680 that the icons for all four of them have 1297 00:54:43,680 --> 00:54:46,400 changed also not always we want to show 1298 00:54:46,400 --> 00:54:48,319 this image background we only want to 1299 00:54:48,319 --> 00:54:51,880 show it if it's focused so I'll say if 1300 00:54:51,880 --> 00:54:56,440 focused in that case we can return 1301 00:54:56,440 --> 00:54:58,880 whatever is right here so I'll indent it 1302 00:54:58,880 --> 00:55:02,559 properly and end it else I'll return 1303 00:55:02,559 --> 00:55:05,440 something much simpler like a simple 1304 00:55:05,440 --> 00:55:08,920 view that'll render an image of a source 1305 00:55:08,920 --> 00:55:13,880 equal to Icon a tint color equal to # 1306 00:55:13,880 --> 00:55:19,160 a8b 5db and a class name of size of five 1307 00:55:19,160 --> 00:55:21,240 of course import the view from react 1308 00:55:21,240 --> 00:55:24,960 native and give it a class name of size- 1309 00:55:24,960 --> 00:55:29,559 FO justify - center items Das Center 1310 00:55:29,559 --> 00:55:32,640 margin top of four and the rounded Das 1311 00:55:32,640 --> 00:55:35,280 full if you do that you'll notice that 1312 00:55:35,280 --> 00:55:37,160 now the icons are going to look much 1313 00:55:37,160 --> 00:55:40,480 better so let's collapse our tab icon 1314 00:55:40,480 --> 00:55:42,760 and let's further customize how all of 1315 00:55:42,760 --> 00:55:45,000 the icons together look we can do that 1316 00:55:45,000 --> 00:55:47,319 through options not on the individual 1317 00:55:47,319 --> 00:55:50,400 tab screens but we can do it directly on 1318 00:55:50,400 --> 00:55:54,720 the tabs by saying screen options and 1319 00:55:54,720 --> 00:55:58,960 here can say tab bar show label we can 1320 00:55:58,960 --> 00:56:01,480 set that to false so now we have no 1321 00:56:01,480 --> 00:56:04,920 labels just the icons we can also modify 1322 00:56:04,920 --> 00:56:08,240 the tab bar item style and I'll give it 1323 00:56:08,240 --> 00:56:10,280 a width of 1324 00:56:10,280 --> 00:56:15,799 100% a height of 100% as well I'll give 1325 00:56:15,799 --> 00:56:19,039 it a Justified content of Center as well 1326 00:56:19,039 --> 00:56:22,760 as a line items off center as well and 1327 00:56:22,760 --> 00:56:26,520 we can also modify the tab bar Style so 1328 00:56:26,520 --> 00:56:29,160 this is the entire tab on its own where 1329 00:56:29,160 --> 00:56:32,520 I'll change the background color to Hash 1330 00:56:32,520 --> 00:56:34,920 0 F0 1331 00:56:34,920 --> 00:56:39,119 d23 border radius will be set to about 1332 00:56:39,119 --> 00:56:42,359 50 there we go we can also give it a 1333 00:56:42,359 --> 00:56:45,960 margin horizontal of about 20 let's also 1334 00:56:45,960 --> 00:56:48,760 give it a margin bottom of 1335 00:56:48,760 --> 00:56:54,920 36 a height of 52 a position of absolute 1336 00:56:54,920 --> 00:57:00,079 overflow of hidden and Border width of 1337 00:57:00,079 --> 00:57:01,400 just 1338 00:57:01,400 --> 00:57:04,480 one with a border color which is going 1339 00:57:04,480 --> 00:57:08,319 to be the same color we used above 0 F0 1340 00:57:08,319 --> 00:57:10,920 d23 and there we have it we have a 1341 00:57:10,920 --> 00:57:12,880 navigation bar that looks much more 1342 00:57:12,880 --> 00:57:15,039 similar to the one we have here to make 1343 00:57:15,039 --> 00:57:17,119 it perfect we just have to fix this 1344 00:57:17,119 --> 00:57:19,200 small little inconsistency where the 1345 00:57:19,200 --> 00:57:21,760 height of this pill like shape is not 1346 00:57:21,760 --> 00:57:24,039 matching the height of the entire bar so 1347 00:57:24,039 --> 00:57:25,799 let's quickly head over into the tab 1348 00:57:25,799 --> 00:57:29,240 icon and increase the mint age from 14 1349 00:57:29,240 --> 00:57:33,720 to 16 and that did the trick perfect so 1350 00:57:33,720 --> 00:57:35,799 now take your phone in your hand and 1351 00:57:35,799 --> 00:57:37,839 just click between different pages 1352 00:57:37,839 --> 00:57:39,440 you'll only see welcome on the home 1353 00:57:39,440 --> 00:57:41,599 screen and the rest of the pages will 1354 00:57:41,599 --> 00:57:43,839 appear blank but if you pay close 1355 00:57:43,839 --> 00:57:46,000 attention to the top left corner you'll 1356 00:57:46,000 --> 00:57:48,160 see that some text is changing it's just 1357 00:57:48,160 --> 00:57:50,839 that it's not visible within our current 1358 00:57:50,839 --> 00:57:52,760 view but if you've been paying close 1359 00:57:52,760 --> 00:57:54,559 attention to the crash course I already 1360 00:57:54,559 --> 00:57:55,920 mentioned that there's an element that 1361 00:57:55,920 --> 00:57:57,880 can help us make sure that everything 1362 00:57:57,880 --> 00:58:00,520 fits nicely within the screen so we'll 1363 00:58:00,520 --> 00:58:02,599 explore it soon but I'm already super 1364 00:58:02,599 --> 00:58:04,720 happy with this because you have just 1365 00:58:04,720 --> 00:58:07,280 implemented a fully functional routing 1366 00:58:07,280 --> 00:58:10,280 system with a custom bottom navigation 1367 00:58:10,280 --> 00:58:12,680 bar that allows us to switch between 1368 00:58:12,680 --> 00:58:16,119 four different screens great job I know 1369 00:58:16,119 --> 00:58:18,559 this was a long lesson so I'll keep the 1370 00:58:18,559 --> 00:58:21,359 next one much shorter but equally as 1371 00:58:21,359 --> 00:58:23,319 important I'll show you how to customize 1372 00:58:23,319 --> 00:58:25,720 the logo of your application so when 1373 00:58:25,720 --> 00:58:29,559 users want to use it they know where to 1374 00:58:29,559 --> 00:58:32,200 click before we start developing this 1375 00:58:32,200 --> 00:58:34,240 beautiful home screen UI I want to 1376 00:58:34,240 --> 00:58:35,880 quickly show you how you can customize 1377 00:58:35,880 --> 00:58:38,079 your Expo app to show the logo of your 1378 00:58:38,079 --> 00:58:40,559 application when it's loading if you 1379 00:58:40,559 --> 00:58:42,200 check out your terminal you'll see an 1380 00:58:42,200 --> 00:58:45,039 error saying asset not found and right 1381 00:58:45,039 --> 00:58:48,240 here unable to resolve your asset assets 1382 00:58:48,240 --> 00:58:52,039 images icon.png within your app.js or 1383 00:58:52,039 --> 00:58:55,640 app.config DJs this is because when we 1384 00:58:55,640 --> 00:58:57,760 change the assets we're no longer 1385 00:58:57,760 --> 00:59:01,000 satisfying the need of our app.js to 1386 00:59:01,000 --> 00:59:03,760 show our applications icon it's pointing 1387 00:59:03,760 --> 00:59:06,720 to a pad that doesn't exist so let's fix 1388 00:59:06,720 --> 00:59:10,200 it we can show an icon called assets 1389 00:59:10,200 --> 00:59:12,039 images 1390 00:59:12,039 --> 00:59:15,359 logo.png you can copy it that full path 1391 00:59:15,359 --> 00:59:17,799 and we can also change it for Android as 1392 00:59:17,799 --> 00:59:20,839 the foreground image and while we're 1393 00:59:20,839 --> 00:59:24,000 here let's also change it for the web 1394 00:59:24,000 --> 00:59:26,880 right here as the favicon oh and right 1395 00:59:26,880 --> 00:59:29,079 here under the Expo splash screen let's 1396 00:59:29,079 --> 00:59:31,480 modify it here as well perfect so once 1397 00:59:31,480 --> 00:59:34,240 you do this open up your terminal and 1398 00:59:34,240 --> 00:59:36,839 press R to reload your application for 1399 00:59:36,839 --> 00:59:38,960 the changes to take effect as soon as it 1400 00:59:38,960 --> 00:59:41,440 bundles the error will be gone and our 1401 00:59:41,440 --> 00:59:43,680 icon will be applied so now if you 1402 00:59:43,680 --> 00:59:45,920 reopen your XO app you should be able to 1403 00:59:45,920 --> 00:59:48,599 see something like this mobile movie app 1404 00:59:48,599 --> 00:59:50,480 right here or if you want to change the 1405 00:59:50,480 --> 00:59:53,599 name too to something better like movie 1406 00:59:53,599 --> 00:59:56,440 Flex you can do that too and for this 1407 00:59:56,440 --> 00:59:58,319 change you'll actually have to reopen 1408 00:59:58,319 --> 01:00:02,520 your Expo app and rescan the QR code 1409 01:00:02,520 --> 01:00:05,480 too there we go now we can see this icon 1410 01:00:05,480 --> 01:00:07,520 even on the splash screen and when you 1411 01:00:07,520 --> 01:00:10,200 open it within Expo there we go both the 1412 01:00:10,200 --> 01:00:12,680 icon and the title are here too of 1413 01:00:12,680 --> 01:00:15,200 course we're within Expo right now but 1414 01:00:15,200 --> 01:00:17,799 this would be reflected on your devic's 1415 01:00:17,799 --> 01:00:20,160 home screen I mean just imagine opening 1416 01:00:20,160 --> 01:00:22,440 up your iPhone or Android device and 1417 01:00:22,440 --> 01:00:24,319 seeing your app on the home screen right 1418 01:00:24,319 --> 01:00:27,160 there with its icon and the title pretty 1419 01:00:27,160 --> 01:00:29,559 cool right there we go as promised this 1420 01:00:29,559 --> 01:00:32,960 was a short and sweet lesson next we can 1421 01:00:32,960 --> 01:00:35,160 focus on a super important part of this 1422 01:00:35,160 --> 01:00:38,039 course which is building out the UI of 1423 01:00:38,039 --> 01:00:42,200 our homepage so let's do that 1424 01:00:42,200 --> 01:00:45,200 next to start developing the UI over our 1425 01:00:45,200 --> 01:00:49,000 home screen head over into app tabs and 1426 01:00:49,000 --> 01:00:52,000 then index.ts X here is where we have 1427 01:00:52,000 --> 01:00:54,640 this welcome so for now let's focus on 1428 01:00:54,640 --> 01:00:56,559 implementing the header component 1429 01:00:56,559 --> 01:00:59,559 I'll clear this entire View and create 1430 01:00:59,559 --> 01:01:03,039 another this one will have a class name 1431 01:01:03,039 --> 01:01:07,440 equal to flex das1 and BG of primary 1432 01:01:07,440 --> 01:01:09,319 finally we're going to go away from this 1433 01:01:09,319 --> 01:01:12,559 light screen to a nice dark color within 1434 01:01:12,559 --> 01:01:15,240 this view we can render an image coming 1435 01:01:15,240 --> 01:01:18,079 from react native see how webstorm very 1436 01:01:18,079 --> 01:01:21,079 easily Auto Imports it at the top and we 1437 01:01:21,079 --> 01:01:23,680 can render a source and give it a source 1438 01:01:23,680 --> 01:01:25,720 of images now keep in mind if I just 1439 01:01:25,720 --> 01:01:27,960 press press enter it'll autoimport it 1440 01:01:27,960 --> 01:01:32,119 once again from at/ constants SL images 1441 01:01:32,119 --> 01:01:35,400 and I'll call the images. BG for the 1442 01:01:35,400 --> 01:01:37,880 background let's position it a bit by 1443 01:01:37,880 --> 01:01:41,640 giving it a class name equal to Absolute 1444 01:01:41,640 --> 01:01:43,839 let's also give it a w full so it takes 1445 01:01:43,839 --> 01:01:46,319 the full width of the screen as well as 1446 01:01:46,319 --> 01:01:48,559 a z index of zero so we can show some 1447 01:01:48,559 --> 01:01:51,000 elements on top of it right below it we 1448 01:01:51,000 --> 01:01:54,240 can render a scroll view this is used to 1449 01:01:54,240 --> 01:01:56,680 make the whole screen scrollable so if 1450 01:01:56,680 --> 01:01:58,880 there's a lot of vertical content that 1451 01:01:58,880 --> 01:02:01,559 might not fit within a single view then 1452 01:02:01,559 --> 01:02:03,119 you need to wrap everything within a 1453 01:02:03,119 --> 01:02:05,039 scroll view for users with smaller 1454 01:02:05,039 --> 01:02:07,799 devices to be able to see it let's give 1455 01:02:07,799 --> 01:02:12,480 it a class name equal to flex D1 and a 1456 01:02:12,480 --> 01:02:14,359 padding X of five to give it some 1457 01:02:14,359 --> 01:02:16,880 horizontal spacing within it for now 1458 01:02:16,880 --> 01:02:20,000 let's just render a single image that'll 1459 01:02:20,000 --> 01:02:23,319 have a source equal to 1460 01:02:23,319 --> 01:02:27,279 icons again coming from constants . logo 1461 01:02:27,279 --> 01:02:31,319 with a class name equal to W of 12 for 1462 01:02:31,319 --> 01:02:34,920 the width h of 10 for the height margin 1463 01:02:34,920 --> 01:02:36,960 top of 20 to divide it a bit from the 1464 01:02:36,960 --> 01:02:40,680 top margin bottom of five and margin X 1465 01:02:40,680 --> 01:02:43,480 of Auto to center it in the middle there 1466 01:02:43,480 --> 01:02:45,200 we go this is starting to look like a 1467 01:02:45,200 --> 01:02:47,520 real app already now if we had more 1468 01:02:47,520 --> 01:02:49,520 content we would have this ugly scroll 1469 01:02:49,520 --> 01:02:52,279 bar at the right side so to remove it we 1470 01:02:52,279 --> 01:02:54,240 can give an additional prop to the 1471 01:02:54,240 --> 01:02:58,160 scroll view called show or rather shows 1472 01:02:58,160 --> 01:03:00,839 vertical scroll indicator which I'll set 1473 01:03:00,839 --> 01:03:04,359 to false and I'll also give it a 1474 01:03:04,359 --> 01:03:08,200 Content container style which will be 1475 01:03:08,200 --> 01:03:11,240 equal to an object where Min height will 1476 01:03:11,240 --> 01:03:15,400 be set to 100% And also padding bottom 1477 01:03:15,400 --> 01:03:18,079 will be set to 10 so now you can see if 1478 01:03:18,079 --> 01:03:20,640 you scroll up and down it kind of moves 1479 01:03:20,640 --> 01:03:22,559 the logo moves right but we have no 1480 01:03:22,559 --> 01:03:25,039 content to show so very soon we'll be 1481 01:03:25,039 --> 01:03:27,079 able to add some content but first 1482 01:03:27,079 --> 01:03:28,799 things first we have to ask ourselves 1483 01:03:28,799 --> 01:03:30,400 what is the first thing that we want to 1484 01:03:30,400 --> 01:03:33,039 show on the homepage and it'll be the 1485 01:03:33,039 --> 01:03:35,160 search bar which will be our first 1486 01:03:35,160 --> 01:03:38,039 component of the day so let's create a 1487 01:03:38,039 --> 01:03:42,400 new components 1488 01:03:42,400 --> 01:03:45,760 folder and within it let's create a new 1489 01:03:45,760 --> 01:03:48,920 file called search 1490 01:03:48,920 --> 01:03:53,079 bar. TSX and within it run 1491 01:03:53,079 --> 01:03:57,039 rnfe to quickly create a new component 1492 01:03:57,039 --> 01:03:58,599 now we want to be able to see that 1493 01:03:58,599 --> 01:04:01,400 component somewhere so let's head back 1494 01:04:01,400 --> 01:04:04,960 into the index. TSX and let's head right 1495 01:04:04,960 --> 01:04:09,279 below this logo image and render The 1496 01:04:09,279 --> 01:04:13,000 View that'll have a class name of Flex 1497 01:04:13,000 --> 01:04:16,640 one and margin top of five and within it 1498 01:04:16,640 --> 01:04:19,119 just render a self-closing search bar 1499 01:04:19,119 --> 01:04:22,960 bar component coming from at/ components 1500 01:04:22,960 --> 01:04:24,480 SL 1501 01:04:24,480 --> 01:04:26,680 searchbar now you won't be able to see 1502 01:04:26,680 --> 01:04:28,839 it yet because right now it is just a 1503 01:04:28,839 --> 01:04:30,559 single piece of text which is hard to 1504 01:04:30,559 --> 01:04:32,720 see on a dark background but of course 1505 01:04:32,720 --> 01:04:34,839 we're going to style it further so let's 1506 01:04:34,839 --> 01:04:37,640 start by giving this view a class name 1507 01:04:37,640 --> 01:04:42,279 equal to flex Das row items Das Center 1508 01:04:42,279 --> 01:04:47,319 BG dark 200 rounded Das full and padding 1509 01:04:47,319 --> 01:04:50,720 X of five as well as padding y of four 1510 01:04:50,720 --> 01:04:53,200 to create some spacing in between it we 1511 01:04:53,200 --> 01:04:55,680 can render an image which is going to be 1512 01:04:55,680 --> 01:04:57,839 kind of like a search icon so let's 1513 01:04:57,839 --> 01:05:00,559 import the image component and give it a 1514 01:05:00,559 --> 01:05:03,680 source equal to icons. 1515 01:05:03,680 --> 01:05:07,319 search with a class name equal to size 1516 01:05:07,319 --> 01:05:08,200 of 1517 01:05:08,200 --> 01:05:13,440 five a resize mode equal to 1518 01:05:13,440 --> 01:05:17,480 contain as well as a tint color equal to 1519 01:05:17,480 --> 01:05:19,119 Hash 1520 01:05:19,119 --> 01:05:22,640 AB8 BFF and of course don't forget to 1521 01:05:22,640 --> 01:05:26,319 import the icons coming from constant 1522 01:05:26,319 --> 01:05:28,279 if you do that you should be able to see 1523 01:05:28,279 --> 01:05:31,000 this little icon at the top left below 1524 01:05:31,000 --> 01:05:34,799 it we can render a text input okay so a 1525 01:05:34,799 --> 01:05:37,279 text input is like an input component in 1526 01:05:37,279 --> 01:05:40,640 react or in regular HTML and it allows 1527 01:05:40,640 --> 01:05:43,640 you to pass similar things to it such as 1528 01:05:43,640 --> 01:05:45,880 the onpress functionality which for now 1529 01:05:45,880 --> 01:05:47,400 I'll just leave as an empty coolback 1530 01:05:47,400 --> 01:05:49,880 function a placeholder that you can pass 1531 01:05:49,880 --> 01:05:52,000 to it which can be something like search 1532 01:05:52,000 --> 01:05:55,400 for now a value which can be equal to an 1533 01:05:55,400 --> 01:05:59,279 empty string for now an onchange text 1534 01:05:59,279 --> 01:06:01,160 which for now will be equal to an empty 1535 01:06:01,160 --> 01:06:04,400 callback function a placeholder text 1536 01:06:04,400 --> 01:06:06,359 color which can be similar to our tint 1537 01:06:06,359 --> 01:06:07,799 color 1538 01:06:07,799 --> 01:06:11,920 a8b 5db there we go now we can see it 1539 01:06:11,920 --> 01:06:13,920 and finally we can give it a class name 1540 01:06:13,920 --> 01:06:18,480 of flex D1 margin left of two and text- 1541 01:06:18,480 --> 01:06:20,760 white so now we have what appears to be 1542 01:06:20,760 --> 01:06:22,920 a very simple search and when you click 1543 01:06:22,920 --> 01:06:24,799 on it you can see that your keyboard 1544 01:06:24,799 --> 01:06:27,520 actually opens up giving you a way to 1545 01:06:27,520 --> 01:06:29,520 type something in now what we need to do 1546 01:06:29,520 --> 01:06:32,119 to make this somewhat functional is pass 1547 01:06:32,119 --> 01:06:35,920 the real onpress value from the index so 1548 01:06:35,920 --> 01:06:37,279 typically when you have smaller 1549 01:06:37,279 --> 01:06:39,920 components like a search bar on its own 1550 01:06:39,920 --> 01:06:41,559 it doesn't necessarily have to be 1551 01:06:41,559 --> 01:06:43,680 concerned with what it is doing 1552 01:06:43,680 --> 01:06:45,920 typically you have some logic that you 1553 01:06:45,920 --> 01:06:48,240 pass from the parent component to the 1554 01:06:48,240 --> 01:06:50,400 child component in this case the search 1555 01:06:50,400 --> 01:06:54,119 bar so what we can do is Define the 1556 01:06:54,119 --> 01:06:57,079 router right here here in the homepage 1557 01:06:57,079 --> 01:07:00,119 you can say something like import use 1558 01:07:00,119 --> 01:07:03,680 router coming from Expo router you can 1559 01:07:03,680 --> 01:07:06,119 Define that router right here by saying 1560 01:07:06,119 --> 01:07:09,760 const router is equal to use router by 1561 01:07:09,760 --> 01:07:11,160 the way this is the first time we're 1562 01:07:11,160 --> 01:07:12,960 using the router right here and what 1563 01:07:12,960 --> 01:07:15,160 we're doing here is essentially using 1564 01:07:15,160 --> 01:07:17,920 something known as a hook so in react 1565 01:07:17,920 --> 01:07:20,279 and therefore in react native when 1566 01:07:20,279 --> 01:07:23,279 something starts with the word use that 1567 01:07:23,279 --> 01:07:26,400 means that it is called a hook and hooks 1568 01:07:26,400 --> 01:07:28,400 are typically called at the top of our 1569 01:07:28,400 --> 01:07:30,240 functional components and then they 1570 01:07:30,240 --> 01:07:32,760 expose additional functionalities in 1571 01:07:32,760 --> 01:07:34,760 this case the router functionality 1572 01:07:34,760 --> 01:07:36,799 allows us to move between different 1573 01:07:36,799 --> 01:07:39,440 screens programmatically not necessarily 1574 01:07:39,440 --> 01:07:41,680 by clicking a button or something but we 1575 01:07:41,680 --> 01:07:43,799 can use it to go to another page or 1576 01:07:43,799 --> 01:07:46,760 screen when something happens in this 1577 01:07:46,760 --> 01:07:49,839 case I will pass two props to the search 1578 01:07:49,839 --> 01:07:52,839 bar the first one will be the onpress 1579 01:07:52,839 --> 01:07:55,079 functionality that will for now call the 1580 01:07:55,079 --> 01:07:57,960 call function and then call the router. 1581 01:07:57,960 --> 01:08:02,240 push which will push it to for SL search 1582 01:08:02,240 --> 01:08:03,640 okay so we want to move to the search 1583 01:08:03,640 --> 01:08:06,520 screen once pressed and I'll also pass a 1584 01:08:06,520 --> 01:08:10,319 placeholder equal to search for a movie 1585 01:08:10,319 --> 01:08:12,559 now if we head into the search bar we 1586 01:08:12,559 --> 01:08:15,240 can accept these different props so 1587 01:08:15,240 --> 01:08:17,319 right here at the top I can destructure 1588 01:08:17,319 --> 01:08:20,640 them and accept the placeholder as well 1589 01:08:20,640 --> 01:08:23,238 as the on press and these can be of a 1590 01:08:23,238 --> 01:08:26,679 type props so right above it we can 1591 01:08:26,679 --> 01:08:29,880 define a typescript interface called 1592 01:08:29,880 --> 01:08:32,960 props and just say that the placeholder 1593 01:08:32,960 --> 01:08:36,198 will always be of a type string and on 1594 01:08:36,198 --> 01:08:40,120 press will be optional and it'll be of a 1595 01:08:40,120 --> 01:08:43,359 type function that returns void meaning 1596 01:08:43,359 --> 01:08:45,520 nothing the goal of this function is not 1597 01:08:45,520 --> 01:08:48,920 to return something rather it is to use 1598 01:08:48,920 --> 01:08:51,080 the router functionality to push to a 1599 01:08:51,080 --> 01:08:53,439 different URL so if you haven't used 1600 01:08:53,439 --> 01:08:55,920 typescript before don't worry what this 1601 01:08:55,920 --> 01:08:58,799 interface does is it simply tells our 1602 01:08:58,799 --> 01:09:00,600 react application or react native in 1603 01:09:00,600 --> 01:09:02,600 this case what the types of those props 1604 01:09:02,600 --> 01:09:06,040 should be so now on press we can call 1605 01:09:06,040 --> 01:09:07,880 the onpress functionality that we're 1606 01:09:07,880 --> 01:09:10,600 passing through props and also we can 1607 01:09:10,600 --> 01:09:12,399 pass in the 1608 01:09:12,399 --> 01:09:15,120 placeholder there we go search for a 1609 01:09:15,120 --> 01:09:17,520 movie now check this out as soon as I 1610 01:09:17,520 --> 01:09:19,600 click search for a movie it actually 1611 01:09:19,600 --> 01:09:22,238 redirects me to another screen called 1612 01:09:22,238 --> 01:09:23,198 the search 1613 01:09:23,198 --> 01:09:25,679 screen which will Implement very very 1614 01:09:25,679 --> 01:09:27,759 very soon but of course it doesn't make 1615 01:09:27,759 --> 01:09:29,880 sense to start implementing the search a 1616 01:09:29,880 --> 01:09:32,040 movie screen if we don't yet have any 1617 01:09:32,040 --> 01:09:34,279 movies to search for so in the next 1618 01:09:34,279 --> 01:09:36,198 lesson let's go ahead and fetch the 1619 01:09:36,198 --> 01:09:39,759 movies data from a third party 1620 01:09:39,759 --> 01:09:43,080 API to fetch the movies for our great 1621 01:09:43,080 --> 01:09:46,640 mobile movie application we'll use tmdb 1622 01:09:46,640 --> 01:09:49,198 a database off I think every movie that 1623 01:09:49,198 --> 01:09:51,080 you can possibly think of this is their 1624 01:09:51,080 --> 01:09:53,640 public facing website but they also have 1625 01:09:53,640 --> 01:09:56,719 an API so if you Google for tmdb API 1626 01:09:56,719 --> 01:09:58,480 getting started or I'm going to also 1627 01:09:58,480 --> 01:10:00,480 leave the link in the description then 1628 01:10:00,480 --> 01:10:02,080 you'll be able to find this getting 1629 01:10:02,080 --> 01:10:04,800 started guide head over to the API 1630 01:10:04,800 --> 01:10:06,719 reference and here you'll be able to 1631 01:10:06,719 --> 01:10:09,040 give it a shot we'll be using no JS to 1632 01:10:09,040 --> 01:10:11,199 make the calls and you'll have to get 1633 01:10:11,199 --> 01:10:13,760 your API key it'll ask you to log into 1634 01:10:13,760 --> 01:10:16,120 your account or to create it if you 1635 01:10:16,120 --> 01:10:17,960 haven't before so feel free to create 1636 01:10:17,960 --> 01:10:20,600 your account as it is completely free 1637 01:10:20,600 --> 01:10:22,040 you don't have to worry about paying 1638 01:10:22,040 --> 01:10:23,800 anything and you'll get access to all 1639 01:10:23,800 --> 01:10:26,159 the data once you log in you'll be able 1640 01:10:26,159 --> 01:10:28,000 to see something like this which is your 1641 01:10:28,000 --> 01:10:30,000 account and then head back over to the 1642 01:10:30,000 --> 01:10:32,400 getting started guide and click the link 1643 01:10:32,400 --> 01:10:34,880 that says API link there we go here 1644 01:10:34,880 --> 01:10:37,520 you'll have your API read access token 1645 01:10:37,520 --> 01:10:39,880 so copy it and save it somewhere and do 1646 01:10:39,880 --> 01:10:41,960 the same thing for the API key head over 1647 01:10:41,960 --> 01:10:43,840 into the API reference and if you're 1648 01:10:43,840 --> 01:10:45,600 logged in you'll see that all of the 1649 01:10:45,600 --> 01:10:47,880 credentials will be filled in alongside 1650 01:10:47,880 --> 01:10:50,040 a demo request that you can try in this 1651 01:10:50,040 --> 01:10:51,280 case they're making a request to the 1652 01:10:51,280 --> 01:10:53,840 authentication so if I click try it you 1653 01:10:53,840 --> 01:10:56,360 can see that it succeeded in this case 1654 01:10:56,360 --> 01:10:58,320 we'll be using the endpoint for 1655 01:10:58,320 --> 01:11:01,080 discovering movies so search for 1656 01:11:01,080 --> 01:11:03,600 discover movie and you'll quickly be 1657 01:11:03,600 --> 01:11:06,760 able to find that movies is deprecated 1658 01:11:06,760 --> 01:11:09,320 but you should use discover movie 1659 01:11:09,320 --> 01:11:11,520 instead and it tells you right here 1660 01:11:11,520 --> 01:11:13,560 which API request you have to call find 1661 01:11:13,560 --> 01:11:15,880 movies using over 30 filters and sort 1662 01:11:15,880 --> 01:11:18,120 options and it tells you right here what 1663 01:11:18,120 --> 01:11:20,480 you can pass over into it we can also 1664 01:11:20,480 --> 01:11:22,760 give it a shot by clicking try it and 1665 01:11:22,760 --> 01:11:24,640 then you get back the total number of 1666 01:11:24,640 --> 01:11:26,440 pages which is 1667 01:11:26,440 --> 01:11:31,120 49,000 pages that has almost 1 million 1668 01:11:31,120 --> 01:11:33,560 movies and here of course you get more 1669 01:11:33,560 --> 01:11:36,280 details for every single one out of 1670 01:11:36,280 --> 01:11:39,920 those almost 1 million movies how cool 1671 01:11:39,920 --> 01:11:42,719 is that now let's actually try to call 1672 01:11:42,719 --> 01:11:44,679 this within our code let's go ahead and 1673 01:11:44,679 --> 01:11:47,440 copy this entire fetch request by 1674 01:11:47,440 --> 01:11:49,280 selecting it and then pressing control 1675 01:11:49,280 --> 01:11:51,440 or command C and then heading back 1676 01:11:51,440 --> 01:11:53,120 within our code we'll create a new 1677 01:11:53,120 --> 01:11:55,360 folder that we'll use for the API 1678 01:11:55,360 --> 01:11:57,719 configuration so let's create a new 1679 01:11:57,719 --> 01:12:00,400 folder let's call it 1680 01:12:00,400 --> 01:12:02,840 services and within Services let's 1681 01:12:02,840 --> 01:12:06,920 create a new file called api. TS within 1682 01:12:06,920 --> 01:12:08,960 it for now you can paste this request 1683 01:12:08,960 --> 01:12:12,080 that we just copied but comment it out 1684 01:12:12,080 --> 01:12:14,120 we first want to set it up from scratch 1685 01:12:14,120 --> 01:12:16,679 so it's fully reusable and more 1686 01:12:16,679 --> 01:12:18,480 structured first things first we need to 1687 01:12:18,480 --> 01:12:21,159 extract this key that was given to you 1688 01:12:21,159 --> 01:12:22,960 so if you head back to your credentials 1689 01:12:22,960 --> 01:12:25,960 header select it and copy it you can now 1690 01:12:25,960 --> 01:12:28,719 store it in a more convenient place such 1691 01:12:28,719 --> 01:12:32,239 as a EnV file this stands for 1692 01:12:32,239 --> 01:12:34,480 environment variables and make sure that 1693 01:12:34,480 --> 01:12:36,560 it is in the root of your directory I'll 1694 01:12:36,560 --> 01:12:40,199 call it Expo coru if you're going to use 1695 01:12:40,199 --> 01:12:41,800 it on the front and side of your Expo 1696 01:12:41,800 --> 01:12:44,159 application you have to preen the name 1697 01:12:44,159 --> 01:12:46,440 of your environment variable with Expo 1698 01:12:46,440 --> 01:12:50,239 public and then say movie API key and 1699 01:12:50,239 --> 01:12:52,840 paste your environment key now we won't 1700 01:12:52,840 --> 01:12:54,400 have to every time spell it out within 1701 01:12:54,400 --> 01:12:56,560 our code for every body to see but we'll 1702 01:12:56,560 --> 01:12:58,920 be able to just refer to this variable 1703 01:12:58,920 --> 01:13:00,840 so instead of just making one single 1704 01:13:00,840 --> 01:13:03,760 request let's actually form a tmdb 1705 01:13:03,760 --> 01:13:06,480 configuration that is reusable so we can 1706 01:13:06,480 --> 01:13:08,719 actually change the way we interact with 1707 01:13:08,719 --> 01:13:10,960 it we can call it for multiple different 1708 01:13:10,960 --> 01:13:14,280 endpoints to do that you can export 1709 01:13:14,280 --> 01:13:16,199 const 1710 01:13:16,199 --> 01:13:19,840 tmdb config and it'll be equal to a 1711 01:13:19,840 --> 01:13:23,239 single object within the object we can 1712 01:13:23,239 --> 01:13:27,320 first pass the base URL like this and 1713 01:13:27,320 --> 01:13:29,880 the base URL will be this starting part 1714 01:13:29,880 --> 01:13:31,639 up to the part where the endpoint will 1715 01:13:31,639 --> 01:13:33,880 actually change so sometimes it'll be 1716 01:13:33,880 --> 01:13:36,400 discover movie sometimes it'll be my 1717 01:13:36,400 --> 01:13:39,360 profile for example but there's always a 1718 01:13:39,360 --> 01:13:44,400 base URL that each API has so https 1719 01:13:44,400 --> 01:13:48,520 Colin api. theme.org 1720 01:13:48,520 --> 01:13:51,920 sl3 and leave out the last forward slash 1721 01:13:51,920 --> 01:13:54,080 we don't need it here next we have to 1722 01:13:54,080 --> 01:13:57,360 pass the API iore key which will be 1723 01:13:57,360 --> 01:14:01,520 equal to process. env. EXO 1724 01:14:01,520 --> 01:14:06,040 undoru moviecore API undor key this is 1725 01:14:06,040 --> 01:14:08,120 coming from our environment variables 1726 01:14:08,120 --> 01:14:10,040 next we can pass the headers that we're 1727 01:14:10,040 --> 01:14:12,719 making with the request where we're 1728 01:14:12,719 --> 01:14:15,000 going to pass the accept property to let 1729 01:14:15,000 --> 01:14:17,159 it know what kind of data should it 1730 01:14:17,159 --> 01:14:19,280 accept and this will be equal to 1731 01:14:19,280 --> 01:14:21,960 application Json and also we have to 1732 01:14:21,960 --> 01:14:24,440 pass the authorization header which is 1733 01:14:24,440 --> 01:14:28,080 equal to a template string of Bearer and 1734 01:14:28,080 --> 01:14:30,440 then you once again render the process. 1735 01:14:30,440 --> 01:14:34,320 env. Expo public movie API key we're not 1736 01:14:34,320 --> 01:14:36,840 spelling it out like this perfect so 1737 01:14:36,840 --> 01:14:38,920 with that we have basically utilized 1738 01:14:38,920 --> 01:14:40,800 this entire part and the only thing that 1739 01:14:40,800 --> 01:14:43,400 remains to be changed is the URL that 1740 01:14:43,400 --> 01:14:45,840 we're calling so in this case you can 1741 01:14:45,840 --> 01:14:48,440 see we're looking for forward slcover 1742 01:14:48,440 --> 01:14:50,679 for/ movie but now that we have this 1743 01:14:50,679 --> 01:14:52,800 configuration object it'll be super 1744 01:14:52,800 --> 01:14:55,080 simple to create a function that just 1745 01:14:55,080 --> 01:14:58,520 call one endpoint let me show you export 1746 01:14:58,520 --> 01:15:01,800 const fetch movies is equal to an 1747 01:15:01,800 --> 01:15:04,280 asynchronous function that will accept a 1748 01:15:04,280 --> 01:15:07,239 search query and we can open up a code 1749 01:15:07,239 --> 01:15:10,239 block now for this query we also have to 1750 01:15:10,239 --> 01:15:12,159 pass the type and we can say that the 1751 01:15:12,159 --> 01:15:14,800 query is of a type string it'll look 1752 01:15:14,800 --> 01:15:16,719 something like this next we have to 1753 01:15:16,719 --> 01:15:18,719 define the endpoint that we're calling 1754 01:15:18,719 --> 01:15:22,360 so I'll say con endpoint is equal to 1755 01:15:22,360 --> 01:15:26,840 slash discover slovie question mark sort 1756 01:15:26,840 --> 01:15:29,800 by popularity descending so this will 1757 01:15:29,800 --> 01:15:32,239 give us the most popular movies then we 1758 01:15:32,239 --> 01:15:33,920 have to get the response out of that 1759 01:15:33,920 --> 01:15:36,639 call by saying const response is equal 1760 01:15:36,639 --> 01:15:38,120 to 1761 01:15:38,120 --> 01:15:41,440 await fetch we're going to fetch a 1762 01:15:41,440 --> 01:15:43,679 specific endpoint with the following 1763 01:15:43,679 --> 01:15:47,360 options I'll pass the method of get so 1764 01:15:47,360 --> 01:15:50,159 we want to make a get call and I will 1765 01:15:50,159 --> 01:15:53,639 also assign the headers to be equal to 1766 01:15:53,639 --> 01:15:57,440 tmdb config do headers finally we'll 1767 01:15:57,440 --> 01:16:02,360 check if the response is not okay so if 1768 01:16:02,360 --> 01:16:05,800 not response okay then throw new error 1769 01:16:05,800 --> 01:16:08,159 failed to fetch movies and we can also 1770 01:16:08,159 --> 01:16:11,120 consol log the response. status text to 1771 01:16:11,120 --> 01:16:13,440 see exactly what went wrong I'll 1772 01:16:13,440 --> 01:16:15,480 suppress this TS warning right now 1773 01:16:15,480 --> 01:16:17,320 because I assume there will be a 1774 01:16:17,320 --> 01:16:19,440 response. status text that might give us 1775 01:16:19,440 --> 01:16:21,920 more info and then if everything is okay 1776 01:16:21,920 --> 01:16:23,560 we can extract the data from the 1777 01:16:23,560 --> 01:16:26,239 response by saying respon data is equal 1778 01:16:26,239 --> 01:16:30,120 to await response. Json and finally we 1779 01:16:30,120 --> 01:16:31,719 just want to return the 1780 01:16:31,719 --> 01:16:34,480 data. results which contains the actual 1781 01:16:34,480 --> 01:16:37,040 movies out from this function and this 1782 01:16:37,040 --> 01:16:39,280 would be great I mean this works 1783 01:16:39,280 --> 01:16:41,159 amazingly well for just fetching the 1784 01:16:41,159 --> 01:16:43,880 most popular movies you could say fetch 1785 01:16:43,880 --> 01:16:45,840 popular movies and you would be good to 1786 01:16:45,840 --> 01:16:48,000 go with this function but I want to 1787 01:16:48,000 --> 01:16:50,320 teach you how to make it more modular 1788 01:16:50,320 --> 01:16:52,320 how to make it work both for fetching 1789 01:16:52,320 --> 01:16:55,239 the popular movies as well as to work 1790 01:16:55,239 --> 01:16:57,639 for fetching the movies that we search 1791 01:16:57,639 --> 01:17:00,199 for so if a user heads over and clicks 1792 01:17:00,199 --> 01:17:01,880 search right here we actually want to 1793 01:17:01,880 --> 01:17:04,120 use the same function not create a 1794 01:17:04,120 --> 01:17:06,239 duplicate one that'll fetch the movies 1795 01:17:06,239 --> 01:17:08,600 based on the user's search query so what 1796 01:17:08,600 --> 01:17:11,719 you can do is say that the endpoint is 1797 01:17:11,719 --> 01:17:16,239 equal to and then if there is a query so 1798 01:17:16,239 --> 01:17:20,120 if query exists then we can change the 1799 01:17:20,120 --> 01:17:25,000 endpoint to be equal to/ search slov 1800 01:17:25,000 --> 01:17:28,360 question mark query is equal to and now 1801 01:17:28,360 --> 01:17:30,800 here we can pass over the query like 1802 01:17:30,800 --> 01:17:33,880 this but whenever you pass plain strings 1803 01:17:33,880 --> 01:17:36,840 into a URL it is always better to encode 1804 01:17:36,840 --> 01:17:38,239 them just to make sure that we don't 1805 01:17:38,239 --> 01:17:39,800 have any weird characters that the 1806 01:17:39,800 --> 01:17:42,520 browser might not be able to process so 1807 01:17:42,520 --> 01:17:45,880 you can write in code URI component and 1808 01:17:45,880 --> 01:17:49,320 then pass the query into it this way 1809 01:17:49,320 --> 01:17:51,679 we'll be sure that everything is good 1810 01:17:51,679 --> 01:17:53,560 and then if we don't have the query 1811 01:17:53,560 --> 01:17:55,880 simply search for the the latest movies 1812 01:17:55,880 --> 01:17:57,440 now the final thing we need to do to 1813 01:17:57,440 --> 01:17:59,639 make this work is also make the bottom 1814 01:17:59,639 --> 01:18:02,840 one a template string why because for 1815 01:18:02,840 --> 01:18:05,120 both of these we actually want to add 1816 01:18:05,120 --> 01:18:06,040 the 1817 01:18:06,040 --> 01:18:10,320 tmdb config dobas URL at the start of 1818 01:18:10,320 --> 01:18:13,320 them so everything starts with this base 1819 01:18:13,320 --> 01:18:15,840 URL and then we're changing the exact 1820 01:18:15,840 --> 01:18:17,960 endpoint depending on whether we have 1821 01:18:17,960 --> 01:18:21,480 the query and if so we pass it or if not 1822 01:18:21,480 --> 01:18:24,040 give me all the most popular movies I 1823 01:18:24,040 --> 01:18:25,679 think you can now understand a bit more 1824 01:18:25,679 --> 01:18:28,000 detail of what I meant when I said that 1825 01:18:28,000 --> 01:18:29,960 we're going to make this reusable and 1826 01:18:29,960 --> 01:18:31,639 just better configured and it makes 1827 01:18:31,639 --> 01:18:33,880 sense because the endpoint is different 1828 01:18:33,880 --> 01:18:36,080 but the actual data we turning from the 1829 01:18:36,080 --> 01:18:38,920 function is still the same they are 1830 01:18:38,920 --> 01:18:41,280 movies so with that in mind you have 1831 01:18:41,280 --> 01:18:44,360 successfully created an account on tmtb 1832 01:18:44,360 --> 01:18:47,880 you extracted your own API key for free 1833 01:18:47,880 --> 01:18:50,199 and you made a function that fetches the 1834 01:18:50,199 --> 01:18:52,920 movies either the most popular ones or 1835 01:18:52,920 --> 01:18:54,880 the ones that match the user's query 1836 01:18:54,880 --> 01:18:57,280 very soon we'll put it to use but just 1837 01:18:57,280 --> 01:18:59,560 before that in the next lesson I'll show 1838 01:18:59,560 --> 01:19:01,199 you one more optimization that we can 1839 01:19:01,199 --> 01:19:03,159 make to use the fetch movies functions 1840 01:19:03,159 --> 01:19:06,560 we created in a more optimized 1841 01:19:06,560 --> 01:19:08,960 way in the previous lesson we 1842 01:19:08,960 --> 01:19:12,480 implemented this fetch movies function 1843 01:19:12,480 --> 01:19:14,960 but before diving into using it which 1844 01:19:14,960 --> 01:19:18,000 involves API calls using the use effect 1845 01:19:18,000 --> 01:19:21,040 hook managing loading and error States 1846 01:19:21,040 --> 01:19:23,040 and potentially clattering our code with 1847 01:19:23,040 --> 01:19:25,560 repetitive logic there's a more 1848 01:19:25,560 --> 01:19:28,080 efficient approach instead of repeating 1849 01:19:28,080 --> 01:19:30,600 the same code for every request we can 1850 01:19:30,600 --> 01:19:33,000 improve this process by using something 1851 01:19:33,000 --> 01:19:36,080 known as a custom hook this hook will 1852 01:19:36,080 --> 01:19:38,440 handle fetching the data in a clean 1853 01:19:38,440 --> 01:19:41,280 reusable and scalable way so let's 1854 01:19:41,280 --> 01:19:43,400 create a new file within the services 1855 01:19:43,400 --> 01:19:48,760 folder and let's call it use fetch. TS 1856 01:19:48,760 --> 01:19:50,840 and we can develop that custom hook this 1857 01:19:50,840 --> 01:19:52,920 hook will allow us to handle API 1858 01:19:52,920 --> 01:19:55,000 requests without cluttering the 1859 01:19:55,000 --> 01:19:58,159 components by abstracting away the logic 1860 01:19:58,159 --> 01:20:00,440 for fetching the data managing loading 1861 01:20:00,440 --> 01:20:02,880 and error States and it'll even provide 1862 01:20:02,880 --> 01:20:05,120 us with a way to manually trigger a 1863 01:20:05,120 --> 01:20:07,400 refetch when needed let me show you how 1864 01:20:07,400 --> 01:20:10,440 it'll look like we can say const use 1865 01:20:10,440 --> 01:20:13,159 fetch again notice the keyword use 1866 01:20:13,159 --> 01:20:15,320 indicating that it is a hook and we can 1867 01:20:15,320 --> 01:20:18,480 make it equal to a function call and we 1868 01:20:18,480 --> 01:20:20,360 can make it equal to an arrow 1869 01:20:20,360 --> 01:20:23,320 function now bear with me for a second 1870 01:20:23,320 --> 01:20:27,239 the use fetch hook will accept the fetch 1871 01:20:27,239 --> 01:20:31,800 function as a parameter okay so what can 1872 01:20:31,800 --> 01:20:34,159 this fetch function be well it can be 1873 01:20:34,159 --> 01:20:36,639 like fetch movies or it can be something 1874 01:20:36,639 --> 01:20:40,000 else maybe like fetch movie details 1875 01:20:40,000 --> 01:20:41,080 whatever it 1876 01:20:41,080 --> 01:20:43,800 is we're going to pass it into this use 1877 01:20:43,800 --> 01:20:46,080 fetch call so it'll look something like 1878 01:20:46,080 --> 01:20:49,360 this use fetch fetch movies we 1879 01:20:49,360 --> 01:20:51,080 immediately have to let it know that the 1880 01:20:51,080 --> 01:20:53,040 first parameter will be that fetch 1881 01:20:53,040 --> 01:20:56,280 function and we need to Define its type 1882 01:20:56,280 --> 01:21:00,080 and the type will be a function that 1883 01:21:00,080 --> 01:21:03,679 returns a promise and the promise will 1884 01:21:03,679 --> 01:21:08,080 be of a generic type t t makes it a 1885 01:21:08,080 --> 01:21:10,760 generic function allowing us to later on 1886 01:21:10,760 --> 01:21:13,120 pass the specific data types that we 1887 01:21:13,120 --> 01:21:15,360 want the function return to be it'll all 1888 01:21:15,360 --> 01:21:17,480 make sense once we start using it we 1889 01:21:17,480 --> 01:21:19,440 also have to add this generic T 1890 01:21:19,440 --> 01:21:21,320 parameter here and as the second 1891 01:21:21,320 --> 01:21:23,920 parameter we'll pass the autof Fetch and 1892 01:21:23,920 --> 01:21:25,800 make it equal to the true if you don't 1893 01:21:25,800 --> 01:21:27,560 understand what this means specifically 1894 01:21:27,560 --> 01:21:30,679 This Promise generic parameter T again 1895 01:21:30,679 --> 01:21:32,560 don't worry about it I'll explain it in 1896 01:21:32,560 --> 01:21:34,800 more detail once we actually start using 1897 01:21:34,800 --> 01:21:37,440 this function great with that said this 1898 01:21:37,440 --> 01:21:39,280 use fetch function will have to work 1899 01:21:39,280 --> 01:21:41,440 with some kind of data so we can create 1900 01:21:41,440 --> 01:21:45,920 a new state called data and set data 1901 01:21:45,920 --> 01:21:48,320 which will be equal to the use State 1902 01:21:48,320 --> 01:21:52,880 hook and it'll be of a type t or null 1903 01:21:52,880 --> 01:21:55,920 you define it right here before we open 1904 01:21:55,920 --> 01:21:58,880 the function call of this function and 1905 01:21:58,880 --> 01:22:02,040 by default we'll set it to null next we 1906 01:22:02,040 --> 01:22:03,960 need to define the loading and set 1907 01:22:03,960 --> 01:22:07,639 loading at the start equal to false and 1908 01:22:07,639 --> 01:22:11,239 also the errors const error set error is 1909 01:22:11,239 --> 01:22:13,800 equal to the use state where the type of 1910 01:22:13,800 --> 01:22:16,760 that state is either an error or a null 1911 01:22:16,760 --> 01:22:17,560 by 1912 01:22:17,560 --> 01:22:19,800 default now that we have implemented 1913 01:22:19,800 --> 01:22:22,000 those different states let's create a 1914 01:22:22,000 --> 01:22:25,239 function const fetch data which will be 1915 01:22:25,239 --> 01:22:28,320 equal to an asynchronous function within 1916 01:22:28,320 --> 01:22:32,360 which we can open up a try and catch 1917 01:22:32,360 --> 01:22:35,040 Block in the catch we'll of course get 1918 01:22:35,040 --> 01:22:37,719 the access to the error I'll shorten it 1919 01:22:37,719 --> 01:22:41,639 for err and within it we can set 1920 01:22:41,639 --> 01:22:47,239 error if an error is an instance of 1921 01:22:47,239 --> 01:22:50,360 error then I'll just forward the entire 1922 01:22:50,360 --> 01:22:53,840 error else I'll just create a new error 1923 01:22:53,840 --> 01:22:57,480 and pass in a string of an error 1924 01:22:57,480 --> 01:22:59,880 occurred and also press the typescript 1925 01:22:59,880 --> 01:23:02,239 right here for this line by saying TS 1926 01:23:02,239 --> 01:23:04,880 ignore then we're going to also add a 1927 01:23:04,880 --> 01:23:07,480 finally Clause finally block of code 1928 01:23:07,480 --> 01:23:10,920 gets executed either when a try succeeds 1929 01:23:10,920 --> 01:23:13,760 or a catch finishes either way we want 1930 01:23:13,760 --> 01:23:16,440 to set loading to false but now what we 1931 01:23:16,440 --> 01:23:18,560 care about the most is dealing with the 1932 01:23:18,560 --> 01:23:20,760 tri block which means actually fetching 1933 01:23:20,760 --> 01:23:23,480 the data first we're going to set 1934 01:23:23,480 --> 01:23:26,520 loading to true because we want to start 1935 01:23:26,520 --> 01:23:29,440 the loading action we're going to also 1936 01:23:29,440 --> 01:23:33,159 reset the error to false or rather null 1937 01:23:33,159 --> 01:23:37,000 there is no error and then we can say 1938 01:23:37,000 --> 01:23:43,120 const result is equal to await fetch 1939 01:23:43,120 --> 01:23:45,400 function so keep in mind that this fetch 1940 01:23:45,400 --> 01:23:48,280 function is not yet declared the fetch 1941 01:23:48,280 --> 01:23:50,880 function will be passed through props 1942 01:23:50,880 --> 01:23:52,920 and it can be either the fetch movies 1943 01:23:52,920 --> 01:23:54,800 function which we created not not long 1944 01:23:54,800 --> 01:23:57,280 ago or maybe another function which will 1945 01:23:57,280 --> 01:23:59,320 create in the future like fetch movie 1946 01:23:59,320 --> 01:24:01,840 details or maybe another function which 1947 01:24:01,840 --> 01:24:04,440 will create soon in any case the 1948 01:24:04,440 --> 01:24:06,840 function we want to call will be passed 1949 01:24:06,840 --> 01:24:08,560 through as the first parameter to the 1950 01:24:08,560 --> 01:24:10,520 use fetch hook and then we'll call it 1951 01:24:10,520 --> 01:24:13,400 right here get the results and simply 1952 01:24:13,400 --> 01:24:16,239 set them to the data so set data is 1953 01:24:16,239 --> 01:24:19,960 equal to result also below this entire 1954 01:24:19,960 --> 01:24:22,560 fetch data function we can also have a 1955 01:24:22,560 --> 01:24:25,040 reset function so con 1956 01:24:25,040 --> 01:24:28,760 reset is equal to an error function 1957 01:24:28,760 --> 01:24:30,920 where we set the data to null set the 1958 01:24:30,920 --> 01:24:32,920 loading to false and set the error to 1959 01:24:32,920 --> 01:24:35,560 now as well finally I'll also create a 1960 01:24:35,560 --> 01:24:38,800 use effect hook and a use effect Hook is 1961 01:24:38,800 --> 01:24:40,679 called when you want to do something at 1962 01:24:40,679 --> 01:24:43,719 the start of your component load so in 1963 01:24:43,719 --> 01:24:46,679 this case as soon as the component loads 1964 01:24:46,679 --> 01:24:49,239 we want to check if autof fetch is 1965 01:24:49,239 --> 01:24:51,960 turned on that means that we want to 1966 01:24:51,960 --> 01:24:53,600 automatically fetch the data in that 1967 01:24:53,600 --> 01:24:55,800 case so if if autof fetch is true we'll 1968 01:24:55,800 --> 01:24:57,719 simply call the fetch data 1969 01:24:57,719 --> 01:25:00,719 function finally hooks have to return 1970 01:25:00,719 --> 01:25:03,280 something so I'll return almost 1971 01:25:03,280 --> 01:25:05,840 everything the data State the loading 1972 01:25:05,840 --> 01:25:08,880 State the error State the refetch 1973 01:25:08,880 --> 01:25:11,960 function which I'll call fetch data as 1974 01:25:11,960 --> 01:25:14,639 well as the reset function so later on 1975 01:25:14,639 --> 01:25:17,000 when we use this hook it is dealing with 1976 01:25:17,000 --> 01:25:19,320 everything data related fetching 1977 01:25:19,320 --> 01:25:22,080 loadings errors and finally the data 1978 01:25:22,080 --> 01:25:25,400 that it's returning so let's say export 1979 01:25:25,400 --> 01:25:28,280 default use fetch so that in the next 1980 01:25:28,280 --> 01:25:31,239 lesson we can use the use fetch hook as 1981 01:25:31,239 --> 01:25:33,679 well as use the fetch movies function 1982 01:25:33,679 --> 01:25:36,320 merge them together to be able to fetch 1983 01:25:36,320 --> 01:25:39,040 and display 1984 01:25:39,040 --> 01:25:42,280 movies and we are finally ready to fetch 1985 01:25:42,280 --> 01:25:45,080 and display the movie data to do that 1986 01:25:45,080 --> 01:25:48,560 let's head over into our homepage app 1987 01:25:48,560 --> 01:25:52,040 tabs index. TSX fetching the data now 1988 01:25:52,040 --> 01:25:54,360 should be super simple since we have 1989 01:25:54,360 --> 01:25:56,239 already done all the hard work of 1990 01:25:56,239 --> 01:25:58,600 actually implementing scalable reusable 1991 01:25:58,600 --> 01:26:00,840 fetching functions that contain all of 1992 01:26:00,840 --> 01:26:03,159 the necessary data fetching logic let me 1993 01:26:03,159 --> 01:26:05,320 show you what I mean instead of handling 1994 01:26:05,320 --> 01:26:08,080 all the states and everything right here 1995 01:26:08,080 --> 01:26:11,600 now we can do just a single thing const 1996 01:26:11,600 --> 01:26:14,000 destructure the data that we're going to 1997 01:26:14,000 --> 01:26:16,560 fetch rename it to 1998 01:26:16,560 --> 01:26:19,840 movies and make it equal to the call of 1999 01:26:19,840 --> 01:26:22,920 the use fetch hook coming from services 2000 01:26:22,920 --> 01:26:25,320 use fetch to it we have to pass a 2001 01:26:25,320 --> 01:26:29,320 callback function in this case fetch 2002 01:26:29,320 --> 01:26:31,400 movies which is another one of our 2003 01:26:31,400 --> 01:26:34,280 functions we created and to it we can 2004 01:26:34,280 --> 01:26:37,040 pass a query which by default will be 2005 01:26:37,040 --> 01:26:39,719 set to an empty string let me actually 2006 01:26:39,719 --> 01:26:41,360 put this into multiple lines so you can 2007 01:26:41,360 --> 01:26:44,080 better see what's happening there we go 2008 01:26:44,080 --> 01:26:47,159 so we're calling the use fetch hook and 2009 01:26:47,159 --> 01:26:50,119 to it we're passing a callback function 2010 01:26:50,119 --> 01:26:53,119 called Fetch movies to which we pass the 2011 01:26:53,119 --> 01:26:56,040 query this this query right now is empty 2012 01:26:56,040 --> 01:26:58,280 but later on once we Implement search or 2013 01:26:58,280 --> 01:27:00,080 once we navigate to the search page we 2014 01:27:00,080 --> 01:27:02,320 can fill in the query data but it 2015 01:27:02,320 --> 01:27:04,040 doesn't matter if it's empty right now 2016 01:27:04,040 --> 01:27:06,119 because you know what happens fetch 2017 01:27:06,119 --> 01:27:08,960 movies if a query doesn't exist Returns 2018 01:27:08,960 --> 01:27:11,920 the most popular movies so we're still 2019 01:27:11,920 --> 01:27:15,679 good now alongside the movies themselves 2020 01:27:15,679 --> 01:27:17,880 back from the use fetch hook we're also 2021 01:27:17,880 --> 01:27:20,400 getting the loading which I can rename 2022 01:27:20,400 --> 01:27:23,520 to movies loading and we're also getting 2023 01:27:23,520 --> 01:27:26,080 back the error state which I can rename 2024 01:27:26,080 --> 01:27:29,199 to movies error and just so it's easier 2025 01:27:29,199 --> 01:27:31,239 to read it I'll put it into multiple 2026 01:27:31,239 --> 01:27:33,719 lines and there we go all the data we 2027 01:27:33,719 --> 01:27:36,080 need nicely contained within a single 2028 01:27:36,080 --> 01:27:39,560 call so let's put it to use right below 2029 01:27:39,560 --> 01:27:42,080 the icons logo we can check whether 2030 01:27:42,080 --> 01:27:44,639 we're currently loading the movies so if 2031 01:27:44,639 --> 01:27:48,239 movies loading in that case we can show 2032 01:27:48,239 --> 01:27:49,239 an 2033 01:27:49,239 --> 01:27:52,360 activity indicator built right into 2034 01:27:52,360 --> 01:27:54,880 react native it is a self- closing 2035 01:27:54,880 --> 01:27:56,920 component for which you can Define the 2036 01:27:56,920 --> 01:28:00,119 size in this case I'll make it large the 2037 01:28:00,119 --> 01:28:02,560 color which I'll set to Hash 2038 01:28:02,560 --> 01:28:06,280 0 FF and you can also Define the class 2039 01:28:06,280 --> 01:28:09,320 name which I'll set to margin top of 10 2040 01:28:09,320 --> 01:28:13,080 and self Center but if we're not loading 2041 01:28:13,080 --> 01:28:16,080 the movies then maybe there's an error 2042 01:28:16,080 --> 01:28:19,440 so let's check if movies errors exist 2043 01:28:19,440 --> 01:28:22,480 then we will render a piece of text 2044 01:28:22,480 --> 01:28:24,760 that'll say something like 2045 01:28:24,760 --> 01:28:26,800 error is equal 2046 01:28:26,800 --> 01:28:31,280 to movies error question mark. 2047 01:28:31,280 --> 01:28:34,679 message and finally if we're not loading 2048 01:28:34,679 --> 01:28:37,600 and we don't have an error we can return 2049 01:28:37,600 --> 01:28:40,080 a view within which we'll have the 2050 01:28:40,080 --> 01:28:42,239 search bar and the rest of the content 2051 01:28:42,239 --> 01:28:44,360 so basically I can just copy this view 2052 01:28:44,360 --> 01:28:47,119 that we had before and put it right here 2053 01:28:47,119 --> 01:28:49,840 instead of this view that I created next 2054 01:28:49,840 --> 01:28:51,840 below the search bar we can create an 2055 01:28:51,840 --> 01:28:54,800 empty react fragment and within it we 2056 01:28:54,800 --> 01:28:58,199 can display a piece of text that'll say 2057 01:28:58,199 --> 01:29:01,760 something like latest movies to be able 2058 01:29:01,760 --> 01:29:04,159 to see that text let's give it a class 2059 01:29:04,159 --> 01:29:10,719 name of text- LG text- white font Das 2060 01:29:10,719 --> 01:29:14,360 bold margin top of five and margin 2061 01:29:14,360 --> 01:29:17,040 bottom of three and I'll try to reload 2062 01:29:17,040 --> 01:29:18,719 the application just to see whether the 2063 01:29:18,719 --> 01:29:20,719 changes happen there we go you can see 2064 01:29:20,719 --> 01:29:22,679 the latest movies right there sometimes 2065 01:29:22,679 --> 01:29:24,719 you have to manually restart it now get 2066 01:29:24,719 --> 01:29:27,239 ready to use one of the most important 2067 01:29:27,239 --> 01:29:31,400 react native components called a flat 2068 01:29:31,400 --> 01:29:34,639 list imported from react native and let 2069 01:29:34,639 --> 01:29:37,080 me show you how it works a pretty cool 2070 01:29:37,080 --> 01:29:39,400 thing about the flat list is is that it 2071 01:29:39,400 --> 01:29:42,480 accepts a lot of props so for it to work 2072 01:29:42,480 --> 01:29:44,840 you don't have to customize it that much 2073 01:29:44,840 --> 01:29:47,119 outside of figuring out which props to 2074 01:29:47,119 --> 01:29:49,560 provide first of all we have to provide 2075 01:29:49,560 --> 01:29:52,400 the data prop that will simply be equal 2076 01:29:52,400 --> 01:29:54,480 to movies that's the data data we 2077 01:29:54,480 --> 01:29:57,080 rendering and then we have to tell it 2078 01:29:57,080 --> 01:29:59,880 how it will render each item each one of 2079 01:29:59,880 --> 01:30:02,719 these movies first we can destructure 2080 01:30:02,719 --> 01:30:05,159 that item which is a movie itself and 2081 01:30:05,159 --> 01:30:07,280 then for each item we can have an 2082 01:30:07,280 --> 01:30:09,440 immediate return what does an immediate 2083 01:30:09,440 --> 01:30:11,520 return mean well it means that we're not 2084 01:30:11,520 --> 01:30:13,639 opening up a function block here with 2085 01:30:13,639 --> 01:30:16,080 curly braces instead we're opening it 2086 01:30:16,080 --> 01:30:18,320 with parenthesis so whatever we put in 2087 01:30:18,320 --> 01:30:22,040 here such as maybe a text element means 2088 01:30:22,040 --> 01:30:24,520 that we will automatically return it so 2089 01:30:24,520 --> 01:30:26,679 for each movie Let's automatically 2090 01:30:26,679 --> 01:30:30,199 render an item. tile and give it a class 2091 01:30:30,199 --> 01:30:35,199 name of text- white as well as text- smm 2092 01:30:35,199 --> 01:30:37,960 so take a look at that we get back a 2093 01:30:37,960 --> 01:30:40,560 list of 20 most popular movies at the 2094 01:30:40,560 --> 01:30:42,560 time of the recording pretty cool right 2095 01:30:42,560 --> 01:30:43,960 another thing we have to pass into the 2096 01:30:43,960 --> 01:30:46,480 flat list is the key 2097 01:30:46,480 --> 01:30:48,679 extractor which simply helps react 2098 01:30:48,679 --> 01:30:50,480 native figure out how many elements they 2099 01:30:50,480 --> 01:30:53,360 are and where they're positioned so same 2100 01:30:53,360 --> 01:30:56,400 as before we get access to the item and 2101 01:30:56,400 --> 01:30:58,880 we simply want to take the ID of each 2102 01:30:58,880 --> 01:30:59,920 one of these 2103 01:30:59,920 --> 01:31:02,639 movies next we can Define the number of 2104 01:31:02,639 --> 01:31:04,719 columns in this case let's make it equal 2105 01:31:04,719 --> 01:31:06,480 to three and then you might need to 2106 01:31:06,480 --> 01:31:08,400 reload for the changes to take effect 2107 01:31:08,400 --> 01:31:09,840 because you cannot change the number of 2108 01:31:09,840 --> 01:31:12,800 columns on the Fly there we go so now 2109 01:31:12,800 --> 01:31:14,000 they're showing in three different 2110 01:31:14,000 --> 01:31:17,119 columns let's also Define a column 2111 01:31:17,119 --> 01:31:20,880 wrapper Style by making it into an 2112 01:31:20,880 --> 01:31:24,480 object and passing a justifi content of 2113 01:31:24,480 --> 01:31:26,199 flex Das 2114 01:31:26,199 --> 01:31:30,119 start gap of 20 in between the elements 2115 01:31:30,119 --> 01:31:36,360 padding of right five margin bottom of 2116 01:31:36,360 --> 01:31:39,400 10 so now if we save this they're going 2117 01:31:39,400 --> 01:31:42,679 to be positioned a bit more nicely and 2118 01:31:42,679 --> 01:31:45,199 we can also pass a general class name to 2119 01:31:45,199 --> 01:31:48,440 the entire flat list as margin top of 2120 01:31:48,440 --> 01:31:51,880 two and padding bottom of 2121 01:31:51,880 --> 01:31:55,480 32 Also let's say scroll enabled is set 2122 01:31:55,480 --> 01:31:58,199 to false as our entire view already 2123 01:31:58,199 --> 01:32:01,880 Scrolls by itself perfect so now we're 2124 01:32:01,880 --> 01:32:04,800 displaying 20 of the most popular movies 2125 01:32:04,800 --> 01:32:06,960 in the world just by passing the movies 2126 01:32:06,960 --> 01:32:10,520 array as data into the flat list pretty 2127 01:32:10,520 --> 01:32:13,159 cool right and I think you can now get 2128 01:32:13,159 --> 01:32:15,520 the idea of what I meant when I said 2129 01:32:15,520 --> 01:32:18,080 that the flat list is super extensible 2130 01:32:18,080 --> 01:32:20,119 and you can modify everything just by 2131 01:32:20,119 --> 01:32:23,080 calling different props data render item 2132 01:32:23,080 --> 01:32:25,760 key extractor num columns whatever we 2133 01:32:25,760 --> 01:32:27,960 needed to present our data nicely in a 2134 01:32:27,960 --> 01:32:30,360 list was already there and provided to 2135 01:32:30,360 --> 01:32:33,600 us through the flatlist component props 2136 01:32:33,600 --> 01:32:35,440 and you'll find this practice pretty 2137 01:32:35,440 --> 01:32:38,119 commonly in react native where the 2138 01:32:38,119 --> 01:32:39,920 pre-built components are super 2139 01:32:39,920 --> 01:32:41,960 extensible you just have to figure out 2140 01:32:41,960 --> 01:32:44,639 which props to pass and how can you know 2141 01:32:44,639 --> 01:32:46,840 well you just Google it which will bring 2142 01:32:46,840 --> 01:32:49,040 you to the documentation page you can 2143 01:32:49,040 --> 01:32:51,360 check out the example and then very 2144 01:32:51,360 --> 01:32:53,520 quickly you'll be able to see a list of 2145 01:32:53,520 --> 01:32:55,679 different props that you can pass to it 2146 01:32:55,679 --> 01:32:58,199 and exactly what each one of these props 2147 01:32:58,199 --> 01:33:00,320 does pretty cool right let me Zoom this 2148 01:33:00,320 --> 01:33:02,199 back in right now and now that we're 2149 01:33:02,199 --> 01:33:04,320 fetching the data properly let's make it 2150 01:33:04,320 --> 01:33:06,719 look a bit more interesting of course 2151 01:33:06,719 --> 01:33:08,480 visuals are what's going to change the 2152 01:33:08,480 --> 01:33:10,960 game right now we are showing just the 2153 01:33:10,960 --> 01:33:13,960 title but what if we could show an image 2154 01:33:13,960 --> 01:33:15,600 for each one of these 2155 01:33:15,600 --> 01:33:17,679 movies just so we don't have to declare 2156 01:33:17,679 --> 01:33:20,480 it in many places we'll create a new 2157 01:33:20,480 --> 01:33:23,360 reusable card component for the movie so 2158 01:33:23,360 --> 01:33:24,880 let's create a new file in the 2159 01:33:24,880 --> 01:33:27,199 components folder and let's call it 2160 01:33:27,199 --> 01:33:33,119 moviec card. TSX run rnfe to quickly 2161 01:33:33,119 --> 01:33:36,159 spin up our movie card component give it 2162 01:33:36,159 --> 01:33:39,960 a class name equal to text- White in 2163 01:33:39,960 --> 01:33:41,320 text 2164 01:33:41,320 --> 01:33:44,920 DSM and let's call it right here instead 2165 01:33:44,920 --> 01:33:47,760 of this simple text element instead of 2166 01:33:47,760 --> 01:33:51,119 that I'll call the movie card and I'll 2167 01:33:51,119 --> 01:33:53,480 self-close it like this now we have a 2168 01:33:53,480 --> 01:33:55,520 simil problem that we had before with 2169 01:33:55,520 --> 01:33:58,440 the tabs layout where each movie card 2170 01:33:58,440 --> 01:34:01,840 now shows exactly the same data so to be 2171 01:34:01,840 --> 01:34:04,119 able to make it different we have to 2172 01:34:04,119 --> 01:34:06,440 pass the right props to it so what does 2173 01:34:06,440 --> 01:34:09,400 it mean in this case well we can simply 2174 01:34:09,400 --> 01:34:12,280 spread out all of the properties of the 2175 01:34:12,280 --> 01:34:15,360 item or of the movie so that way we'll 2176 01:34:15,360 --> 01:34:17,760 be able to extract them directly within 2177 01:34:17,760 --> 01:34:20,920 the movie card so let's head over into 2178 01:34:20,920 --> 01:34:23,440 the movie card and let's accept all of 2179 01:34:23,440 --> 01:34:26,080 the props that we have passed into it 2180 01:34:26,080 --> 01:34:30,920 such as the ID the poster undor path the 2181 01:34:30,920 --> 01:34:32,880 title and where am I getting all of 2182 01:34:32,880 --> 01:34:35,400 these from well remember we already made 2183 01:34:35,400 --> 01:34:39,040 a mock response before and tmdb gave us 2184 01:34:39,040 --> 01:34:41,480 back exactly the data that we're getting 2185 01:34:41,480 --> 01:34:44,080 such as the poster path overview title 2186 01:34:44,080 --> 01:34:44,880 and 2187 01:34:44,880 --> 01:34:49,880 more so let's get it vote uncore average 2188 01:34:49,880 --> 01:34:52,119 as well as the release 2189 01:34:52,119 --> 01:34:56,159 date and these will be of a type movie 2190 01:34:56,159 --> 01:34:57,800 which we declared before under 2191 01:34:57,800 --> 01:35:00,280 interfaces so we already know what each 2192 01:35:00,280 --> 01:35:02,719 movie has now we want to make each one 2193 01:35:02,719 --> 01:35:05,280 of these cards clickable because once we 2194 01:35:05,280 --> 01:35:06,920 click it we want to go to the movie 2195 01:35:06,920 --> 01:35:10,920 Details page so I'll make it into a link 2196 01:35:10,920 --> 01:35:13,159 and this link of course has to be 2197 01:35:13,159 --> 01:35:16,280 imported from Expo router it'll have an 2198 01:35:16,280 --> 01:35:22,520 href of for/ mov slid and as child as 2199 01:35:22,520 --> 01:35:25,000 child simply means that the card that is 2200 01:35:25,000 --> 01:35:26,800 inside of the link will actually be the 2201 01:35:26,800 --> 01:35:29,000 thing that's clickable in this case 2202 01:35:29,000 --> 01:35:31,480 we'll make it a touchable 2203 01:35:31,480 --> 01:35:34,800 opacity so like a card is technically a 2204 01:35:34,800 --> 01:35:36,719 clickable button in this case coming 2205 01:35:36,719 --> 01:35:39,280 from react native we can give it a class 2206 01:35:39,280 --> 01:35:44,280 name equal to w- 30% so each card takes 2207 01:35:44,280 --> 01:35:47,119 only 30% of the screen and within it 2208 01:35:47,119 --> 01:35:50,159 let's first render an image this image 2209 01:35:50,159 --> 01:35:54,400 will have a source equal to an object 2210 01:35:54,400 --> 01:35:58,440 where the URI is we can check if the 2211 01:35:58,440 --> 01:36:02,960 poster path exists if it does then we'll 2212 01:36:02,960 --> 01:36:05,400 set it to be equal to 2213 01:36:05,400 --> 01:36:11,080 https colon SL SL image. 2214 01:36:11,080 --> 01:36:18,040 tmdb org SLT SL 2215 01:36:18,040 --> 01:36:22,400 pw500 and then poster path like this 2216 01:36:22,400 --> 01:36:24,840 else if we don't have a poster path we 2217 01:36:24,840 --> 01:36:27,560 can render just the placeholder so it'll 2218 01:36:27,560 --> 01:36:29,400 be a string of 2219 01:36:29,400 --> 01:36:31,719 https 2220 01:36:31,719 --> 01:36:36,920 col placehold doco SL600 by 2221 01:36:36,920 --> 01:36:45,000 400 SL1 a1a1 a SL 2222 01:36:45,000 --> 01:36:47,239 f.png sorry for spelling out the entire 2223 01:36:47,239 --> 01:36:48,960 URL just thought it would be the 2224 01:36:48,960 --> 01:36:50,639 simplest way to share it with you now 2225 01:36:50,639 --> 01:36:53,080 reload your application and let's also 2226 01:36:53,080 --> 01:36:56,760 give this image a class name of 2227 01:36:56,760 --> 01:36:58,880 w-o 2228 01:36:58,880 --> 01:37:02,600 h-52 and the rounded dlg for the rounded 2229 01:37:02,600 --> 01:37:05,239 Corners we can also give it a resize 2230 01:37:05,239 --> 01:37:08,040 mode equal to cover right below that 2231 01:37:08,040 --> 01:37:10,960 image still within the touchable opacity 2232 01:37:10,960 --> 01:37:13,760 let's also render a piece of text that 2233 01:37:13,760 --> 01:37:16,000 will simply render the movie 2234 01:37:16,000 --> 01:37:19,239 title and we can give it a class name of 2235 01:37:19,239 --> 01:37:24,880 text DSM font D bold text - white and 2236 01:37:24,880 --> 01:37:28,320 margin top of two and there we go once 2237 01:37:28,320 --> 01:37:30,440 again you can see all of these movies 2238 01:37:30,440 --> 01:37:33,320 but hey where is the poster why can't we 2239 01:37:33,320 --> 01:37:36,159 see the images well let's first consol 2240 01:37:36,159 --> 01:37:39,480 log the poster path to see whether we're 2241 01:37:39,480 --> 01:37:42,080 getting back the Pats of those movies so 2242 01:37:42,080 --> 01:37:45,080 the URLs are coming back but hey where 2243 01:37:45,080 --> 01:37:47,960 is the poster why can't we see the 2244 01:37:47,960 --> 01:37:50,040 images well for the image to be 2245 01:37:50,040 --> 01:37:52,880 displayed we need to give it a URL which 2246 01:37:52,880 --> 01:37:54,760 I do believe we're getting as the titles 2247 01:37:54,760 --> 01:37:57,800 are here so the poster should be two but 2248 01:37:57,800 --> 01:38:01,119 images also need a width and a height 2249 01:38:01,119 --> 01:38:03,280 and I thought that I was providing a 2250 01:38:03,280 --> 01:38:08,400 width of 100% and a height of about 208 2251 01:38:08,400 --> 01:38:11,520 pixels so why is it not getting applied 2252 01:38:11,520 --> 01:38:14,040 well if you head over into your Tailwind 2253 01:38:14,040 --> 01:38:17,119 doc config.js you'll see that we're 2254 01:38:17,119 --> 01:38:19,920 saying that only the app folders and 2255 01:38:19,920 --> 01:38:22,040 files will actually include Tailwind 2256 01:38:22,040 --> 01:38:24,440 Styles but we we have to do the same 2257 01:38:24,440 --> 01:38:26,159 thing for the 2258 01:38:26,159 --> 01:38:28,639 components so right here as the second 2259 01:38:28,639 --> 01:38:30,880 part of the content I can add a second 2260 01:38:30,880 --> 01:38:34,760 string and say/ components and then also 2261 01:38:34,760 --> 01:38:37,440 Target all of the components and 2262 01:38:37,440 --> 01:38:40,560 immediately that will allow us to apply 2263 01:38:40,560 --> 01:38:42,560 Tailwind Styles within our components 2264 01:38:42,560 --> 01:38:45,560 folder and immediately the images will 2265 01:38:45,560 --> 01:38:48,880 appear so this is looking absolutely 2266 01:38:48,880 --> 01:38:52,159 amazing and it is so nice to be able to 2267 01:38:52,159 --> 01:38:55,040 scroll with my thumb across all of these 2268 01:38:55,040 --> 01:38:57,320 movies and since we're using touchable 2269 01:38:57,320 --> 01:38:59,480 opacities you can see as I hover over 2270 01:38:59,480 --> 01:39:02,239 them it appears as they are clickable 2271 01:39:02,239 --> 01:39:04,480 all of this is happening natively within 2272 01:39:04,480 --> 01:39:07,159 our mobile application beautiful for me 2273 01:39:07,159 --> 01:39:08,480 I see some of the movies that are 2274 01:39:08,480 --> 01:39:10,599 currently popular if you're watching 2275 01:39:10,599 --> 01:39:12,560 this video later on for you some 2276 01:39:12,560 --> 01:39:14,280 different ones might be so in the 2277 01:39:14,280 --> 01:39:16,239 comments down below let me know what is 2278 01:39:16,239 --> 01:39:18,080 the popular movie from your list that 2279 01:39:18,080 --> 01:39:20,480 you like and with that said we also have 2280 01:39:20,480 --> 01:39:22,840 one little error right here saying that 2281 01:39:22,840 --> 01:39:25,920 the path of movie slash is not a valid 2282 01:39:25,920 --> 01:39:28,440 path and it's actually pretty amazing 2283 01:39:28,440 --> 01:39:30,719 that react native can understand that we 2284 01:39:30,719 --> 01:39:33,880 don't have a movie ID path we only have 2285 01:39:33,880 --> 01:39:37,239 movies plural so as soon as we change it 2286 01:39:37,239 --> 01:39:40,239 that's working great so now that we're 2287 01:39:40,239 --> 01:39:42,560 showing the image and title already this 2288 01:39:42,560 --> 01:39:45,080 is looking amazing but we might as well 2289 01:39:45,080 --> 01:39:47,560 show some more information so let me 2290 01:39:47,560 --> 01:39:50,320 open up another view right here and give 2291 01:39:50,320 --> 01:39:55,599 it a class name of flex - row items Das 2292 01:39:55,599 --> 01:40:00,000 Center justify Das start and a gap of X 2293 01:40:00,000 --> 01:40:02,760 meaning horizontal only of 2294 01:40:02,760 --> 01:40:05,560 one within it we can display another 2295 01:40:05,560 --> 01:40:09,000 image but this time a much simpler one 2296 01:40:09,000 --> 01:40:11,360 just coming from icons which is coming 2297 01:40:11,360 --> 01:40:14,679 from constants do star so we want to 2298 01:40:14,679 --> 01:40:17,000 display the number of stars for each one 2299 01:40:17,000 --> 01:40:22,360 of these with a class name equal to size 2300 01:40:22,360 --> 01:40:25,320 is set to four and below it we can 2301 01:40:25,320 --> 01:40:28,280 render a piece of text that'll round up 2302 01:40:28,280 --> 01:40:30,840 the current score so I can use the 2303 01:40:30,840 --> 01:40:33,119 math.round vote 2304 01:40:33,119 --> 01:40:36,080 average divided by two because it goes 2305 01:40:36,080 --> 01:40:38,639 up to 10 we want to have it up to five 2306 01:40:38,639 --> 01:40:40,560 so if we do this and reload our 2307 01:40:40,560 --> 01:40:43,000 application the changes are still not 2308 01:40:43,000 --> 01:40:45,480 getting applied so sometimes you might 2309 01:40:45,480 --> 01:40:47,960 need to just reload your application by 2310 01:40:47,960 --> 01:40:50,840 pressing contrl C and then run MPX 2311 01:40:50,840 --> 01:40:52,880 expose start one more time and then 2312 01:40:52,880 --> 01:40:56,040 press R to fully reload it but why can't 2313 01:40:56,040 --> 01:40:58,960 we see the star yet oh it's not SRC in 2314 01:40:58,960 --> 01:41:02,239 react native it's Source oh it's those 2315 01:41:02,239 --> 01:41:04,480 little gotas right that always get you 2316 01:41:04,480 --> 01:41:06,239 there are some small differences between 2317 01:41:06,239 --> 01:41:09,360 react and react native so be careful but 2318 01:41:09,360 --> 01:41:12,159 thankfully there aren't many let's also 2319 01:41:12,159 --> 01:41:15,960 give this text a class name of text- XS 2320 01:41:15,960 --> 01:41:20,480 extra small text- white and font Das 2321 01:41:20,480 --> 01:41:24,199 bold as well as uppercase so now we can 2322 01:41:24,199 --> 01:41:27,080 show the rating right here below this 2323 01:41:27,080 --> 01:41:29,639 view let's render another 2324 01:41:29,639 --> 01:41:33,320 view this one will have a class name 2325 01:41:33,320 --> 01:41:37,800 equal to flex D row items Das Center and 2326 01:41:37,800 --> 01:41:40,960 justify Dash between and within it we 2327 01:41:40,960 --> 01:41:43,520 can render a piece of text that'll have 2328 01:41:43,520 --> 01:41:49,679 a class name equal to text- XS text 2329 01:41:49,679 --> 01:41:53,679 dl-300 font D medium and the margin top 2330 01:41:53,679 --> 01:41:56,119 of one and within it we can render the 2331 01:41:56,119 --> 01:41:59,440 release date but it'll be too long like 2332 01:41:59,440 --> 01:42:02,760 this so we can just split it by saying 2333 01:42:02,760 --> 01:42:07,760 question mark. spit based on the dashes 2334 01:42:07,760 --> 01:42:09,400 and we can only take the first part of 2335 01:42:09,400 --> 01:42:11,599 the dash which is the year we just care 2336 01:42:11,599 --> 01:42:13,280 about when this movie was 2337 01:42:13,280 --> 01:42:16,119 released and below this piece of text we 2338 01:42:16,119 --> 01:42:19,639 can render another that will simply say 2339 01:42:19,639 --> 01:42:22,480 movie and we can give it a class name 2340 01:42:22,480 --> 01:42:23,719 equal to 2341 01:42:23,719 --> 01:42:29,679 text- EXs font D medium text- light 300 2342 01:42:29,679 --> 01:42:32,440 and uppercase and if you save it it'll 2343 01:42:32,440 --> 01:42:34,679 now say movie this is cool to have later 2344 01:42:34,679 --> 01:42:37,360 on in case maybe some are not movies but 2345 01:42:37,360 --> 01:42:39,800 maybe TV shows so you can specify which 2346 01:42:39,800 --> 01:42:42,080 one it is but for now I will simply 2347 01:42:42,080 --> 01:42:44,159 comment it out and I also want to make 2348 01:42:44,159 --> 01:42:46,599 sure that the title takes only one row 2349 01:42:46,599 --> 01:42:48,480 because if it doesn't that can mess up 2350 01:42:48,480 --> 01:42:51,280 with the view so where we have the title 2351 01:42:51,280 --> 01:42:53,199 that's going to be right here under this 2352 01:42:53,199 --> 01:42:55,159 text property we don't have to shorten 2353 01:42:55,159 --> 01:42:57,960 the string react natives text element 2354 01:42:57,960 --> 01:43:01,159 comes with a pre-built number of lines 2355 01:43:01,159 --> 01:43:03,280 prop where you can say that this text 2356 01:43:03,280 --> 01:43:05,360 should only take one line and 2357 01:43:05,360 --> 01:43:07,199 immediately you can see that it is 2358 01:43:07,199 --> 01:43:10,320 shortened to just a single line looking 2359 01:43:10,320 --> 01:43:12,880 great with that in mind I invite you to 2360 01:43:12,880 --> 01:43:15,239 further style this card right now we're 2361 01:43:15,239 --> 01:43:17,679 just showing the title the profile photo 2362 01:43:17,679 --> 01:43:19,880 the rating and the year but as you know 2363 01:43:19,880 --> 01:43:22,199 we're getting back so much more data 2364 01:43:22,199 --> 01:43:25,040 about each one of of these movies so you 2365 01:43:25,040 --> 01:43:27,560 can go ahead and utilize something else 2366 01:43:27,560 --> 01:43:30,119 like the original language or the 2367 01:43:30,119 --> 01:43:32,560 popularity or even show the overview 2368 01:43:32,560 --> 01:43:35,320 right here so feel free to play with it 2369 01:43:35,320 --> 01:43:38,199 and try to further customize this card I 2370 01:43:38,199 --> 01:43:40,239 will suggest with simply destructuring 2371 01:43:40,239 --> 01:43:42,760 some more props from right here and then 2372 01:43:42,760 --> 01:43:45,159 using them within your jsx but don't 2373 01:43:45,159 --> 01:43:46,800 worry about it too much because very 2374 01:43:46,800 --> 01:43:49,239 soon we'll be able to show all of the 2375 01:43:49,239 --> 01:43:51,880 details about a movie within our movie 2376 01:43:51,880 --> 01:43:54,719 Details page so keeping that in mind I 2377 01:43:54,719 --> 01:43:57,239 am now more than happy with how our 2378 01:43:57,239 --> 01:43:59,599 homepage is looking and if we head back 2379 01:43:59,599 --> 01:44:02,719 to the index. TSX you can see that we're 2380 01:44:02,719 --> 01:44:05,239 fetching back all the movies but now 2381 01:44:05,239 --> 01:44:08,480 what we can do is for the time being 2382 01:44:08,480 --> 01:44:12,000 manually change the query to see whether 2383 01:44:12,000 --> 01:44:14,840 our function works for fetches where 2384 01:44:14,840 --> 01:44:17,599 we're searching for a specific movie so 2385 01:44:17,599 --> 01:44:20,360 if I type something like Iron Man and 2386 01:44:20,360 --> 01:44:23,400 click save you can see that it'll reload 2387 01:44:23,400 --> 01:44:25,800 and show all of the movies that match 2388 01:44:25,800 --> 01:44:28,800 that search term pretty cool right and 2389 01:44:28,800 --> 01:44:30,679 if I bring it back we're back to where 2390 01:44:30,679 --> 01:44:33,320 we were it's not that hard right once 2391 01:44:33,320 --> 01:44:35,400 you understand the basics using it the 2392 01:44:35,400 --> 01:44:38,159 next time will feel much easier but this 2393 01:44:38,159 --> 01:44:40,840 was just one example of creating a 2394 01:44:40,840 --> 01:44:42,880 custom hook for fetching data you can 2395 01:44:42,880 --> 01:44:44,560 create custom hooks for many other 2396 01:44:44,560 --> 01:44:46,880 things like handling forms like react 2397 01:44:46,880 --> 01:44:49,679 hook form managing themes or storing 2398 01:44:49,679 --> 01:44:51,440 data in local storage you can do 2399 01:44:51,440 --> 01:44:53,239 whatever you want but don't give me me 2400 01:44:53,239 --> 01:44:55,159 wrong you don't always need to create 2401 01:44:55,159 --> 01:44:57,440 your own hooks only when it really makes 2402 01:44:57,440 --> 01:45:00,560 sense to do so because react 19 comes 2403 01:45:00,560 --> 01:45:03,480 with a lot of pre-built hook like the Ed 2404 01:45:03,480 --> 01:45:07,400 hook yep it's only used like this and it 2405 01:45:07,400 --> 01:45:09,159 does some pretty cool things there's 2406 01:45:09,159 --> 01:45:12,119 also the use action State use form State 2407 01:45:12,119 --> 01:45:14,599 use transition which make working with 2408 01:45:14,599 --> 01:45:17,480 forms and requests much easier and I 2409 01:45:17,480 --> 01:45:20,480 actually explain all of these in detail 2410 01:45:20,480 --> 01:45:22,560 with real examples and even better 2411 01:45:22,560 --> 01:45:23,599 projects 2412 01:45:23,599 --> 01:45:26,000 within the new react native course that 2413 01:45:26,000 --> 01:45:28,800 I'm right now building for JS Mastery 2414 01:45:28,800 --> 01:45:31,080 Pro it's a new learning platform where 2415 01:45:31,080 --> 01:45:33,520 you can learn Lesson by lesson with real 2416 01:45:33,520 --> 01:45:36,599 examples and even better projects so go 2417 01:45:36,599 --> 01:45:38,119 ahead and check it out I'll leave the 2418 01:45:38,119 --> 01:45:40,320 link in the description but with that 2419 01:45:40,320 --> 01:45:42,320 let's go ahead and develop the search so 2420 01:45:42,320 --> 01:45:44,080 we no longer have to manually pass the 2421 01:45:44,080 --> 01:45:46,800 query right here instead we can use the 2422 01:45:46,800 --> 01:45:49,880 actual search page and then pass over 2423 01:45:49,880 --> 01:45:53,520 real values great job so far the app is 2424 01:45:53,520 --> 01:45:55,920 already looking amazing but now we'll 2425 01:45:55,920 --> 01:46:00,159 make it stand out with even better 2426 01:46:00,159 --> 01:46:02,080 functionalities similar to what we did 2427 01:46:02,080 --> 01:46:04,760 in the home screen now is the time to 2428 01:46:04,760 --> 01:46:07,280 develop the search screen so let's open 2429 01:46:07,280 --> 01:46:10,080 up our file explorer and head over into 2430 01:46:10,080 --> 01:46:14,320 tabs search. TSX now we could totally 2431 01:46:14,320 --> 01:46:17,679 just copy the entire index. TSX and just 2432 01:46:17,679 --> 01:46:20,679 paste it over into the search but I want 2433 01:46:20,679 --> 01:46:22,800 to take the time to guide you through 2434 01:46:22,800 --> 01:46:24,920 the the process of building it out one 2435 01:46:24,920 --> 01:46:27,719 more time because although it'll be very 2436 01:46:27,719 --> 01:46:30,080 similar there will be some differences 2437 01:46:30,080 --> 01:46:33,000 here and it's just a beautiful chance to 2438 01:46:33,000 --> 01:46:35,159 recap everything we've learned so far 2439 01:46:35,159 --> 01:46:36,880 just to make sure you totally get it 2440 01:46:36,880 --> 01:46:38,719 I've made the font a bit smaller just so 2441 01:46:38,719 --> 01:46:41,280 you can nicely see everything and we are 2442 01:46:41,280 --> 01:46:44,840 ready to get started first this view 2443 01:46:44,840 --> 01:46:47,159 that we're wrapping everything with will 2444 01:46:47,159 --> 01:46:51,880 have a class name of flex D1 and BG - 2445 01:46:51,880 --> 01:46:53,840 primary just so we don't have to stare 2446 01:46:53,840 --> 01:46:57,040 at that blank screen anymore next within 2447 01:46:57,040 --> 01:47:00,280 it I'll display another image which I'll 2448 01:47:00,280 --> 01:47:03,280 import from react native and it'll have 2449 01:47:03,280 --> 01:47:07,040 a source equal to images coming from 2450 01:47:07,040 --> 01:47:10,760 constants BG so this is our background 2451 01:47:10,760 --> 01:47:13,840 with a class name of flex 2452 01:47:13,840 --> 01:47:19,480 D1 absolute W full and Z of zero as well 2453 01:47:19,480 --> 01:47:23,800 as a resize mode equal to cover 2454 01:47:23,800 --> 01:47:26,599 similar to as on the homepage next in 2455 01:47:26,599 --> 01:47:29,400 this case instead of wrapping everything 2456 01:47:29,400 --> 01:47:31,360 with the scroll view as we did on the 2457 01:47:31,360 --> 01:47:33,639 index here we don't want to scroll the 2458 01:47:33,639 --> 01:47:35,840 entire view because the search bar 2459 01:47:35,840 --> 01:47:39,080 always has to remain on top so here I 2460 01:47:39,080 --> 01:47:42,239 will actually just render a flat list 2461 01:47:42,239 --> 01:47:45,119 pass the movies to it and pass the 2462 01:47:45,119 --> 01:47:48,080 similar render item as before where we 2463 01:47:48,080 --> 01:47:50,480 will destructure the each individual 2464 01:47:50,480 --> 01:47:53,000 movie and for each one we'll simply 2465 01:47:53,000 --> 01:47:56,320 render a movie card to which we will 2466 01:47:56,320 --> 01:48:00,199 spread the item property or in this case 2467 01:48:00,199 --> 01:48:03,000 the movie itself so let me put these 2468 01:48:03,000 --> 01:48:04,920 props in a new line so it's easier to 2469 01:48:04,920 --> 01:48:08,119 see and we are rendering this movie card 2470 01:48:08,119 --> 01:48:10,520 right here there we go now of course 2471 01:48:10,520 --> 01:48:13,080 where are these movies coming from well 2472 01:48:13,080 --> 01:48:15,000 this part we can definitely grab from 2473 01:48:15,000 --> 01:48:17,440 the index we're getting them by simply 2474 01:48:17,440 --> 01:48:21,199 calling our use fetch fetch movies this 2475 01:48:21,199 --> 01:48:23,280 is a custom hook we already created we 2476 01:48:23,280 --> 01:48:24,840 might as well grab this used router at 2477 01:48:24,840 --> 01:48:27,480 the top we'll surely need to use it and 2478 01:48:27,480 --> 01:48:29,440 I'll paste it right here at the top of 2479 01:48:29,440 --> 01:48:30,199 our 2480 01:48:30,199 --> 01:48:32,840 search make sure to also get all the 2481 01:48:32,840 --> 01:48:35,440 Imports such as this movie card right 2482 01:48:35,440 --> 01:48:38,040 here and now if we go back to the search 2483 01:48:38,040 --> 01:48:40,920 you'll see we have well something right 2484 01:48:40,920 --> 01:48:44,480 a broken layout so far next as before we 2485 01:48:44,480 --> 01:48:47,960 need a key extractor to let react native 2486 01:48:47,960 --> 01:48:50,159 which ID does each one of these elements 2487 01:48:50,159 --> 01:48:53,920 have and here we can just say that each 2488 01:48:53,920 --> 01:48:57,639 one will get it from item. 2489 01:48:57,639 --> 01:49:02,119 id. to string we'll also render a class 2490 01:49:02,119 --> 01:49:05,840 name and give it a padding X of five so 2491 01:49:05,840 --> 01:49:09,480 some spacing a number of columns will be 2492 01:49:09,480 --> 01:49:12,199 set to three as before and we have to 2493 01:49:12,199 --> 01:49:14,239 reload our application for the changes 2494 01:49:14,239 --> 01:49:16,440 to take effect there we go this is a bit 2495 01:49:16,440 --> 01:49:19,679 better as well as we can provide the 2496 01:49:19,679 --> 01:49:23,159 column wrapper style which will be an 2497 01:49:23,159 --> 01:49:25,560 object that will say justif a content is 2498 01:49:25,560 --> 01:49:29,520 equal to center a gap of 16 in between 2499 01:49:29,520 --> 01:49:32,320 the elements as well as a margin 2500 01:49:32,320 --> 01:49:34,520 vertical to create some space for the 2501 01:49:34,520 --> 01:49:38,480 search bar of 16 as well we can also 2502 01:49:38,480 --> 01:49:41,880 render the content container style as 2503 01:49:41,880 --> 01:49:44,599 before which will simply have a padding 2504 01:49:44,599 --> 01:49:48,719 bottom of something like 100 and now 2505 01:49:48,719 --> 01:49:51,880 bear with me before we display the 2506 01:49:51,880 --> 01:49:54,840 search bar at the top of the flat list 2507 01:49:54,840 --> 01:49:57,199 because we were able to scroll the whole 2508 01:49:57,199 --> 01:49:58,800 thing we didn't need to see the search 2509 01:49:58,800 --> 01:50:01,440 bar but in this case we'll render the 2510 01:50:01,440 --> 01:50:05,840 search bar as a part of the flat list so 2511 01:50:05,840 --> 01:50:08,280 I'll do that with yet another special 2512 01:50:08,280 --> 01:50:12,000 flat list prop called list Heather 2513 01:50:12,000 --> 01:50:14,800 component I'll open up an empty react 2514 01:50:14,800 --> 01:50:17,639 fragment and whatever you put within it 2515 01:50:17,639 --> 01:50:20,880 will be displayed at the top of our list 2516 01:50:20,880 --> 01:50:24,360 so let me say something like like View 2517 01:50:24,360 --> 01:50:28,840 and this view will have a class name of 2518 01:50:28,840 --> 01:50:30,960 w-o 2519 01:50:30,960 --> 01:50:35,119 flex-r justify Dash Center margin top of 2520 01:50:35,119 --> 01:50:39,320 20 and items Das Center and within it we 2521 01:50:39,320 --> 01:50:42,639 can display our logo that'll be an image 2522 01:50:42,639 --> 01:50:45,920 with a source equal to icons make sure 2523 01:50:45,920 --> 01:50:49,719 to import them from icons constants do 2524 01:50:49,719 --> 01:50:55,679 logo with a class name of W12 and h10 so 2525 01:50:55,679 --> 01:50:57,599 now we get the logo at the top as I 2526 01:50:57,599 --> 01:50:59,280 promised whatever you put within the 2527 01:50:59,280 --> 01:51:01,239 list header component even though it's 2528 01:51:01,239 --> 01:51:03,360 just a part of the flat list it'll 2529 01:51:03,360 --> 01:51:05,400 actually show on top as that's what this 2530 01:51:05,400 --> 01:51:07,639 component does rendered at the top of 2531 01:51:07,639 --> 01:51:10,920 all the items now below the view that's 2532 01:51:10,920 --> 01:51:13,639 wrapping the image we can render another 2533 01:51:13,639 --> 01:51:17,440 view this one will have a class name 2534 01:51:17,440 --> 01:51:21,719 equal to margin y of five and here we 2535 01:51:21,719 --> 01:51:24,119 can render the search bar coming from 2536 01:51:24,119 --> 01:51:27,119 components search bar and we can give it 2537 01:51:27,119 --> 01:51:30,679 a placeholder of something like search 2538 01:51:30,679 --> 01:51:33,360 movies dot dot dot there we go it 2539 01:51:33,360 --> 01:51:35,280 appeared right on top right below the 2540 01:51:35,280 --> 01:51:37,560 view we can also check whether we are 2541 01:51:37,560 --> 01:51:39,719 currently loading so I'll say something 2542 01:51:39,719 --> 01:51:43,040 like movies loading and if movies are 2543 01:51:43,040 --> 01:51:46,960 loading then we can show an activity 2544 01:51:46,960 --> 01:51:51,159 indicator with a size is equal to large 2545 01:51:51,159 --> 01:51:54,239 a color is equal to 2546 01:51:54,239 --> 01:52:00,040 000000 FF and a class name equal to 2547 01:52:00,040 --> 01:52:03,040 margin y of three so now we have to get 2548 01:52:03,040 --> 01:52:05,760 access to this movies loading and we're 2549 01:52:05,760 --> 01:52:08,239 getting it right here through this use 2550 01:52:08,239 --> 01:52:10,440 fetch call but I have to spell it 2551 01:52:10,440 --> 01:52:13,800 properly the L in loading is uppercased 2552 01:52:13,800 --> 01:52:17,040 now if we go back if you're paying close 2553 01:52:17,040 --> 01:52:19,119 attention you would have been able to 2554 01:52:19,119 --> 01:52:21,280 see the loading for a short period of 2555 01:52:21,280 --> 01:52:24,320 time but if we don't have a loading then 2556 01:52:24,320 --> 01:52:26,320 it is possible that we might have some 2557 01:52:26,320 --> 01:52:29,840 kind of an error so I'll say if movies 2558 01:52:29,840 --> 01:52:33,440 error in that case we can render just a 2559 01:52:33,440 --> 01:52:36,199 single piece of text that'll have a 2560 01:52:36,199 --> 01:52:40,960 class name of text- 2561 01:52:40,960 --> 01:52:45,239 r-500 padding X of five and margin y of 2562 01:52:45,239 --> 01:52:48,639 three and the text will say 2563 01:52:48,639 --> 01:52:51,199 error and then we'll render the movies 2564 01:52:51,199 --> 01:52:54,679 error die message no errors for now and 2565 01:52:54,679 --> 01:52:57,000 finally below it I'll open another 2566 01:52:57,000 --> 01:52:59,760 Dynamic block of code and if we're 2567 01:52:59,760 --> 01:53:03,880 neither loading nor there is an error 2568 01:53:03,880 --> 01:53:06,079 then we can take a look into the current 2569 01:53:06,079 --> 01:53:08,599 search term let's say that the search 2570 01:53:08,599 --> 01:53:11,280 term right now is hardcoded search 2571 01:53:11,280 --> 01:53:14,159 term. trim so we want to trim any extra 2572 01:53:14,159 --> 01:53:16,719 spaces and if the search query exists as 2573 01:53:16,719 --> 01:53:19,239 well we want to check if there are any 2574 01:53:19,239 --> 01:53:22,280 movies. length so movies question mark. 2575 01:53:22,280 --> 01:53:25,280 link length for that search term and if 2576 01:53:25,280 --> 01:53:28,360 that is greater than zero in that case 2577 01:53:28,360 --> 01:53:31,520 we can finally return a piece of text 2578 01:53:31,520 --> 01:53:35,239 and this piece of text will say search 2579 01:53:35,239 --> 01:53:36,880 results 2580 01:53:36,880 --> 01:53:39,400 for we can put an empty string right 2581 01:53:39,400 --> 01:53:42,280 here and then render another piece of 2582 01:53:42,280 --> 01:53:45,760 text that'll say search term and I'll 2583 01:53:45,760 --> 01:53:47,920 style the second piece of text by giving 2584 01:53:47,920 --> 01:53:51,320 it a text- accent class name and I'll 2585 01:53:51,320 --> 01:53:53,639 style the first piece of text text by 2586 01:53:53,639 --> 01:53:58,639 giving it a class name of text- excl 2587 01:53:58,639 --> 01:54:02,159 text- white and font Dash bolt oh and 2588 01:54:02,159 --> 01:54:04,000 now I see that I call this just loading 2589 01:54:04,000 --> 01:54:05,840 an error instead of movies errors and 2590 01:54:05,840 --> 01:54:07,880 movies loading so you know what it might 2591 01:54:07,880 --> 01:54:09,840 be just simpler to call it like that it 2592 01:54:09,840 --> 01:54:11,400 makes sense that we're loading the 2593 01:54:11,400 --> 01:54:14,679 movies so I'll just not rename the 2594 01:54:14,679 --> 01:54:16,880 loading in the error to loading movies 2595 01:54:16,880 --> 01:54:18,679 and loading error I'll just keep them as 2596 01:54:18,679 --> 01:54:21,639 loading and error so here I can now 2597 01:54:21,639 --> 01:54:24,599 change the mov loading to loading and 2598 01:54:24,599 --> 01:54:28,800 error to error same thing right here and 2599 01:54:28,800 --> 01:54:31,480 now this message right here makes sense 2600 01:54:31,480 --> 01:54:34,880 if there is no loading and no error and 2601 01:54:34,880 --> 01:54:37,599 search term exist and if movies that 2602 01:54:37,599 --> 01:54:40,079 length is greater than zero well then 2603 01:54:40,079 --> 01:54:42,320 display this piece of text so now if you 2604 01:54:42,320 --> 01:54:43,639 go 2605 01:54:43,639 --> 01:54:47,079 back you can see search results for 2606 01:54:47,079 --> 01:54:50,040 search term so let's make it Dynamic 2607 01:54:50,040 --> 01:54:52,760 right at the top of this component I'll 2608 01:54:52,760 --> 01:54:56,079 create another Ed State we don't need 2609 01:54:56,079 --> 01:54:58,760 the router in this case so let me delete 2610 01:54:58,760 --> 01:55:02,679 it and let me Define a use State snippet 2611 01:55:02,679 --> 01:55:07,000 called search query set search query at 2612 01:55:07,000 --> 01:55:09,639 the start equal to an empty string also 2613 01:55:09,639 --> 01:55:12,639 when calling these movies in this case I 2614 01:55:12,639 --> 01:55:15,400 want to pass a second parameter to the 2615 01:55:15,400 --> 01:55:18,960 use fetch function of false because in 2616 01:55:18,960 --> 01:55:21,960 this case we don't want to autof fetch 2617 01:55:21,960 --> 01:55:23,760 we just just want to let the user 2618 01:55:23,760 --> 01:55:26,280 actually trigger the fetch on search so 2619 01:55:26,280 --> 01:55:28,400 that's why we initially extended this 2620 01:55:28,400 --> 01:55:31,400 custom hook to allow for autof fetch 2621 01:55:31,400 --> 01:55:33,719 when we're on the homepage or to 2622 01:55:33,719 --> 01:55:36,119 disallow it when we want the user to 2623 01:55:36,119 --> 01:55:38,360 search First and of course we can now 2624 01:55:38,360 --> 01:55:41,400 put the search query to use and say give 2625 01:55:41,400 --> 01:55:44,280 me the movies where the query matches 2626 01:55:44,280 --> 01:55:45,639 the query that the user currently 2627 01:55:45,639 --> 01:55:47,719 searched for so now that we have access 2628 01:55:47,719 --> 01:55:51,440 to the search query right below we can 2629 01:55:51,440 --> 01:55:54,239 replace this big search term with search 2630 01:55:54,239 --> 01:55:57,880 query. trim and also below where we're 2631 01:55:57,880 --> 01:55:59,960 saying search term we can render the 2632 01:55:59,960 --> 01:56:01,440 actual search 2633 01:56:01,440 --> 01:56:05,079 query so now if I open up my keyboard by 2634 01:56:05,079 --> 01:56:07,880 clicking on the list and I start typing 2635 01:56:07,880 --> 01:56:10,599 you'll see nothing is yet changing and 2636 01:56:10,599 --> 01:56:12,800 that's because we haven't passed proper 2637 01:56:12,800 --> 01:56:15,000 values into the search bar so to the 2638 01:56:15,000 --> 01:56:18,920 search bar alongside the placeholder we 2639 01:56:18,920 --> 01:56:23,360 also have to pass the value 2640 01:56:23,360 --> 01:56:27,360 equal to search query as well as on 2641 01:56:27,360 --> 01:56:31,960 change text equal to a callback function 2642 01:56:31,960 --> 01:56:34,639 where we simply set query or set search 2643 01:56:34,639 --> 01:56:37,760 query to be equal to text that is coming 2644 01:56:37,760 --> 01:56:39,960 right here through props and we can set 2645 01:56:39,960 --> 01:56:43,639 the type of this search to a string but 2646 01:56:43,639 --> 01:56:45,360 as you can see the search bar is still 2647 01:56:45,360 --> 01:56:48,119 not accepting the value prop so let's 2648 01:56:48,119 --> 01:56:50,280 head into it and let's implement it I'll 2649 01:56:50,280 --> 01:56:52,760 simply say also accept the value 2650 01:56:52,760 --> 01:56:55,040 and the value will be of a type string 2651 01:56:55,040 --> 01:56:57,360 once you do accept it simply forward it 2652 01:56:57,360 --> 01:57:02,360 here value and also forward the onchange 2653 01:57:02,360 --> 01:57:04,360 text I believe that's how we called it 2654 01:57:04,360 --> 01:57:08,520 onchange text so it'll be a function 2655 01:57:08,520 --> 01:57:12,040 that doesn't return anything void and 2656 01:57:12,040 --> 01:57:14,760 now we can make that onchange text right 2657 01:57:14,760 --> 01:57:18,679 here instead of this dummy cack 2658 01:57:18,679 --> 01:57:22,040 function if we now do that looks like I 2659 01:57:22,040 --> 01:57:25,079 did properly defined the type here we 2660 01:57:25,079 --> 01:57:26,360 are getting something as the first 2661 01:57:26,360 --> 01:57:29,719 parameter and it is text of a type 2662 01:57:29,719 --> 01:57:32,920 string so if I fix that you can see that 2663 01:57:32,920 --> 01:57:35,360 the error goes away and now if I start 2664 01:57:35,360 --> 01:57:37,760 typing something like 2665 01:57:37,760 --> 01:57:39,880 Batman you can see that the search 2666 01:57:39,880 --> 01:57:42,360 results change immediately right here 2667 01:57:42,360 --> 01:57:45,280 below I can type Marvel that works as 2668 01:57:45,280 --> 01:57:48,360 well it works incredibly well and as 2669 01:57:48,360 --> 01:57:50,760 soon as I delete it the search results 2670 01:57:50,760 --> 01:57:52,719 go away great 2671 01:57:52,719 --> 01:57:55,079 but finally what matters most is 2672 01:57:55,079 --> 01:57:57,119 rendering the movies that match that 2673 01:57:57,119 --> 01:58:01,199 search term so I'll create a new use 2674 01:58:01,199 --> 01:58:04,719 effect right here below this use effect 2675 01:58:04,719 --> 01:58:06,480 will have a callback 2676 01:58:06,480 --> 01:58:10,000 function and a dependency array we want 2677 01:58:10,000 --> 01:58:12,960 to recall it every time that the search 2678 01:58:12,960 --> 01:58:16,719 query changes so I'll say if search 2679 01:58:16,719 --> 01:58:20,520 query. trim exists so if there is 2680 01:58:20,520 --> 01:58:22,960 something that the user has searched for 2681 01:58:22,960 --> 01:58:25,679 then await and as a return value of the 2682 01:58:25,679 --> 01:58:27,920 fetch we're also getting access to the 2683 01:58:27,920 --> 01:58:31,079 refetch function which we can rename to 2684 01:58:31,079 --> 01:58:33,280 load movies because that's exactly what 2685 01:58:33,280 --> 01:58:36,679 it does and also we get access to 2686 01:58:36,679 --> 01:58:39,960 reset so now if there is a search term 2687 01:58:39,960 --> 01:58:43,079 whenever the search query changes just 2688 01:58:43,079 --> 01:58:48,599 await load movies like this else simply 2689 01:58:48,599 --> 01:58:50,840 reset the state and since we're using a 2690 01:58:50,840 --> 01:58:53,239 w right here we'll have to wrap this 2691 01:58:53,239 --> 01:58:56,040 into an asynchronous function so I'll 2692 01:58:56,040 --> 01:58:59,679 say const funk and I'll make it equal to 2693 01:58:59,679 --> 01:59:01,960 an asynchronous function that then has 2694 01:59:01,960 --> 01:59:04,520 this if within it that'll look something 2695 01:59:04,520 --> 01:59:06,440 like this and now we can call this 2696 01:59:06,440 --> 01:59:09,000 function just below if I do that 2697 01:59:09,000 --> 01:59:11,920 initially you'll see no movies but if I 2698 01:59:11,920 --> 01:59:15,719 search for Iron Man you can see all the 2699 01:59:15,719 --> 01:59:18,159 movies that match that search term and 2700 01:59:18,159 --> 01:59:20,159 if you start deleting it you can see 2701 01:59:20,159 --> 01:59:22,400 that we get back to well I I think we 2702 01:59:22,400 --> 01:59:24,920 got back to whatever the letter was 2703 01:59:24,920 --> 01:59:27,360 there before we actually removed it so 2704 01:59:27,360 --> 01:59:30,239 this is the letter i movies and then 2705 01:59:30,239 --> 01:59:32,800 yeah if we remove it we have nothing now 2706 01:59:32,800 --> 01:59:34,840 there's a couple of problems with this 2707 01:59:34,840 --> 01:59:36,400 and that is that let's say that I want 2708 01:59:36,400 --> 01:59:39,639 to type a normal movie name like Iron 2709 01:59:39,639 --> 01:59:42,800 Man like what happened here is that the 2710 01:59:42,800 --> 01:59:46,440 app made a request to the API for every 2711 01:59:46,440 --> 01:59:52,520 single letter that I type that is a lot 2712 01:59:52,520 --> 01:59:54,840 of different requests and for each one 2713 01:59:54,840 --> 01:59:56,920 we're getting many movies but hey I just 2714 01:59:56,920 --> 01:59:59,280 wanted to see the ones that I get back 2715 01:59:59,280 --> 02:00:02,599 once I type the entire search term so to 2716 02:00:02,599 --> 02:00:04,840 not overload our application with too 2717 02:00:04,840 --> 02:00:07,400 many API requests for every single 2718 02:00:07,400 --> 02:00:09,760 keystroke what we need to do is 2719 02:00:09,760 --> 02:00:11,560 something called 2720 02:00:11,560 --> 02:00:15,079 debouncing we can debounce a search term 2721 02:00:15,079 --> 02:00:18,599 by wrapping it into a timeout function 2722 02:00:18,599 --> 02:00:24,840 so I'll say const timeout ID is equal to 2723 02:00:24,840 --> 02:00:26,400 set 2724 02:00:26,400 --> 02:00:30,000 timeout and then we have this function 2725 02:00:30,000 --> 02:00:32,360 and we can close it here as well and in 2726 02:00:32,360 --> 02:00:34,400 this case you don't have to call it but 2727 02:00:34,400 --> 02:00:36,800 we do have to give it a second parameter 2728 02:00:36,800 --> 02:00:39,320 which is a number of milliseconds of how 2729 02:00:39,320 --> 02:00:42,560 long it'll wait for the next keystroke 2730 02:00:42,560 --> 02:00:45,400 I'll explain what that means soon and 2731 02:00:45,400 --> 02:00:48,440 now we can return a callback function 2732 02:00:48,440 --> 02:00:52,119 where we can clear the timeout with that 2733 02:00:52,119 --> 02:00:55,960 specific timeout ID this is just to make 2734 02:00:55,960 --> 02:00:58,360 our application work more efficiently we 2735 02:00:58,360 --> 02:01:01,000 need to clear out all the timeouts but 2736 02:01:01,000 --> 02:01:03,920 with that said check this out if I type 2737 02:01:03,920 --> 02:01:06,840 very quickly you'll see that as long as 2738 02:01:06,840 --> 02:01:09,320 I continue typing no request will be 2739 02:01:09,320 --> 02:01:12,760 made but as soon as I stop typing for 2740 02:01:12,760 --> 02:01:15,040 500 milliseconds which is half a second 2741 02:01:15,040 --> 02:01:17,000 immediately I'll get the results this 2742 02:01:17,000 --> 02:01:19,400 means that a user that types fast can 2743 02:01:19,400 --> 02:01:21,599 only make a single request and get the 2744 02:01:21,599 --> 02:01:23,719 data they would usually get as well but 2745 02:01:23,719 --> 02:01:26,159 this time in a single request instead of 2746 02:01:26,159 --> 02:01:29,920 a dozen great but now what happens if I 2747 02:01:29,920 --> 02:01:32,840 search for something that just doesn't 2748 02:01:32,840 --> 02:01:36,119 exist we are left with a completely 2749 02:01:36,119 --> 02:01:38,480 empty screen something that you never 2750 02:01:38,480 --> 02:01:40,679 want to see within your application you 2751 02:01:40,679 --> 02:01:42,119 always want to show some kind of an 2752 02:01:42,119 --> 02:01:45,800 empty State and believe it or not once 2753 02:01:45,800 --> 02:01:47,679 again I think you can now start seeing 2754 02:01:47,679 --> 02:01:50,440 what I was saying from the start in 2755 02:01:50,440 --> 02:01:53,599 react native components there is a prop 2756 02:01:53,599 --> 02:01:57,760 for everything from the data render item 2757 02:01:57,760 --> 02:02:00,239 key extractor to defining how a header 2758 02:02:00,239 --> 02:02:03,880 will look like two even defining how an 2759 02:02:03,880 --> 02:02:07,760 empty state will look like yep list 2760 02:02:07,760 --> 02:02:11,159 empty state is a valid flatlist prop 2761 02:02:11,159 --> 02:02:13,360 that allows us to specify what the user 2762 02:02:13,360 --> 02:02:16,079 will see if there's nothing in the list 2763 02:02:16,079 --> 02:02:18,760 so I'll say if there is no 2764 02:02:18,760 --> 02:02:22,760 loading and if there is no error 2765 02:02:22,760 --> 02:02:25,560 in that case and of course if we're 2766 02:02:25,560 --> 02:02:29,599 empty we'll show a view with a class 2767 02:02:29,599 --> 02:02:33,639 name equal to margin top of 10 and 2768 02:02:33,639 --> 02:02:36,199 padding X of five a text 2769 02:02:36,199 --> 02:02:39,599 element with a class name of text- 2770 02:02:39,599 --> 02:02:44,040 Center and text- gray 500 and within it 2771 02:02:44,040 --> 02:02:45,719 we can say search 2772 02:02:45,719 --> 02:02:49,520 query. trim if the search query exists 2773 02:02:49,520 --> 02:02:52,719 will say no movies found 2774 02:02:52,719 --> 02:02:54,880 but if a search query doesn't exist 2775 02:02:54,880 --> 02:02:59,440 we'll say search for a movie and of 2776 02:02:59,440 --> 02:03:03,199 course if there is a loading on error 2777 02:03:03,199 --> 02:03:06,280 we'll just return null for the empty 2778 02:03:06,280 --> 02:03:07,840 list component because we want to 2779 02:03:07,840 --> 02:03:10,599 display something else so currently we 2780 02:03:10,599 --> 02:03:14,199 get no movies found and if you wanted to 2781 02:03:14,199 --> 02:03:16,480 you could display a nice illustration 2782 02:03:16,480 --> 02:03:18,960 right here and say you know go ahead and 2783 02:03:18,960 --> 02:03:21,480 search for something cool or here's a 2784 02:03:21,480 --> 02:03:23,079 movie recommendation that you might want 2785 02:03:23,079 --> 02:03:25,480 to watch based on your history there's a 2786 02:03:25,480 --> 02:03:28,040 lot of things you can do on empty States 2787 02:03:28,040 --> 02:03:30,159 but hopefully the users won't be staring 2788 02:03:30,159 --> 02:03:32,239 at this for too long as they're going to 2789 02:03:32,239 --> 02:03:35,760 put our search to use great so in this 2790 02:03:35,760 --> 02:03:38,920 lesson we recapped what it means to 2791 02:03:38,920 --> 02:03:42,199 create a react native screen that uses 2792 02:03:42,199 --> 02:03:45,040 our custom hook fetches data from a 2793 02:03:45,040 --> 02:03:46,079 third party 2794 02:03:46,079 --> 02:03:49,520 API changes it based on the search query 2795 02:03:49,520 --> 02:03:51,280 that the user types in using their 2796 02:03:51,280 --> 02:03:54,159 keyboard as well as how to debounce a 2797 02:03:54,159 --> 02:03:56,639 search term to optimize it further and 2798 02:03:56,639 --> 02:03:59,199 not make too many requests and finally 2799 02:03:59,199 --> 02:04:01,679 how to use a flatlist component with all 2800 02:04:01,679 --> 02:04:03,800 of its props to properly render the 2801 02:04:03,800 --> 02:04:05,960 layout doesn't get much better than this 2802 02:04:05,960 --> 02:04:08,639 now in the next lesson we'll bring our 2803 02:04:08,639 --> 02:04:11,280 app to the next level we'll Implement an 2804 02:04:11,280 --> 02:04:15,480 algorithm that displays trending movies 2805 02:04:15,480 --> 02:04:18,800 so I'm not talking popular or searched 2806 02:04:18,800 --> 02:04:22,400 but rather show the movies that match 2807 02:04:22,400 --> 02:04:25,079 what the users within our app are 2808 02:04:25,079 --> 02:04:27,320 searching for that can kind of give you 2809 02:04:27,320 --> 02:04:30,320 an idea of who your users are and how we 2810 02:04:30,320 --> 02:04:33,040 can further customize the app so let me 2811 02:04:33,040 --> 02:04:36,840 show you how to implement it in the next 2812 02:04:36,840 --> 02:04:41,320 lesson so hey custom algorithm right 2813 02:04:41,320 --> 02:04:43,320 well technically yes you'll Implement a 2814 02:04:43,320 --> 02:04:45,559 feature that displays the movies that 2815 02:04:45,559 --> 02:04:47,480 The users are searching for within the 2816 02:04:47,480 --> 02:04:49,760 app to be more specific the more 2817 02:04:49,760 --> 02:04:51,760 frequently a specific search is 2818 02:04:51,760 --> 02:04:54,679 performed by multiple users the higher 2819 02:04:54,679 --> 02:04:57,320 its trending status becomes this 2820 02:04:57,320 --> 02:05:00,079 requires tracking and analyzing search 2821 02:05:00,079 --> 02:05:02,840 patterns over time for example if many 2822 02:05:02,840 --> 02:05:05,679 users Search for Avengers that search 2823 02:05:05,679 --> 02:05:08,960 term becomes trending and to track and 2824 02:05:08,960 --> 02:05:11,639 analyze these searches we need a place 2825 02:05:11,639 --> 02:05:14,800 to store that data permanently this is 2826 02:05:14,800 --> 02:05:17,480 where a database comes into the picture 2827 02:05:17,480 --> 02:05:20,119 it keeps all the information organized 2828 02:05:20,119 --> 02:05:22,360 and accessible and traditionally Ally 2829 02:05:22,360 --> 02:05:24,400 implementing this would mean building a 2830 02:05:24,400 --> 02:05:27,119 full stack application you'd have to 2831 02:05:27,119 --> 02:05:29,800 create a server set up a database 2832 02:05:29,800 --> 02:05:32,800 connect them host everything together 2833 02:05:32,800 --> 02:05:34,760 and then integrate it into your react 2834 02:05:34,760 --> 02:05:38,000 native project while this approach works 2835 02:05:38,000 --> 02:05:40,679 it can be a lot of effort and requires 2836 02:05:40,679 --> 02:05:42,960 diving into backend development which is 2837 02:05:42,960 --> 02:05:45,239 a whole different area of expertise an 2838 02:05:45,239 --> 02:05:47,920 easier way to get backend functionality 2839 02:05:47,920 --> 02:05:50,559 without starting from scratch is using a 2840 02:05:50,559 --> 02:05:52,599 backend as a service platform it'll 2841 02:05:52,599 --> 02:05:55,079 provide you with apis and tools to let 2842 02:05:55,079 --> 02:05:58,400 you store your data manage off and more 2843 02:05:58,400 --> 02:06:00,040 without needing in-depth backend 2844 02:06:00,040 --> 02:06:03,239 knowledge in this course I'll use aite 2845 02:06:03,239 --> 02:06:05,559 because it's simple open- source and 2846 02:06:05,559 --> 02:06:08,040 free to use plus it'll save us from 2847 02:06:08,040 --> 02:06:10,440 diving head first into backend work when 2848 02:06:10,440 --> 02:06:12,440 we really just want to focus on making a 2849 02:06:12,440 --> 02:06:14,920 react native app great so click the link 2850 02:06:14,920 --> 02:06:16,960 in the description and create your 2851 02:06:16,960 --> 02:06:19,760 account and then head over to your 2852 02:06:19,760 --> 02:06:22,199 console if you haven't already create 2853 02:06:22,199 --> 02:06:24,480 your project or just head over into the 2854 02:06:24,480 --> 02:06:27,360 one you already created and copy its ID 2855 02:06:27,360 --> 02:06:30,400 back within your app head over into ourv 2856 02:06:30,400 --> 02:06:32,559 file and let's create our second 2857 02:06:32,559 --> 02:06:37,239 environment variable Expo public aight 2858 02:06:37,239 --> 02:06:40,280 project ID and simply paste the one you 2859 02:06:40,280 --> 02:06:42,599 just copied now we'll have to set up a 2860 02:06:42,599 --> 02:06:45,159 platform for a project in this case 2861 02:06:45,159 --> 02:06:47,880 aight already comes with react native so 2862 02:06:47,880 --> 02:06:50,159 let's select it and you'll have to 2863 02:06:50,159 --> 02:06:52,400 choose Android or for 2864 02:06:52,400 --> 02:06:57,119 iOS and give it a name I'll do JSM movie 2865 02:06:57,119 --> 02:06:59,880 app and as the bundle ID you can type 2866 02:06:59,880 --> 02:07:04,679 something like com. JSM doov app like 2867 02:07:04,679 --> 02:07:07,440 this and click next it'll give you some 2868 02:07:07,440 --> 02:07:09,880 dependencies you want to install so copy 2869 02:07:09,880 --> 02:07:12,920 them open up your second terminal and 2870 02:07:12,920 --> 02:07:15,480 paste them right here to install app 2871 02:07:15,480 --> 02:07:16,800 right click 2872 02:07:16,800 --> 02:07:19,440 next next one more time because we'll do 2873 02:07:19,440 --> 02:07:21,639 this together and go to the the 2874 02:07:21,639 --> 02:07:23,840 dashboard and now we can set up the rest 2875 02:07:23,840 --> 02:07:26,040 of the back end together specifically 2876 02:07:26,040 --> 02:07:28,239 create a database and some collections 2877 02:07:28,239 --> 02:07:31,280 within it so let's do that next just to 2878 02:07:31,280 --> 02:07:33,599 give us some extra space to work with I 2879 02:07:33,599 --> 02:07:35,280 have hidden my Mobile screen from here 2880 02:07:35,280 --> 02:07:37,719 for now and I'll create our first 2881 02:07:37,719 --> 02:07:41,920 database I'll call it movies and create 2882 02:07:41,920 --> 02:07:43,880 as soon as you create it you'll be given 2883 02:07:43,880 --> 02:07:47,040 a database ID copy it and store it 2884 02:07:47,040 --> 02:07:49,760 within your editor within the EnV file 2885 02:07:49,760 --> 02:07:56,280 as Expo public aite database ID next 2886 02:07:56,280 --> 02:07:58,320 create a new collection within that 2887 02:07:58,320 --> 02:08:02,079 database call it metric you'll also be 2888 02:08:02,079 --> 02:08:04,800 given the ID of the metric collection so 2889 02:08:04,800 --> 02:08:07,800 copy it and paste it as the 2890 02:08:07,800 --> 02:08:12,520 Expo public aight collection 2891 02:08:12,520 --> 02:08:15,679 ID and baste it now you'll want to 2892 02:08:15,679 --> 02:08:17,639 create different attributes for the 2893 02:08:17,639 --> 02:08:18,880 metrics 2894 02:08:18,880 --> 02:08:21,840 collection the first one will be a 2895 02:08:21,840 --> 02:08:25,199 string of search term so let's say 2896 02:08:25,199 --> 02:08:27,639 search term let's say that it can have 2897 02:08:27,639 --> 02:08:30,840 maybe 1,000 characters and let's make it 2898 02:08:30,840 --> 02:08:33,679 required after that we'll do an integer 2899 02:08:33,679 --> 02:08:34,760 of 2900 02:08:34,760 --> 02:08:38,360 count it won't be required and we don't 2901 02:08:38,360 --> 02:08:40,920 need to enter the Min and Max size but 2902 02:08:40,920 --> 02:08:43,360 the default can be set to zero so this 2903 02:08:43,360 --> 02:08:46,119 is how many times has a user searched 2904 02:08:46,119 --> 02:08:48,880 for each specific movie or rather for a 2905 02:08:48,880 --> 02:08:50,599 specific search term let's also create 2906 02:08:50,599 --> 02:08:54,079 another attribute of a type URL and call 2907 02:08:54,079 --> 02:08:57,760 it poster URL I'll make it 2908 02:08:57,760 --> 02:09:00,360 required so we can store the poster of 2909 02:09:00,360 --> 02:09:02,599 the movie that people are searching for 2910 02:09:02,599 --> 02:09:05,960 we can also save an integer called 2911 02:09:05,960 --> 02:09:07,719 moviecore 2912 02:09:07,719 --> 02:09:10,639 ID and I'll make it 2913 02:09:10,639 --> 02:09:13,280 required and finally we want to save the 2914 02:09:13,280 --> 02:09:15,599 title of the movie people are searching 2915 02:09:15,599 --> 02:09:19,040 for I'll enter the size of 1,000 better 2916 02:09:19,040 --> 02:09:21,000 to have more than less and I'll make it 2917 02:09:21,000 --> 02:09:23,199 requireed 2918 02:09:23,199 --> 02:09:25,440 great and now we just want to make sure 2919 02:09:25,440 --> 02:09:27,400 that we give this collection all the 2920 02:09:27,400 --> 02:09:29,559 necessary permissions to be able to 2921 02:09:29,559 --> 02:09:32,360 update it so head over to settings 2922 02:09:32,360 --> 02:09:36,159 scroll down to permissions and click any 2923 02:09:36,159 --> 02:09:39,360 and tick create read update and delete 2924 02:09:39,360 --> 02:09:41,320 this is the easiest way to do it just to 2925 02:09:41,320 --> 02:09:42,480 make sure that we don't have any 2926 02:09:42,480 --> 02:09:44,599 permission errors now we just want to 2927 02:09:44,599 --> 02:09:46,599 make sure that we can read any kind of 2928 02:09:46,599 --> 02:09:49,840 value from aight so to be able to do it 2929 02:09:49,840 --> 02:09:52,719 let's create a new file within 2930 02:09:52,719 --> 02:09:56,440 services and let's call it 2931 02:09:56,440 --> 02:10:00,000 aight. TS within it we'll Implement two 2932 02:10:00,000 --> 02:10:03,280 functions the first function will track 2933 02:10:03,280 --> 02:10:04,440 the 2934 02:10:04,440 --> 02:10:08,079 searches made by a user it'll have to 2935 02:10:08,079 --> 02:10:10,480 accept two different params so let's 2936 02:10:10,480 --> 02:10:13,679 Cote it out export 2937 02:10:13,679 --> 02:10:18,559 const update search count and let's make 2938 02:10:18,559 --> 02:10:21,320 it equal to an asynchronous function 2939 02:10:21,320 --> 02:10:24,040 that accepts two different props the 2940 02:10:24,040 --> 02:10:26,800 query of a type string so what the user 2941 02:10:26,800 --> 02:10:28,920 is searching for and then the first 2942 02:10:28,920 --> 02:10:32,119 movie that matches that search query so 2943 02:10:32,119 --> 02:10:35,320 I'll say movie of a type movie then we 2944 02:10:35,320 --> 02:10:37,920 have to perform a couple of steps we 2945 02:10:37,920 --> 02:10:41,719 have to call the aight API to browse the 2946 02:10:41,719 --> 02:10:44,320 database and check if a document already 2947 02:10:44,320 --> 02:10:47,360 exists for the given search term so 2948 02:10:47,360 --> 02:10:52,000 check if a record of that search has 2949 02:10:52,000 --> 02:10:54,239 already been 2950 02:10:54,239 --> 02:10:57,760 stored then if a document is found 2951 02:10:57,760 --> 02:11:01,760 simply increment the Search Count 2952 02:11:01,760 --> 02:11:05,159 field but if no document is 2953 02:11:05,159 --> 02:11:07,880 found in that case it means that it's a 2954 02:11:07,880 --> 02:11:10,159 new search term so we want to create a 2955 02:11:10,159 --> 02:11:12,840 new document in aight 2956 02:11:12,840 --> 02:11:15,400 database and then we want to initialize 2957 02:11:15,400 --> 02:11:17,960 its count to one so how would that look 2958 02:11:17,960 --> 02:11:20,480 in practice well something like this 2959 02:11:20,480 --> 02:11:22,159 first we want to check everything that 2960 02:11:22,159 --> 02:11:24,840 we have in our app database by saying 2961 02:11:24,840 --> 02:11:30,119 const result is equal to a weit and now 2962 02:11:30,119 --> 02:11:33,159 we have to call the aight database but 2963 02:11:33,159 --> 02:11:35,239 before calling it we actually have to 2964 02:11:35,239 --> 02:11:38,440 set it up to be able to make that call 2965 02:11:38,440 --> 02:11:40,880 that looks something like this we can 2966 02:11:40,880 --> 02:11:43,719 first Define our environment variables 2967 02:11:43,719 --> 02:11:47,800 by saying const database unor ID is 2968 02:11:47,800 --> 02:11:50,000 equal to the variable coming from 2969 02:11:50,000 --> 02:11:55,159 environment variables process. env. exop 2970 02:11:55,159 --> 02:12:00,040 public aight database ID and make sure 2971 02:12:00,040 --> 02:12:02,559 you don't have a typo like I do right 2972 02:12:02,559 --> 02:12:05,440 here and at the end of that line you can 2973 02:12:05,440 --> 02:12:07,480 add an exclamation mark which tells 2974 02:12:07,480 --> 02:12:09,760 typescript that we know that this value 2975 02:12:09,760 --> 02:12:11,719 will be there because it cannot know 2976 02:12:11,719 --> 02:12:14,880 what we have within our envs but we do 2977 02:12:14,880 --> 02:12:18,599 know it and I'll also create another one 2978 02:12:18,599 --> 02:12:22,440 const collection ID will be equal to 2979 02:12:22,440 --> 02:12:28,159 process. env. Expo public aight 2980 02:12:28,159 --> 02:12:29,760 collection 2981 02:12:29,760 --> 02:12:34,119 ID just like this now we can set up a 2982 02:12:34,119 --> 02:12:38,000 new aight client const client is equal 2983 02:12:38,000 --> 02:12:40,239 to new 2984 02:12:40,239 --> 02:12:43,159 client and make sure to import this 2985 02:12:43,159 --> 02:12:46,599 client coming from react native app 2986 02:12:46,599 --> 02:12:48,880 right and we want to call a method 2987 02:12:48,880 --> 02:12:51,800 called set endpoint on it to which we 2988 02:12:51,800 --> 02:12:56,520 want to pass the default aight endpoint 2989 02:12:56,520 --> 02:12:59,040 https 2990 02:12:59,040 --> 02:13:02,079 colon cloud. 2991 02:13:02,079 --> 02:13:03,960 aight. 2992 02:13:03,960 --> 02:13:06,199 slv1 and we want to 2993 02:13:06,199 --> 02:13:09,880 choose our project by passing the ID of 2994 02:13:09,880 --> 02:13:14,040 our project that is the process. env. 2995 02:13:14,040 --> 02:13:21,599 Expo public aite project ID perfect so 2996 02:13:21,599 --> 02:13:24,360 now we have our aight client and we are 2997 02:13:24,360 --> 02:13:27,880 ready to set up our database instance 2998 02:13:27,880 --> 02:13:30,599 belonging to that aight client by saying 2999 02:13:30,599 --> 02:13:36,520 cons database is equal to new 3000 02:13:36,520 --> 02:13:39,199 databases this is coming from aight so 3001 02:13:39,199 --> 02:13:41,920 make sure to import it and to it you can 3002 02:13:41,920 --> 02:13:43,639 pass the client that we want to 3003 02:13:43,639 --> 02:13:46,000 initialize this database on once you do 3004 02:13:46,000 --> 02:13:48,679 that we can go back to where we were 3005 02:13:48,679 --> 02:13:52,559 result is equal to await 3006 02:13:52,559 --> 02:13:56,000 database. list 3007 02:13:56,000 --> 02:13:58,679 documents and you want to pass in a 3008 02:13:58,679 --> 02:14:01,360 couple of things first is the database 3009 02:14:01,360 --> 02:14:03,719 ID within which we want to list the 3010 02:14:03,719 --> 02:14:06,360 documents then we have to specify within 3011 02:14:06,360 --> 02:14:08,280 which collection do we want to fetch it 3012 02:14:08,280 --> 02:14:11,480 collection ID and then you want to pass 3013 02:14:11,480 --> 02:14:16,000 the actual query so query. equal and we 3014 02:14:16,000 --> 02:14:18,880 want to match the search term with the 3015 02:14:18,880 --> 02:14:21,679 query that the user is currently passing 3016 02:14:21,679 --> 02:14:23,960 and of course this query is also coming 3017 02:14:23,960 --> 02:14:26,719 from react native aight oh and make sure 3018 02:14:26,719 --> 02:14:28,800 to put it within an array not within an 3019 02:14:28,800 --> 02:14:30,960 object because there can be multiple 3020 02:14:30,960 --> 02:14:33,840 queries or multiple criteria that we're 3021 02:14:33,840 --> 02:14:36,559 searching or listing the items by so 3022 02:14:36,559 --> 02:14:39,040 let's go ahead and conso log the result 3023 02:14:39,040 --> 02:14:41,679 and before we try to get back any result 3024 02:14:41,679 --> 02:14:43,480 let's make sure to reload our 3025 02:14:43,480 --> 02:14:46,159 application by stopping it from running 3026 02:14:46,159 --> 02:14:49,000 and then rerunning MPX Expo start when 3027 02:14:49,000 --> 02:14:50,719 you change your environment variables 3028 02:14:50,719 --> 02:14:52,679 you you might want to always reload it 3029 02:14:52,679 --> 02:14:54,280 just to make sure the changes are taken 3030 02:14:54,280 --> 02:14:57,800 into account so I ran the application 3031 02:14:57,800 --> 02:15:00,000 and now back on the search page we want 3032 02:15:00,000 --> 02:15:01,920 to call this update Search Count 3033 02:15:01,920 --> 02:15:04,760 function so let's head over into search 3034 02:15:04,760 --> 02:15:08,599 within tabs and I'll add it for now just 3035 02:15:08,599 --> 02:15:11,639 here at the top of this use effect call 3036 02:15:11,639 --> 02:15:15,000 the update search count and make sure to 3037 02:15:15,000 --> 02:15:18,599 import it from Services aight if you do 3038 02:15:18,599 --> 02:15:21,000 it properly and navigate over to the 3039 02:15:21,000 --> 02:15:23,199 search function you won't be able to see 3040 02:15:23,199 --> 02:15:26,920 anything yet but if you pass the search 3041 02:15:26,920 --> 02:15:29,239 query into the update Search Count 3042 02:15:29,239 --> 02:15:33,000 function as well as the movies zero so 3043 02:15:33,000 --> 02:15:34,920 the first movie that you get back for 3044 02:15:34,920 --> 02:15:36,400 that search 3045 02:15:36,400 --> 02:15:38,960 query you'll see that you'll get back 3046 02:15:38,960 --> 02:15:42,320 documents zero total zero which means 3047 02:15:42,320 --> 02:15:44,360 that we're successfully accessing the 3048 02:15:44,360 --> 02:15:46,760 app right database but there's nothing 3049 02:15:46,760 --> 02:15:48,960 to be fetched yet this is good this is 3050 02:15:48,960 --> 02:15:50,679 the only thing we wanted to see for now 3051 02:15:50,679 --> 02:15:52,719 and if you don't yet see it that's okay 3052 02:15:52,719 --> 02:15:55,599 don't worry about it now we'll actually 3053 02:15:55,599 --> 02:15:58,159 create our first document and then we'll 3054 02:15:58,159 --> 02:16:02,000 be able to fetch it so now we have to 3055 02:16:02,000 --> 02:16:04,639 check if a record of that search has 3056 02:16:04,639 --> 02:16:08,199 already been stored so I'll say if 3057 02:16:08,199 --> 02:16:12,559 result. documents. length is greater 3058 02:16:12,559 --> 02:16:15,840 than zero then we want to search for the 3059 02:16:15,840 --> 02:16:20,239 existing movie so con existing movie is 3060 02:16:20,239 --> 02:16:23,639 equal to 3061 02:16:23,639 --> 02:16:27,400 result. documents zero so this is the 3062 02:16:27,400 --> 02:16:29,079 top movie that shows for that search 3063 02:16:29,079 --> 02:16:32,840 term in that case we want to say await 3064 02:16:32,840 --> 02:16:36,240 database. update document so if the 3065 02:16:36,240 --> 02:16:38,478 movie already exists and we need to pass 3066 02:16:38,478 --> 02:16:41,718 it the database ID to be able to know 3067 02:16:41,718 --> 02:16:44,478 within which database to update within 3068 02:16:44,478 --> 02:16:46,478 which collection to update and then 3069 02:16:46,478 --> 02:16:49,040 finally the ID that we want to update 3070 02:16:49,040 --> 02:16:51,398 that's going to be existing movie do 3071 02:16:51,398 --> 02:16:54,200 dollar sign ID and finally what do we 3072 02:16:54,200 --> 02:16:56,359 want to change well we want to set the 3073 02:16:56,359 --> 02:17:00,519 count to be equal to existing movie. 3074 02:17:00,519 --> 02:17:03,959 count + one because some other user has 3075 02:17:03,959 --> 02:17:06,398 already searched for it before else if a 3076 02:17:06,398 --> 02:17:08,799 movie doesn't yet exist then we can just 3077 02:17:08,799 --> 02:17:12,318 create that metric by saying a wait 3078 02:17:12,318 --> 02:17:15,959 database. create document within our 3079 02:17:15,959 --> 02:17:19,558 database ID within this specific 3080 02:17:19,558 --> 02:17:21,799 collection ID 3081 02:17:21,799 --> 02:17:24,920 and we also want to give it a unique ID 3082 02:17:24,920 --> 02:17:27,879 so say ID and import it from react 3083 02:17:27,879 --> 02:17:30,519 native app right do 3084 02:17:30,519 --> 02:17:33,439 unique so we're now creating a new 3085 02:17:33,439 --> 02:17:35,920 document in our aight database that will 3086 02:17:35,920 --> 02:17:38,519 allow us to store the searches that 3087 02:17:38,519 --> 02:17:41,280 people have entered and we can then 3088 02:17:41,280 --> 02:17:44,040 Define an object of how that record or 3089 02:17:44,040 --> 02:17:47,359 document in the data base will look like 3090 02:17:47,359 --> 02:17:50,280 and we can say search term will be equal 3091 02:17:50,280 --> 02:17:51,959 to query 3092 02:17:51,959 --> 02:17:54,478 moviecore ID so the first movie that 3093 02:17:54,478 --> 02:17:58,200 shows up will be the movie. ID the count 3094 02:17:58,200 --> 02:18:00,718 will be set to one by default and the 3095 02:18:00,718 --> 02:18:03,679 poster URL of that movie will be equal 3096 02:18:03,679 --> 02:18:05,120 to 3097 02:18:05,120 --> 02:18:07,439 https col and 3098 02:18:07,439 --> 02:18:21,240 forward image. tmb.jpg 3099 02:18:21,240 --> 02:18:23,478 similar to what we did on the homepage 3100 02:18:23,478 --> 02:18:25,478 or rather in the movie card and we can 3101 02:18:25,478 --> 02:18:28,200 put all of this within a tri block 3102 02:18:28,200 --> 02:18:29,920 everything from where we're trying to 3103 02:18:29,920 --> 02:18:34,120 get this result try to do this 3104 02:18:34,120 --> 02:18:36,398 everything we have here so let me close 3105 02:18:36,398 --> 02:18:40,439 it there we go and then catch if 3106 02:18:40,439 --> 02:18:42,840 something goes wrong well that must mean 3107 02:18:42,840 --> 02:18:45,359 that we have an error so simply 3108 02:18:45,359 --> 02:18:49,000 console.log the error message as well as 3109 02:18:49,000 --> 02:18:51,599 throw the error 3110 02:18:51,599 --> 02:18:53,920 great so with this code we should be 3111 02:18:53,920 --> 02:18:56,200 successfully updating the ight database 3112 02:18:56,200 --> 02:18:58,478 to store the metric of what the user has 3113 02:18:58,478 --> 02:19:01,120 searched so let's head back over into 3114 02:19:01,120 --> 02:19:04,120 the search and right below where we say 3115 02:19:04,120 --> 02:19:06,558 await load movies that means that the 3116 02:19:06,558 --> 02:19:10,120 search has actually been made check if 3117 02:19:10,120 --> 02:19:12,879 movies question mark. length is greater 3118 02:19:12,879 --> 02:19:14,040 than 3119 02:19:14,040 --> 02:19:19,478 zero and if movies question mark. Z 3120 02:19:19,478 --> 02:19:23,840 exists then we can await update Search 3121 02:19:23,840 --> 02:19:26,959 Count pass the search query as well as 3122 02:19:26,959 --> 02:19:29,840 the movies zero if I zoom it out that'll 3123 02:19:29,840 --> 02:19:32,519 look something like this so now let me 3124 02:19:32,519 --> 02:19:34,959 show you how that works I'll go ahead 3125 02:19:34,959 --> 02:19:39,080 and search for something like Avengers 3126 02:19:39,080 --> 02:19:40,959 and the first movie that shows up is 3127 02:19:40,959 --> 02:19:43,599 Avengers Infinity War I'll search one 3128 02:19:43,599 --> 02:19:46,200 more time for Iron Man for example I'm 3129 02:19:46,200 --> 02:19:48,519 want to roll with these superhero movies 3130 02:19:48,519 --> 02:19:49,840 and again please let me know which 3131 02:19:49,840 --> 02:19:51,680 movies do you like you can let me know 3132 02:19:51,680 --> 02:19:53,600 in the comments below this lesson and 3133 02:19:53,600 --> 02:19:55,399 I'll Search for 3134 02:19:55,399 --> 02:19:58,720 Avengers one more time just to replicate 3135 02:19:58,720 --> 02:20:01,000 as if some other user has searched for 3136 02:20:01,000 --> 02:20:03,359 that search term as well now we can head 3137 02:20:03,359 --> 02:20:05,920 back over into the database head into 3138 02:20:05,920 --> 02:20:09,479 movies metrics oh and I don't see any 3139 02:20:09,479 --> 02:20:12,880 documents yet that's interesting oh 3140 02:20:12,880 --> 02:20:14,800 check this out missing required 3141 02:20:14,800 --> 02:20:17,800 attribute title so back in app right 3142 02:20:17,800 --> 02:20:19,960 where we're creating a new document we 3143 02:20:19,960 --> 02:20:22,840 want to actually pass the title equal to 3144 02:20:22,840 --> 02:20:26,240 movie. tile so we can store that as well 3145 02:20:26,240 --> 02:20:28,120 oh that was my bad but thankfully we 3146 02:20:28,120 --> 02:20:30,000 were getting some logs 3147 02:20:30,000 --> 02:20:33,720 back now if I go ahead and and restart 3148 02:20:33,720 --> 02:20:36,120 this search and go back and 3149 02:20:36,120 --> 02:20:39,640 reload immediately a new document has 3150 02:20:39,640 --> 02:20:42,680 been added to the database Avengers 3151 02:20:42,680 --> 02:20:46,319 count one with the stored poster URL the 3152 02:20:46,319 --> 02:20:49,080 movie ID and the title so this means 3153 02:20:49,080 --> 02:20:51,200 that right now this is the top searched 3154 02:20:51,200 --> 02:20:53,800 movie now if I go ahead and search for 3155 02:20:53,800 --> 02:20:55,840 something like 3156 02:20:55,840 --> 02:20:59,359 Avatar and reload right here check this 3157 02:20:59,359 --> 02:21:01,640 out in our permanent data storage we're 3158 02:21:01,640 --> 02:21:04,800 now getting back two different documents 3159 02:21:04,800 --> 02:21:06,920 and now if another user goes ahead and 3160 02:21:06,920 --> 02:21:08,840 searches for 3161 02:21:08,840 --> 02:21:11,880 Avengers oh I misspelt it that's okay 3162 02:21:11,880 --> 02:21:15,560 there we go now this count should update 3163 02:21:15,560 --> 02:21:19,200 to two oh but it didn't it is still one 3164 02:21:19,200 --> 02:21:21,240 but let me try one more time maybe it 3165 02:21:21,240 --> 02:21:23,640 didn't send out the request I'll remove 3166 02:21:23,640 --> 02:21:27,479 1 s Avenger and I'll re it right now to 3167 02:21:27,479 --> 02:21:31,640 rep. search and if I reload you can see 3168 02:21:31,640 --> 02:21:34,040 that even the Avenger and then Avengers 3169 02:21:34,040 --> 02:21:37,200 gets added so we have the count of two 3170 02:21:37,200 --> 02:21:39,960 if I remove it and if I search for it 3171 02:21:39,960 --> 02:21:44,760 one more time and 3172 02:21:44,760 --> 02:21:47,520 reload now we're looking at the count of 3173 02:21:47,520 --> 02:21:50,000 three this is great it means we're 3174 02:21:50,000 --> 02:21:52,319 actually storing the data of the top 3175 02:21:52,319 --> 02:21:54,359 trending movies that The users are 3176 02:21:54,359 --> 02:21:56,960 searching for within our app so in the 3177 02:21:56,960 --> 02:21:59,080 next lesson let's go ahead and display 3178 02:21:59,080 --> 02:22:01,280 them at the 3179 02:22:01,280 --> 02:22:04,960 top in this lesson we'll first create a 3180 02:22:04,960 --> 02:22:07,800 function that queries the aight database 3181 02:22:07,800 --> 02:22:10,200 to retrieve the top movies our users 3182 02:22:10,200 --> 02:22:12,080 have searched for and then we'll display 3183 02:22:12,080 --> 02:22:15,000 it in a cool Netflix like Carousel at 3184 02:22:15,000 --> 02:22:17,479 the top so first things first let's 3185 02:22:17,479 --> 02:22:19,479 collapse this update Search Count 3186 02:22:19,479 --> 02:22:23,479 function I'll zoom out a bit and right 3187 02:22:23,479 --> 02:22:27,319 beneath it create a new function export 3188 02:22:27,319 --> 02:22:32,600 const get trending movies it'll be equal 3189 02:22:32,600 --> 02:22:35,000 to an asynchronous function and this one 3190 02:22:35,000 --> 02:22:37,520 doesn't have to get any props but it'll 3191 02:22:37,520 --> 02:22:41,960 just return a single promise of trending 3192 02:22:41,960 --> 02:22:46,640 movie array just like this or undefined 3193 02:22:46,640 --> 02:22:48,880 in case something goes wrong so here we 3194 02:22:48,880 --> 02:22:52,160 can open up a try and catch 3195 02:22:52,160 --> 02:22:55,680 Block in the catch if there's an error 3196 02:22:55,680 --> 02:22:59,000 we'll simply console log that 3197 02:22:59,000 --> 02:23:02,760 error and return undefined but in the 3198 02:23:02,760 --> 02:23:05,640 try we'll actually try to list out those 3199 02:23:05,640 --> 02:23:07,920 documents and we have already done that 3200 02:23:07,920 --> 02:23:10,200 at the top of the update search count 3201 02:23:10,200 --> 02:23:12,280 because to update we first have to fetch 3202 02:23:12,280 --> 02:23:16,000 them so let me copy this starting part 3203 02:23:16,000 --> 02:23:19,800 and paste it here con result is equal to 3204 02:23:19,800 --> 02:23:23,720 a wait database. list documents database 3205 02:23:23,720 --> 02:23:27,920 ID collection ID and this time I'll say 3206 02:23:27,920 --> 02:23:31,720 query. limit to five so we only want to 3207 02:23:31,720 --> 02:23:35,200 get the first five elements and query. 3208 02:23:35,200 --> 02:23:39,640 Order descending based on the count 3209 02:23:39,640 --> 02:23:43,319 field so we only want to show the top 3210 02:23:43,319 --> 02:23:45,319 five movies that people have searched 3211 02:23:45,319 --> 02:23:49,640 for sorted by the count and we can say 3212 02:23:49,640 --> 02:23:51,040 return 3213 02:23:51,040 --> 02:23:53,520 result. documents just to make 3214 02:23:53,520 --> 02:23:56,160 typescript happy we can say as 3215 02:23:56,160 --> 02:24:01,439 unknown as trending movie array this way 3216 02:24:01,439 --> 02:24:03,399 tab script will know exactly what we're 3217 02:24:03,399 --> 02:24:06,240 returning next we can call this function 3218 02:24:06,240 --> 02:24:09,160 within our homepage so head over into 3219 02:24:09,160 --> 02:24:10,560 index. 3220 02:24:10,560 --> 02:24:13,200 TSX I'll Zoom it out once again so you 3221 02:24:13,200 --> 02:24:16,439 can see a bit better and right above the 3222 02:24:16,439 --> 02:24:19,080 first use fetch call we're going to add 3223 02:24:19,080 --> 02:24:22,680 the second const we know how it works 3224 02:24:22,680 --> 02:24:26,000 you can call it use fetch but this time 3225 02:24:26,000 --> 02:24:29,760 to it we're going to pass the get 3226 02:24:29,760 --> 02:24:33,720 trending movies instead of fetch movies 3227 02:24:33,720 --> 02:24:36,520 and we get back the same things the data 3228 02:24:36,520 --> 02:24:38,120 which this time we can rename to 3229 02:24:38,120 --> 02:24:41,439 trending movies the loading which we can 3230 02:24:41,439 --> 02:24:44,399 rename to trending loading as well as 3231 02:24:44,399 --> 02:24:47,279 the error which we can rename to 3232 02:24:47,279 --> 02:24:50,359 trending error now just below where we 3233 02:24:50,359 --> 02:24:51,920 we have the activity 3234 02:24:51,920 --> 02:24:54,680 indicator we can say if movies 3235 02:24:54,680 --> 02:24:58,520 loading or trending loading and same for 3236 02:24:58,520 --> 02:25:03,120 the error if there is movies error or if 3237 02:25:03,120 --> 02:25:05,840 there is trending error show an error 3238 02:25:05,840 --> 02:25:08,960 that error can be movies error or maybe 3239 02:25:08,960 --> 02:25:12,359 it is trending error question mark. 3240 02:25:12,359 --> 02:25:15,040 message here to the search bar we don't 3241 02:25:15,040 --> 02:25:16,560 have to pass the value because we're 3242 02:25:16,560 --> 02:25:19,240 searching within the search page so we 3243 02:25:19,240 --> 02:25:22,359 can make this value optional right here 3244 02:25:22,359 --> 02:25:24,359 and what else is optional on press 3245 02:25:24,359 --> 02:25:27,200 placeholder what are we missing on 3246 02:25:27,200 --> 02:25:29,960 change text yeah we don't need it right 3247 02:25:29,960 --> 02:25:33,160 here in the homepage next right below 3248 02:25:33,160 --> 02:25:37,160 the search bar I'll say if trending 3249 02:25:37,160 --> 02:25:41,560 movies exist so if trending movies then 3250 02:25:41,560 --> 02:25:43,520 show a 3251 02:25:43,520 --> 02:25:48,000 view this view will have a class name 3252 02:25:48,000 --> 02:25:51,560 equal to margin top of 10 3253 02:25:51,560 --> 02:25:54,080 and we'll render a text 3254 02:25:54,080 --> 02:25:57,800 element that will say trending 3255 02:25:57,800 --> 02:26:00,200 movies of course let's go ahead and give 3256 02:26:00,200 --> 02:26:02,840 it a class name so we can see it of 3257 02:26:02,840 --> 02:26:07,960 text- LG as well as text- white font 3258 02:26:07,960 --> 02:26:11,040 Dash bold and margin bottom of three 3259 02:26:11,040 --> 02:26:13,000 let's open up our terminal and reload 3260 02:26:13,000 --> 02:26:13,760 the 3261 02:26:13,760 --> 02:26:16,439 app just to see where we are sometimes 3262 02:26:16,439 --> 02:26:18,800 it gets stuck so you have to reload it 3263 02:26:18,800 --> 02:26:20,920 you know that by now don't you and now 3264 02:26:20,920 --> 02:26:22,880 you can see trending movies title right 3265 02:26:22,880 --> 02:26:25,120 here below the search so how are we 3266 02:26:25,120 --> 02:26:27,920 going to render the trending movies well 3267 02:26:27,920 --> 02:26:30,520 believe it or not it's going to be a new 3268 02:26:30,520 --> 02:26:32,920 flat list to which we can pass the 3269 02:26:32,920 --> 02:26:34,240 trending 3270 02:26:34,240 --> 02:26:38,319 movies as the data and I'll pass the 3271 02:26:38,319 --> 02:26:41,960 render item to be equal to as before 3272 02:26:41,960 --> 02:26:44,960 we'll destructure the item as well as 3273 02:26:44,960 --> 02:26:47,319 the index from this function and then 3274 02:26:47,319 --> 02:26:50,680 for each item for now I'll s simply 3275 02:26:50,680 --> 02:26:54,000 return the item. tile but of course we 3276 02:26:54,000 --> 02:26:56,040 have to put it within a text so let me 3277 02:26:56,040 --> 02:26:59,240 actually expand this and return a text 3278 02:26:59,240 --> 02:27:02,120 element within which I'll render the 3279 02:27:02,120 --> 02:27:03,439 item. 3280 02:27:03,439 --> 02:27:06,600 tile and let's give it a class name 3281 02:27:06,600 --> 02:27:11,640 equal to text- White text DSM just so we 3282 02:27:11,640 --> 02:27:14,439 can see it now if we properly close this 3283 02:27:14,439 --> 02:27:17,200 flat list you'll be able to see three 3284 02:27:17,200 --> 02:27:19,920 top movies Avengers Infinity war three 3285 02:27:19,920 --> 02:27:22,479 times let's style it a bit by giving it 3286 02:27:22,479 --> 02:27:25,920 a class name of margin bottom of four 3287 02:27:25,920 --> 02:27:28,439 and margin top of three and I'll put 3288 02:27:28,439 --> 02:27:30,520 each one of these props in a new line 3289 02:27:30,520 --> 02:27:31,960 just so it's easier to see what's 3290 02:27:31,960 --> 02:27:36,680 happening there we go data render item 3291 02:27:36,680 --> 02:27:39,120 and then we render a text below render 3292 02:27:39,120 --> 02:27:41,960 item we'll have the key extractor it is 3293 02:27:41,960 --> 02:27:45,040 a mandatory thing where we get access to 3294 02:27:45,040 --> 02:27:49,080 the item and the ID will be coming from 3295 02:27:49,080 --> 02:27:54,000 item do movor id. TW string and 3296 02:27:54,000 --> 02:27:56,439 currently the top three movies all seem 3297 02:27:56,439 --> 02:27:58,920 to be Avengers Infinity War I guess 3298 02:27:58,920 --> 02:28:01,319 that's because for all three of these it 3299 02:28:01,319 --> 02:28:03,319 saved that as the title let me actually 3300 02:28:03,319 --> 02:28:05,800 delete those documents and let's try it 3301 02:28:05,800 --> 02:28:08,359 one more time now there should be no 3302 02:28:08,359 --> 02:28:09,359 latest 3303 02:28:09,359 --> 02:28:12,720 movies so now if I reload my application 3304 02:28:12,720 --> 02:28:15,000 once again right off the bat you'll see 3305 02:28:15,000 --> 02:28:17,200 an error right here saying that 3306 02:28:17,200 --> 02:28:19,840 virtualized lists should never be nested 3307 02:28:19,840 --> 02:28:22,520 into inside plain scroll views with the 3308 02:28:22,520 --> 02:28:25,240 same orientation because it can break 3309 02:28:25,240 --> 02:28:27,640 windowing and other functionality what 3310 02:28:27,640 --> 02:28:29,760 this means is that we cannot have at 3311 02:28:29,760 --> 02:28:32,479 least not the list with the same 3312 02:28:32,479 --> 02:28:34,520 orientation but don't worry about that 3313 02:28:34,520 --> 02:28:36,680 for now because very soon we'll change 3314 02:28:36,680 --> 02:28:38,760 the orientation of this flat list to 3315 02:28:38,760 --> 02:28:40,760 horizontal because that'll make it look 3316 02:28:40,760 --> 02:28:43,200 more like this so for now if I go back 3317 02:28:43,200 --> 02:28:46,960 to my app go to search and try with 3318 02:28:46,960 --> 02:28:50,240 something like Avatar and then I delete 3319 02:28:50,240 --> 02:28:53,399 that and maybe search for alien okay and 3320 02:28:53,399 --> 02:28:56,160 now if I go back to aight looks like the 3321 02:28:56,160 --> 02:28:58,520 metrics are not getting added so let's 3322 02:28:58,520 --> 02:29:00,840 debug it together I love it when 3323 02:29:00,840 --> 02:29:02,560 something obvious doesn't work when I'm 3324 02:29:02,560 --> 02:29:04,200 recording because it gives me the 3325 02:29:04,200 --> 02:29:06,680 opportunity to go back into the code and 3326 02:29:06,680 --> 02:29:08,080 I think that sometimes you can learn 3327 02:29:08,080 --> 02:29:10,439 more that way than just watching me code 3328 02:29:10,439 --> 02:29:12,399 everything out because you can see 3329 02:29:12,399 --> 02:29:14,680 exactly how I would approach the 3330 02:29:14,680 --> 02:29:17,120 debugging process first we have to ask 3331 02:29:17,120 --> 02:29:19,800 ourselves where is the error coming from 3332 02:29:19,800 --> 02:29:21,640 in this case we know that the documents 3333 02:29:21,640 --> 02:29:23,240 are not getting added to the ight 3334 02:29:23,240 --> 02:29:25,399 database so we have to ask ourselves 3335 02:29:25,399 --> 02:29:28,000 where is that within our code and that 3336 02:29:28,000 --> 02:29:30,160 is within the search page so if you head 3337 02:29:30,160 --> 02:29:32,200 over to the search page you'll see that 3338 02:29:32,200 --> 02:29:35,240 we have a single use effect now within 3339 02:29:35,240 --> 02:29:37,960 this use effect we have both await load 3340 02:29:37,960 --> 02:29:41,160 movies as well as update search count 3341 02:29:41,160 --> 02:29:43,720 and these two can race together and we 3342 02:29:43,720 --> 02:29:45,880 never get back the meaningful results so 3343 02:29:45,880 --> 02:29:48,080 we have to split them into two separate 3344 02:29:48,080 --> 02:29:51,120 use effects so I'll I'll copy this if 3345 02:29:51,120 --> 02:29:53,640 statement and within this first use 3346 02:29:53,640 --> 02:29:55,720 effect that gets executed whenever the 3347 02:29:55,720 --> 02:29:58,680 search query gets changed here we just 3348 02:29:58,680 --> 02:30:00,560 want to await load 3349 02:30:00,560 --> 02:30:03,600 movies but in the second one that I'll 3350 02:30:03,600 --> 02:30:06,399 create right now use effect where we 3351 02:30:06,399 --> 02:30:09,319 have a callback function this one will 3352 02:30:09,319 --> 02:30:12,760 change whenever the movies themselves 3353 02:30:12,760 --> 02:30:15,840 change and here we want to check if 3354 02:30:15,840 --> 02:30:18,359 movies do length is greater than zero 3355 02:30:18,359 --> 02:30:21,000 and if movie first EX exists then we 3356 02:30:21,000 --> 02:30:23,319 want to open up a codee block here and 3357 02:30:23,319 --> 02:30:25,439 we can simply call the update Search 3358 02:30:25,439 --> 02:30:28,080 Count without the use effect like this 3359 02:30:28,080 --> 02:30:30,920 now if we go ahead and search for 3360 02:30:30,920 --> 02:30:33,359 something like Avatar we'll get back the 3361 02:30:33,359 --> 02:30:35,720 movies I'll go ahead and search for 3362 02:30:35,720 --> 02:30:39,120 something like let's do 3363 02:30:39,120 --> 02:30:42,080 cats there we go and if I head back to 3364 02:30:42,080 --> 02:30:44,279 aight you'll see that we have two 3365 02:30:44,279 --> 02:30:46,439 different movies stored right here we 3366 02:30:46,439 --> 02:30:48,680 might as well go for the third one so 3367 02:30:48,680 --> 02:30:51,600 I'll go with iron 3368 02:30:51,600 --> 02:30:56,200 man there we go looking good and if I 3369 02:30:56,200 --> 02:30:58,960 reload it gets saved and of course what 3370 02:30:58,960 --> 02:31:01,279 we care about is what if another user 3371 02:31:01,279 --> 02:31:03,720 searches for a similar movie so if 3372 02:31:03,720 --> 02:31:06,399 another user searches for avatar for 3373 02:31:06,399 --> 02:31:10,000 example there we go does the count get 3374 02:31:10,000 --> 02:31:13,960 updated and this time it does so now if 3375 02:31:13,960 --> 02:31:16,439 we go back to the homepage and head back 3376 02:31:16,439 --> 02:31:19,000 over here where we're trying to show a 3377 02:31:19,000 --> 02:31:22,600 flat list of the top movies let me just 3378 02:31:22,600 --> 02:31:24,800 make sure to reload the page you can see 3379 02:31:24,800 --> 02:31:27,160 that right here we get three different 3380 02:31:27,160 --> 02:31:30,080 movies Avatar cats and Iron Man which is 3381 02:31:30,080 --> 02:31:32,040 great that means that our trending 3382 02:31:32,040 --> 02:31:34,640 functionality is kind of working but of 3383 02:31:34,640 --> 02:31:36,840 course we have to improve it further 3384 02:31:36,840 --> 02:31:39,359 check this out we can pass just a single 3385 02:31:39,359 --> 02:31:42,520 prop called horizontal and if you just 3386 02:31:42,520 --> 02:31:45,279 pass it like this and save it 3387 02:31:45,279 --> 02:31:47,960 immediately the orientation will change 3388 02:31:47,960 --> 02:31:51,319 to horizontal we can also O Say shows 3389 02:31:51,319 --> 02:31:53,800 horizontal scroll indicator and set it 3390 02:31:53,800 --> 02:31:57,080 to false and we can also render the item 3391 02:31:57,080 --> 02:31:58,240 separator 3392 02:31:58,240 --> 02:32:01,160 component and I'll make it equal to a 3393 02:32:01,160 --> 02:32:02,479 simple 3394 02:32:02,479 --> 02:32:04,479 view that is 3395 02:32:04,479 --> 02:32:07,840 self-closing and has a class name equal 3396 02:32:07,840 --> 02:32:10,720 to W of 4 now we can see that this looks 3397 02:32:10,720 --> 02:32:12,880 a bit better oh and this latest movies 3398 02:32:12,880 --> 02:32:15,200 was supposed to be just above the other 3399 02:32:15,200 --> 02:32:18,000 flat list not this one so I'll go below 3400 02:32:18,000 --> 02:32:21,000 this one and here I can paste it it says 3401 02:32:21,000 --> 02:32:23,200 latest movies and right here at the top 3402 02:32:23,200 --> 02:32:24,880 we have trending 3403 02:32:24,880 --> 02:32:28,000 movies great but of course we don't just 3404 02:32:28,000 --> 02:32:30,200 want to show three pieces of text we 3405 02:32:30,200 --> 02:32:32,840 want to show fullon cards that look like 3406 02:32:32,840 --> 02:32:35,920 this with these top trending numbers so 3407 02:32:35,920 --> 02:32:38,479 to do that let's create a new component 3408 02:32:38,479 --> 02:32:41,520 in the components folder and let me call 3409 02:32:41,520 --> 02:32:44,680 it trending 3410 02:32:44,680 --> 02:32:50,279 card. TSX run rnf to quickly create and 3411 02:32:50,279 --> 02:32:53,439 now instead of this text where we're 3412 02:32:53,439 --> 02:32:56,080 rendering the item title we can render 3413 02:32:56,080 --> 02:32:58,359 the trending card just like this a 3414 02:32:58,359 --> 02:33:01,520 self-closing trending card component to 3415 02:33:01,520 --> 02:33:04,479 which we can pass over the movie equal 3416 02:33:04,479 --> 02:33:07,200 to item this is an alternative way of 3417 02:33:07,200 --> 02:33:09,640 just spreading everything out sometimes 3418 02:33:09,640 --> 02:33:11,479 this is preferable because then you can 3419 02:33:11,479 --> 02:33:13,840 consol Lo the entire movie itself and 3420 02:33:13,840 --> 02:33:15,960 then know what properties does it have 3421 02:33:15,960 --> 02:33:17,960 and let's also pass the index of that 3422 02:33:17,960 --> 02:33:20,800 movie equal to index so we can show that 3423 02:33:20,800 --> 02:33:23,240 number now let's head over into the 3424 02:33:23,240 --> 02:33:24,800 trending card and let's get it 3425 02:33:24,800 --> 02:33:27,040 implemented as with the cards before 3426 02:33:27,040 --> 02:33:29,479 I'll wrap this card with a link because 3427 02:33:29,479 --> 02:33:30,880 we want to make sure that the entire 3428 02:33:30,880 --> 02:33:33,160 card is clickable and that it leads to 3429 02:33:33,160 --> 02:33:35,840 the movie Details page so I'll add an 3430 02:33:35,840 --> 02:33:42,800 href of SL movies SL movor ID and I'll 3431 02:33:42,800 --> 02:33:45,439 say as child because we want the entire 3432 02:33:45,439 --> 02:33:48,000 touchable opacity to be clickable so 3433 02:33:48,000 --> 02:33:50,680 it'll inherit link properties now where 3434 02:33:50,680 --> 02:33:53,520 is this movie ID coming from well we can 3435 02:33:53,520 --> 02:33:56,359 destructure the movie right here from 3436 02:33:56,359 --> 02:33:59,120 props and from the movie we can further 3437 02:33:59,120 --> 02:34:02,720 destructure the movie ID the title and 3438 02:34:02,720 --> 02:34:06,359 the poster URL and outside of this movie 3439 02:34:06,359 --> 02:34:09,319 destructuring we can also get the index 3440 02:34:09,319 --> 02:34:11,279 and we can say that all of these are of 3441 02:34:11,279 --> 02:34:15,720 a type trending card props now within 3442 02:34:15,720 --> 02:34:18,359 each link let's render a touchable 3443 02:34:18,359 --> 02:34:22,960 opacity it'll have a class name equal to 3444 02:34:22,960 --> 02:34:26,800 w-32 relative and padding left of five 3445 02:34:26,800 --> 02:34:29,120 and immediately within it we can render 3446 02:34:29,120 --> 02:34:32,960 an image this image will have a source 3447 02:34:32,960 --> 02:34:37,560 equal to URI is poster _ URL a class 3448 02:34:37,560 --> 02:34:39,600 name equal to 3449 02:34:39,600 --> 02:34:44,080 w32 h48 and rounded 3450 02:34:44,080 --> 02:34:48,800 dlg with a resize mode equal to cover 3451 02:34:48,800 --> 02:34:51,359 and there we go now you can see the 3452 02:34:51,359 --> 02:34:53,960 cover photos or the posters for the top 3453 02:34:53,960 --> 02:34:56,120 three searched movies right below it 3454 02:34:56,120 --> 02:34:59,279 I'll render another view and this view 3455 02:34:59,279 --> 02:35:01,880 will be absolutely positioned so I'll 3456 02:35:01,880 --> 02:35:04,560 give it a class name of absolute that's 3457 02:35:04,560 --> 02:35:06,920 because it'll serve as an overlay over 3458 02:35:06,920 --> 02:35:09,359 the poster so somewhere at the bottom 3459 02:35:09,359 --> 02:35:12,359 left we want to show that number 1 2 3 3460 02:35:12,359 --> 02:35:14,439 so I'll say bottom 3461 02:35:14,439 --> 02:35:17,920 D9 minus left- 3462 02:35:17,920 --> 02:35:22,720 3.5 padding X of to padding y of one and 3463 02:35:22,720 --> 02:35:25,520 the rounded -4 and now within it we want 3464 02:35:25,520 --> 02:35:27,760 to achieve some kind of a masked layout 3465 02:35:27,760 --> 02:35:29,680 I'm not sure if you can see it here but 3466 02:35:29,680 --> 02:35:32,040 the number here will be a bit masked 3467 02:35:32,040 --> 02:35:34,160 like it is under some kind of a darker 3468 02:35:34,160 --> 02:35:37,000 mask like it'll have a slight gradient 3469 02:35:37,000 --> 02:35:39,279 and we can do that using a package 3470 02:35:39,279 --> 02:35:42,120 called masked view this one right here 3471 02:35:42,120 --> 02:35:46,000 has about 265,000 downloads and as the 3472 02:35:46,000 --> 02:35:48,439 package says it creates a masked view 3473 02:35:48,439 --> 02:35:50,760 where the text appears as a cutout over 3474 02:35:50,760 --> 02:35:52,760 an image so let's simply copy the 3475 02:35:52,760 --> 02:35:55,960 installation command that is mpm install 3476 02:35:55,960 --> 02:36:00,520 at reactnative mask view slask dvw while 3477 02:36:00,520 --> 02:36:03,040 it is installing we can put it to use 3478 02:36:03,040 --> 02:36:05,439 right here within this view I'll create 3479 02:36:05,439 --> 02:36:08,680 another masked View and you have to 3480 02:36:08,680 --> 02:36:11,479 provide a mask element in this case 3481 02:36:11,479 --> 02:36:15,200 it'll be a single piece of text so I'll 3482 02:36:15,200 --> 02:36:16,720 do it right 3483 02:36:16,720 --> 02:36:19,720 here text inside of which I'll render 3484 02:36:19,720 --> 02:36:22,560 index + one so that we don't start at 3485 02:36:22,560 --> 02:36:24,920 zero we start at one of course I'll give 3486 02:36:24,920 --> 02:36:28,000 this index a class name equal to font 3487 02:36:28,000 --> 02:36:33,040 Das bold text- white and text- 6xl we 3488 02:36:33,040 --> 02:36:34,920 want to make it extra large let's fix 3489 02:36:34,920 --> 02:36:37,520 the class name spelling right here and 3490 02:36:37,520 --> 02:36:39,640 within the mask view I will render the 3491 02:36:39,640 --> 02:36:41,800 image that will have a 3492 02:36:41,800 --> 02:36:45,240 source equal to images coming from 3493 02:36:45,240 --> 02:36:49,720 constants do ranking gradient 3494 02:36:49,720 --> 02:36:53,560 with a class name of 3495 02:36:53,560 --> 02:36:58,479 size-14 and a resize mode set to cover 3496 02:36:58,479 --> 02:37:00,840 now let's fix a typo where we have it 3497 02:37:00,840 --> 02:37:04,000 there we go I think we're good and take 3498 02:37:04,000 --> 02:37:06,319 a look at these numbers right here 3499 02:37:06,319 --> 02:37:09,640 looking good 1 two 3 and if you try 3500 02:37:09,640 --> 02:37:11,840 scrolling you'll see that this one has a 3501 02:37:11,840 --> 02:37:14,399 horizontal scroll whereas you can scroll 3502 02:37:14,399 --> 02:37:17,319 the entire page up and down so before we 3503 02:37:17,319 --> 02:37:19,800 had that virtualized list error because 3504 02:37:19,800 --> 02:37:22,160 we had two vertical lists in the same 3505 02:37:22,160 --> 02:37:24,880 file or in the same screen should I say 3506 02:37:24,880 --> 02:37:27,080 but now one is horizontal and one is 3507 02:37:27,080 --> 02:37:29,720 vertical so we're good now just below 3508 02:37:29,720 --> 02:37:31,760 this view not the mask view but the 3509 02:37:31,760 --> 02:37:34,640 other one we can render a piece of text 3510 02:37:34,640 --> 02:37:37,240 that will simply render the title of the 3511 02:37:37,240 --> 02:37:40,720 movie and it'll have a class name equal 3512 02:37:40,720 --> 02:37:45,319 to text DSM font Das bold margin top of 3513 02:37:45,319 --> 02:37:50,520 two and text- light 200 and we can also 3514 02:37:50,520 --> 02:37:54,439 make it take two lines maximum so number 3515 02:37:54,439 --> 02:37:57,160 of lines two and with that you have 3516 02:37:57,160 --> 02:37:59,680 implemented this trending card layout 3517 02:37:59,680 --> 02:38:02,080 which is looking great so if we go back 3518 02:38:02,080 --> 02:38:05,200 to the index no warnings or errors here 3519 02:38:05,200 --> 02:38:07,399 and if I go ahead and search for a new 3520 02:38:07,399 --> 02:38:10,359 movie like Avengers there we go and go 3521 02:38:10,359 --> 02:38:12,520 back to home and 3522 02:38:12,520 --> 02:38:14,800 reload you have to keep in mind this 3523 02:38:14,800 --> 02:38:16,720 search functionality update is not 3524 02:38:16,720 --> 02:38:18,160 something that has to happen in real 3525 02:38:18,160 --> 02:38:20,000 time when you open the app again you'll 3526 02:38:20,000 --> 02:38:21,880 be able to see all the new searches that 3527 02:38:21,880 --> 02:38:23,800 people have made and there we go a 3528 02:38:23,800 --> 02:38:25,760 fourth number appeared right here 3529 02:38:25,760 --> 02:38:28,080 Avengers that is perfect and the more 3530 02:38:28,080 --> 02:38:30,279 users search for the same movies the 3531 02:38:30,279 --> 02:38:33,160 higher they will rank wonderful now you 3532 02:38:33,160 --> 02:38:35,160 have not only implemented the typical 3533 02:38:35,160 --> 02:38:38,000 API fetch call but also implemented a 3534 02:38:38,000 --> 02:38:40,520 backend as a service tool that allowed 3535 02:38:40,520 --> 02:38:43,600 us to store a persistent data within a 3536 02:38:43,600 --> 02:38:46,520 database that we use to then show the 3537 02:38:46,520 --> 02:38:51,200 top trending movies great job 3538 02:38:51,200 --> 02:38:53,359 oh and now that everything is looking so 3539 02:38:53,359 --> 02:38:55,560 good we might as well make it a real 3540 02:38:55,560 --> 02:38:57,800 mobile app by hiding the time and the 3541 02:38:57,800 --> 02:38:59,840 battery percentage no need to show it 3542 02:38:59,840 --> 02:39:01,600 here within our movie app and even 3543 02:39:01,600 --> 02:39:04,240 though having it here is totally fine 3544 02:39:04,240 --> 02:39:06,399 having it within our movie Details page 3545 02:39:06,399 --> 02:39:08,960 which will will code next is not ideal 3546 02:39:08,960 --> 02:39:11,479 because if the poster is very light or 3547 02:39:11,479 --> 02:39:13,640 very dark depending on your theme these 3548 02:39:13,640 --> 02:39:16,040 numbers will not be visible at all and 3549 02:39:16,040 --> 02:39:18,200 they will just clutter the poster image 3550 02:39:18,200 --> 02:39:20,200 so to hide them you you can head over 3551 02:39:20,200 --> 02:39:24,319 into our appcore layout it is this 3552 02:39:24,319 --> 02:39:26,560 layout right here the primary one not 3553 02:39:26,560 --> 02:39:29,080 the tabs one and right below the stack 3554 02:39:29,080 --> 02:39:31,600 you can say status bar import from react 3555 02:39:31,600 --> 02:39:34,800 native and simply give it a hidden 3556 02:39:34,800 --> 02:39:38,920 property set to true if you save it and 3557 02:39:38,920 --> 02:39:41,000 open up your terminal you'll see that 3558 02:39:41,000 --> 02:39:43,000 the layout children must be of type 3559 02:39:43,000 --> 02:39:45,200 screen and all other children are 3560 02:39:45,200 --> 02:39:47,319 ignored that's why this status bar is 3561 02:39:47,319 --> 02:39:49,680 not taking effect so what you have to do 3562 02:39:49,680 --> 02:39:52,880 instead is wrap everything with an empty 3563 02:39:52,880 --> 02:39:56,840 react fragment just like this and then 3564 02:39:56,840 --> 02:39:59,800 right next to the stack or on top of it 3565 02:39:59,800 --> 02:40:02,240 in other words you can save it and there 3566 02:40:02,240 --> 02:40:04,840 we go it gets hidden away immediately 3567 02:40:04,840 --> 02:40:07,080 the app looks so much cleaner as the 3568 02:40:07,080 --> 02:40:09,200 time and Battery are not impacting our 3569 02:40:09,200 --> 02:40:12,680 view looking great and all of these are 3570 02:40:12,680 --> 02:40:15,120 just fundamentals of react native 3571 02:40:15,120 --> 02:40:18,240 everything from Flat lists to layouts to 3572 02:40:18,240 --> 02:40:19,920 knowing how to hide thisp status bar if 3573 02:40:19,920 --> 02:40:21,560 you need to but this is just the 3574 02:40:21,560 --> 02:40:23,920 beginning there's always more to learn 3575 02:40:23,920 --> 02:40:25,960 bigger projects to build and exciting 3576 02:40:25,960 --> 02:40:27,680 things to ship to production so if you 3577 02:40:27,680 --> 02:40:28,960 want to apply some of the knowledge 3578 02:40:28,960 --> 02:40:30,960 you've gotten today to practical 3579 02:40:30,960 --> 02:40:33,399 production level check out JS Mastery 3580 02:40:33,399 --> 02:40:36,200 Pro where I dive deeper into JavaScript 3581 02:40:36,200 --> 02:40:39,600 react react native nygs and more and the 3582 02:40:39,600 --> 02:40:41,760 best part is that it is a subscription 3583 02:40:41,760 --> 02:40:43,920 based model which means that it is more 3584 02:40:43,920 --> 02:40:46,319 accessible to get started and you can 3585 02:40:46,319 --> 02:40:48,560 always learn something new every month 3586 02:40:48,560 --> 02:40:51,439 so I'll see in there as it is the new 3587 02:40:51,439 --> 02:40:53,760 biggest chapter of JavaScript Mastery 3588 02:40:53,760 --> 02:40:55,880 but with that said I do want to give you 3589 02:40:55,880 --> 02:40:59,000 a glimpse of the kind of optimizations 3590 02:40:59,000 --> 02:41:01,560 that we do on the production level so in 3591 02:41:01,560 --> 02:41:03,840 the next lesson I'll show you one big 3592 02:41:03,840 --> 02:41:06,279 mistake that we've made in our hom page 3593 02:41:06,279 --> 02:41:08,319 yep it is hidden right here within this 3594 02:41:08,319 --> 02:41:10,760 file but understanding it requires 3595 02:41:10,760 --> 02:41:13,920 reading a lot of docs and fixing it well 3596 02:41:13,920 --> 02:41:16,720 I'll show you how to do it in the next 3597 02:41:16,720 --> 02:41:19,479 lesson but just before I show you how to 3598 02:41:19,479 --> 02:41:21,920 tweak that little homepage optimization 3599 02:41:21,920 --> 02:41:23,920 I want to make sure that we focus on the 3600 02:41:23,920 --> 02:41:26,760 movie Details page we've been staring at 3601 02:41:26,760 --> 02:41:28,840 the search results and the homepage for 3602 02:41:28,840 --> 02:41:30,680 such a long time even the trending 3603 02:41:30,680 --> 02:41:33,080 movies right now but we were never able 3604 02:41:33,080 --> 02:41:36,080 to fetch and show all the movie details 3605 02:41:36,080 --> 02:41:38,479 so let's do that next first we have to 3606 02:41:38,479 --> 02:41:40,560 create a function to gather all the 3607 02:41:40,560 --> 02:41:44,359 movie information so head over into 3608 02:41:44,359 --> 02:41:48,800 Services api. TS and right below fetch 3609 02:41:48,800 --> 02:41:51,880 movies we want to create a new function 3610 02:41:51,880 --> 02:41:57,040 export const fetch movie details it'll 3611 02:41:57,040 --> 02:41:59,439 be equal to an asynchronous function 3612 02:41:59,439 --> 02:42:02,960 that simply accepts a movie ID of a type 3613 02:42:02,960 --> 02:42:05,359 string which will return a promise 3614 02:42:05,359 --> 02:42:08,640 that'll ultimately resolve into movie 3615 02:42:08,640 --> 02:42:10,479 details and now we can open up the 3616 02:42:10,479 --> 02:42:13,399 function block I'll open up a try and 3617 02:42:13,399 --> 02:42:16,319 catch Block in the catch you know the 3618 02:42:16,319 --> 02:42:19,359 drill if there is an error simply con to 3619 02:42:19,359 --> 02:42:22,920 log that error and throw it just so we 3620 02:42:22,920 --> 02:42:25,000 can catch it somewhere else and in the 3621 02:42:25,000 --> 02:42:27,640 try we can make a fetch request similar 3622 02:42:27,640 --> 02:42:29,600 to the one we made above but this time 3623 02:42:29,600 --> 02:42:32,439 to a different endpoint so let's say con 3624 02:42:32,439 --> 02:42:37,399 response is equal to a wait Fetch and 3625 02:42:37,399 --> 02:42:40,279 now we can form the URL by first getting 3626 02:42:40,279 --> 02:42:43,000 to the tmdb 3627 02:42:43,000 --> 02:42:45,120 config Bas 3628 02:42:45,120 --> 02:42:47,080 URL 3629 02:42:47,080 --> 02:42:52,640 slov slash movie ID question mark API 3630 02:42:52,640 --> 02:42:58,640 key is equal to tmdb config API key so 3631 02:42:58,640 --> 02:43:00,800 we have just crafted the endpoint which 3632 02:43:00,800 --> 02:43:02,960 we want to call as the second parameter 3633 02:43:02,960 --> 02:43:05,920 we want to provide it an object where 3634 02:43:05,920 --> 02:43:09,000 the method will be set to get and the 3635 02:43:09,000 --> 02:43:13,399 headers will be set to tmdb config do 3636 02:43:13,399 --> 02:43:16,359 headers we already prepped everything 3637 02:43:16,359 --> 02:43:19,640 beforehand finally if the response is is 3638 02:43:19,640 --> 02:43:23,880 not okay we simply want to throw a new 3639 02:43:23,880 --> 02:43:27,080 error saying something like failed to 3640 02:43:27,080 --> 02:43:30,960 fetch movies or movie details that's a 3641 02:43:30,960 --> 02:43:34,800 bit more precise but if response is okay 3642 02:43:34,800 --> 02:43:37,960 we want to get the data by awaiting the 3643 02:43:37,960 --> 02:43:40,760 response. Json typically when you use 3644 02:43:40,760 --> 02:43:43,160 fetch you need to say response. Json to 3645 02:43:43,160 --> 02:43:45,840 extract the data and finally we want to 3646 02:43:45,840 --> 02:43:48,640 return the data which in this case is 3647 02:43:48,640 --> 02:43:49,720 the move 3648 02:43:49,720 --> 02:43:52,120 details so now that we have created this 3649 02:43:52,120 --> 02:43:54,840 function let's head over into the page 3650 02:43:54,840 --> 02:43:57,200 that we haven't touched so far which is 3651 02:43:57,200 --> 02:44:02,120 this one movies ID a dynamic route that 3652 02:44:02,120 --> 02:44:04,240 displays the details of that specific 3653 02:44:04,240 --> 02:44:06,960 movie let's start with the jsx we're 3654 02:44:06,960 --> 02:44:09,359 wrapping everything with a view that has 3655 02:44:09,359 --> 02:44:14,200 a class name equal to BG primary and 3656 02:44:14,200 --> 02:44:17,399 flex das1 if I save it how do we get to 3657 02:44:17,399 --> 02:44:20,319 that page well you just have to click on 3658 02:44:20,319 --> 02:44:22,520 one of the touchable opacities or one of 3659 02:44:22,520 --> 02:44:25,399 the buttons so choose whichever one you 3660 02:44:25,399 --> 02:44:27,240 want I'll go with the 3661 02:44:27,240 --> 02:44:29,279 Gladiator and now we can render the 3662 02:44:29,279 --> 02:44:31,479 movie details I'll render them within a 3663 02:44:31,479 --> 02:44:34,160 scroll view because it is possible that 3664 02:44:34,160 --> 02:44:36,880 the height of the details will span more 3665 02:44:36,880 --> 02:44:38,840 than the height of the device and I'll 3666 02:44:38,840 --> 02:44:42,359 give it a Content container style equal 3667 02:44:42,359 --> 02:44:46,439 to padding bottom of 80 within it I'll 3668 02:44:46,439 --> 02:44:49,120 display a view and within that view I'll 3669 02:44:49,120 --> 02:44:51,880 display an image that'll have a source 3670 02:44:51,880 --> 02:44:55,399 equal to URI and we once again have to 3671 02:44:55,399 --> 02:45:00,600 have that starting part of a photo https 3672 02:45:00,600 --> 02:45:03,680 colon image. 3673 02:45:03,680 --> 02:45:08,479 tmdb org SLT SL 3674 02:45:08,479 --> 02:45:11,439 w500 and then we render the Movie 3675 02:45:11,439 --> 02:45:14,960 question mark. poster path but of course 3676 02:45:14,960 --> 02:45:17,319 we first have to fetch the movie details 3677 02:45:17,319 --> 02:45:19,080 so this is exactly where that function 3678 02:45:19,080 --> 02:45:20,920 we just created comes into the picture 3679 02:45:20,920 --> 02:45:23,399 first we need to get the ID of the movie 3680 02:45:23,399 --> 02:45:25,760 that we're trying to get the details for 3681 02:45:25,760 --> 02:45:28,560 and we can do that by destructuring the 3682 02:45:28,560 --> 02:45:32,359 ID by using the use local search for 3683 02:45:32,359 --> 02:45:34,800 Rams Hook Once We have the ID it is 3684 02:45:34,800 --> 02:45:38,240 pretty simple we just say const the 3685 02:45:38,240 --> 02:45:41,720 structure the data rename it as 3686 02:45:41,720 --> 02:45:45,040 movie also accept the loading and make 3687 02:45:45,040 --> 02:45:48,160 it equal to the use fetch hook call 3688 02:45:48,160 --> 02:45:50,399 within which we can have a callback 3689 02:45:50,399 --> 02:45:54,439 function that then calls the fetch movie 3690 02:45:54,439 --> 02:45:57,920 details and we need to pass the ID as 3691 02:45:57,920 --> 02:46:00,800 string right into it so now we get 3692 02:46:00,800 --> 02:46:03,319 access to that movie and if you click on 3693 02:46:03,319 --> 02:46:05,760 one of those 3694 02:46:05,760 --> 02:46:07,800 movies you can see that we get 3695 02:46:07,800 --> 02:46:10,439 redirected we no longer have an error 3696 02:46:10,439 --> 02:46:12,760 but to be able to see the poster we have 3697 02:46:12,760 --> 02:46:16,880 to give this image a class name of w 3698 02:46:16,880 --> 02:46:20,760 fool and let's do something big like H 3699 02:46:20,760 --> 02:46:24,800 550 pixels there we go so now it takes 3700 02:46:24,800 --> 02:46:27,520 that upper part of the screen looking 3701 02:46:27,520 --> 02:46:31,200 good we can also give it a resize mode 3702 02:46:31,200 --> 02:46:32,840 equal to 3703 02:46:32,840 --> 02:46:35,760 stretch there we go so now it is looking 3704 02:46:35,760 --> 02:46:38,399 even better now below that view we can 3705 02:46:38,399 --> 02:46:41,760 render another view that'll have a class 3706 02:46:41,760 --> 02:46:44,319 name equal to 3707 02:46:44,319 --> 02:46:48,279 flex-all items Das start justify Dash 3708 02:46:48,279 --> 02:46:51,520 Center margin top of five and padding X 3709 02:46:51,520 --> 02:46:54,000 of five we're just creating some space 3710 02:46:54,000 --> 02:46:55,760 for the text elements that'll go within 3711 02:46:55,760 --> 02:46:58,439 it so let's create the space for the 3712 02:46:58,439 --> 02:47:01,680 first text element that'll render the 3713 02:47:01,680 --> 02:47:05,000 Movie question mark. tile and we can 3714 02:47:05,000 --> 02:47:08,760 style it by giving it a class name equal 3715 02:47:08,760 --> 02:47:14,399 to text- White font Das bold and text- 3716 02:47:14,399 --> 02:47:18,520 excl there we go Gladiator 2 we can go 3717 02:47:18,520 --> 02:47:19,399 below 3718 02:47:19,399 --> 02:47:23,040 this text and render another view this 3719 02:47:23,040 --> 02:47:26,520 view will have a class name equal to 3720 02:47:26,520 --> 02:47:31,279 flex Das row items Das Center and a gap 3721 02:47:31,279 --> 02:47:34,040 X of one in between the elements as well 3722 02:47:34,040 --> 02:47:36,560 as a margin top of two to divide it a 3723 02:47:36,560 --> 02:47:39,279 bit from the elements above within this 3724 02:47:39,279 --> 02:47:42,279 view we can show one more 3725 02:47:42,279 --> 02:47:45,359 text this one will have a class name 3726 02:47:45,359 --> 02:47:49,840 equal to text- light 200 3727 02:47:49,840 --> 02:47:53,040 and text- smm and within it we can 3728 02:47:53,040 --> 02:47:54,880 render the year we already learned how 3729 02:47:54,880 --> 02:47:58,760 to do that movie question mark. releasor 3730 02:47:58,760 --> 02:48:00,960 date question mark 3731 02:48:00,960 --> 02:48:05,800 do split by the dash and get only the 3732 02:48:05,800 --> 02:48:08,560 year oh but the index of zero has to 3733 02:48:08,560 --> 02:48:12,080 come after the split there we go 2024 3734 02:48:12,080 --> 02:48:14,160 right below this text we can render 3735 02:48:14,160 --> 02:48:17,200 another text with the same Styles so 3736 02:48:17,200 --> 02:48:20,319 that'll be a class name of of text- 3737 02:48:20,319 --> 02:48:25,600 light 200 and text- smm and within this 3738 02:48:25,600 --> 02:48:28,000 one we can render the Movie question 3739 02:48:28,000 --> 02:48:29,680 mark. 3740 02:48:29,680 --> 02:48:32,960 runtime so this one lasts for 3741 02:48:32,960 --> 02:48:35,880 184 and we can add M at the end which 3742 02:48:35,880 --> 02:48:38,840 stands for minutes now we can exit this 3743 02:48:38,840 --> 02:48:40,880 View and we can create another view 3744 02:48:40,880 --> 02:48:42,960 below to show some more 3745 02:48:42,960 --> 02:48:45,640 information this one will have a class 3746 02:48:45,640 --> 02:48:49,080 name equal to flex-r 3747 02:48:49,080 --> 02:48:50,439 items Das 3748 02:48:50,439 --> 02:48:55,800 Center BG of dark 100 padding X of two 3749 02:48:55,800 --> 02:48:59,920 padding y of 1 rounded - 3750 02:48:59,920 --> 02:49:04,960 MD Gap X of one and a margin top of two 3751 02:49:04,960 --> 02:49:07,240 and within this view we can render an 3752 02:49:07,240 --> 02:49:11,080 image that'll have a source equal to 3753 02:49:11,080 --> 02:49:15,000 icons coming from constants icons do 3754 02:49:15,000 --> 02:49:18,760 star as well as a class name equal to s 3755 02:49:18,760 --> 02:49:19,840 size of 3756 02:49:19,840 --> 02:49:22,359 four and there we have it one little 3757 02:49:22,359 --> 02:49:25,520 star right there right below that image 3758 02:49:25,520 --> 02:49:28,000 we can render a piece of text that'll 3759 02:49:28,000 --> 02:49:32,560 have a class name equal to text- White 3760 02:49:32,560 --> 02:49:37,359 font Das bold and text- smm and within 3761 02:49:37,359 --> 02:49:40,960 it I'll put a dynamic block of code and 3762 02:49:40,960 --> 02:49:44,479 round up the current score by saying 3763 02:49:44,479 --> 02:49:49,800 math.round movie mark. Vore average 3764 02:49:49,800 --> 02:49:53,319 or if it doesn't exist simply take zero 3765 02:49:53,319 --> 02:49:55,359 just so it doesn't break and we can say 3766 02:49:55,359 --> 02:49:59,080 out of 10 so this one is 7 out of 10 3767 02:49:59,080 --> 02:50:01,080 right below it we can also render 3768 02:50:01,080 --> 02:50:02,439 another piece of 3769 02:50:02,439 --> 02:50:06,120 text that will have a class name that'll 3770 02:50:06,120 --> 02:50:11,239 have a text- light 200 and text- smm and 3771 02:50:11,239 --> 02:50:13,040 within this one we want to show the 3772 02:50:13,040 --> 02:50:16,520 number of votes so in parenthesis I'll 3773 02:50:16,520 --> 02:50:21,239 say movie question mark. vote count and 3774 02:50:21,239 --> 02:50:26,279 then I'll say votes so this one got 3775 02:50:26,279 --> 02:50:29,720 2,947 votes it matters right we want to 3776 02:50:29,720 --> 02:50:31,680 know how many people have rated it on 3777 02:50:31,680 --> 02:50:34,080 average 7 out of 10 and now we want to 3778 02:50:34,080 --> 02:50:36,800 show a couple of these movie labels like 3779 02:50:36,800 --> 02:50:39,800 the overview release date status genres 3780 02:50:39,800 --> 02:50:42,720 and so on each one has a little title on 3781 02:50:42,720 --> 02:50:44,920 top and then the actual 3782 02:50:44,920 --> 02:50:47,160 content that means that we can turn it 3783 02:50:47,160 --> 02:50:49,399 into a reusable component 3784 02:50:49,399 --> 02:50:52,479 so right at the top I'll create a new 3785 02:50:52,479 --> 02:50:56,200 reusable component and call it movie 3786 02:50:56,200 --> 02:51:00,120 info so const movie info is equal to a 3787 02:51:00,120 --> 02:51:03,800 function that will destructure the props 3788 02:51:03,800 --> 02:51:06,960 of label and value so for each value 3789 02:51:06,960 --> 02:51:10,359 there is a label they'll be of a type 3790 02:51:10,359 --> 02:51:14,080 movie info props which we can Define 3791 02:51:14,080 --> 02:51:17,040 just above by saying 3792 02:51:17,040 --> 02:51:21,399 interface movie info props and it has a 3793 02:51:21,399 --> 02:51:24,080 label of a type string as well as an 3794 02:51:24,080 --> 02:51:27,520 optional value of a type either string 3795 02:51:27,520 --> 02:51:32,800 or number or null perfect and then we 3796 02:51:32,800 --> 02:51:35,239 can open up a function block with an 3797 02:51:35,239 --> 02:51:37,080 immediate return which means that we 3798 02:51:37,080 --> 02:51:38,960 just put parenthesis right here and not 3799 02:51:38,960 --> 02:51:42,920 curly braces so what do we return well 3800 02:51:42,920 --> 02:51:44,239 it'll be a 3801 02:51:44,239 --> 02:51:49,279 view with a class name of flex-all 3802 02:51:49,279 --> 02:51:54,279 items Das start justify Das Center and a 3803 02:51:54,279 --> 02:51:57,359 margin top of five and right within it 3804 02:51:57,359 --> 02:51:59,680 first we show a piece of 3805 02:51:59,680 --> 02:52:04,840 text that has a class name of text 3806 02:52:04,840 --> 02:52:07,920 dl-200 font 3807 02:52:07,920 --> 02:52:10,520 dormal and text 3808 02:52:10,520 --> 02:52:14,200 DSM and within it we render the label 3809 02:52:14,200 --> 02:52:16,960 and next we can have a text just beneath 3810 02:52:16,960 --> 02:52:24,680 it with a class name of text- light-1 3811 02:52:24,680 --> 02:52:29,319 f-bold text DSM and margin top of two 3812 02:52:29,319 --> 02:52:32,120 and within it we render either the value 3813 02:52:32,120 --> 02:52:37,000 or a string of Na a value doesn't exist 3814 02:52:37,000 --> 02:52:39,680 and now we can use this movie info a 3815 02:52:39,680 --> 02:52:42,600 couple of times right here below our 3816 02:52:42,600 --> 02:52:45,640 view that contains the vote count so 3817 02:52:45,640 --> 02:52:48,040 let's go right below it and let's render 3818 02:52:48,040 --> 02:52:51,680 a couple of these movie info 3819 02:52:51,680 --> 02:52:53,840 components the first one will have a 3820 02:52:53,840 --> 02:52:58,080 label of overview and the value of movie 3821 02:52:58,080 --> 02:53:02,040 mark. overview and if you self close it 3822 02:53:02,040 --> 02:53:04,600 check this out immediately it looks 3823 02:53:04,600 --> 02:53:07,600 super nice let's also render one more 3824 02:53:07,600 --> 02:53:10,239 just beneath it this one will have a 3825 02:53:10,239 --> 02:53:14,800 movie info of jras and the value will be 3826 02:53:14,800 --> 02:53:17,439 movie mark. 3827 02:53:17,439 --> 02:53:20,800 genres question mark. map where we get 3828 02:53:20,800 --> 02:53:23,720 each individual G as in genre and then 3829 02:53:23,720 --> 02:53:26,800 we can say return g.n name and then 3830 02:53:26,800 --> 02:53:28,960 outside of that function we can say do 3831 02:53:28,960 --> 02:53:32,000 join them with something like a dash in 3832 02:53:32,000 --> 02:53:36,000 between like this or say na doesn't 3833 02:53:36,000 --> 02:53:38,439 exist so if you do this you'll see 3834 02:53:38,439 --> 02:53:42,319 action adventure drama looking good now 3835 02:53:42,319 --> 02:53:45,200 let's create one more view below this 3836 02:53:45,200 --> 02:53:48,160 movie info this one will have a class 3837 02:53:48,160 --> 02:53:52,560 named name of flex Flex D 3838 02:53:52,560 --> 02:53:57,239 row justify Dash between and a w of 1 3839 02:53:57,239 --> 02:54:00,680 over two so that is 50% of the width and 3840 02:54:00,680 --> 02:54:03,120 within it I'll show another movie info 3841 02:54:03,120 --> 02:54:06,800 component with a label of budget and a 3842 02:54:06,800 --> 02:54:10,680 value of dollar sign movie question 3843 02:54:10,680 --> 02:54:15,840 mark. budget and we can divide it by 1 3844 02:54:15,840 --> 02:54:18,600 million and then render the data in 3845 02:54:18,600 --> 02:54:20,720 Millions that'll look something like 3846 02:54:20,720 --> 02:54:25,120 this budget is 310 million for this 3847 02:54:25,120 --> 02:54:27,640 movie still within the same view but 3848 02:54:27,640 --> 02:54:30,080 just below this movie info we can also 3849 02:54:30,080 --> 02:54:33,640 show the revenue so the label of Revenue 3850 02:54:33,640 --> 02:54:36,560 and a value of we want to do the same 3851 02:54:36,560 --> 02:54:38,279 thing right here but we can round it up 3852 02:54:38,279 --> 02:54:41,560 a bit so we can say a template string of 3853 02:54:41,560 --> 02:54:43,279 math. 3854 02:54:43,279 --> 02:54:48,080 round movie question mark. revenue and 3855 02:54:48,080 --> 02:54:50,560 one once again we want to divide it by 1 3856 02:54:50,560 --> 02:54:53,800 million and save it and at the start we 3857 02:54:53,800 --> 02:54:57,840 can add a dollar sign as well right here 3858 02:54:57,840 --> 02:55:00,279 so now we can see that the revenue is 3859 02:55:00,279 --> 02:55:03,239 458 million which means that this movie 3860 02:55:03,239 --> 02:55:05,800 is already profitable finally we can go 3861 02:55:05,800 --> 02:55:07,880 below this view that wraps the two of 3862 02:55:07,880 --> 02:55:12,000 them and we can create one more movie 3863 02:55:12,000 --> 02:55:15,239 info this one will have the label of 3864 02:55:15,239 --> 02:55:17,120 production 3865 02:55:17,120 --> 02:55:20,120 companies and and it'll have a value 3866 02:55:20,120 --> 02:55:23,319 equal to movie question mark. 3867 02:55:23,319 --> 02:55:24,840 production 3868 02:55:24,840 --> 02:55:27,560 companies. map where we get each 3869 02:55:27,560 --> 02:55:30,720 individual company and for each one we 3870 02:55:30,720 --> 02:55:34,640 return its name and we can join them by 3871 02:55:34,640 --> 02:55:37,120 a dash which will look something like 3872 02:55:37,120 --> 02:55:40,000 this or if it doesn't exist we can 3873 02:55:40,000 --> 02:55:43,040 simply say na a there we go so now we 3874 02:55:43,040 --> 02:55:45,319 can see Paramount Pictures scotf free 3875 02:55:45,319 --> 02:55:47,840 production and more many people worked 3876 02:55:47,840 --> 02:55:50,200 on this movie movie finally just below 3877 02:55:50,200 --> 02:55:52,840 this entire scroll View at the bottom we 3878 02:55:52,840 --> 02:55:56,319 can render a touchable opacity a button 3879 02:55:56,319 --> 02:55:59,880 to go back to the previous page so it'll 3880 02:55:59,880 --> 02:56:01,600 have an 3881 02:56:01,600 --> 02:56:05,160 image that'll have a source equal to 3882 02:56:05,160 --> 02:56:06,720 icons. 3883 02:56:06,720 --> 02:56:10,880 arrow with a class name equal to 3884 02:56:10,880 --> 02:56:15,560 size-5 margin right of one margin top of 3885 02:56:15,560 --> 02:56:18,840 0.5 and rotate 180 3886 02:56:18,840 --> 02:56:24,000 and a tint color equal to # FFF so if 3887 02:56:24,000 --> 02:56:26,760 you render it you can't see it just yet 3888 02:56:26,760 --> 02:56:30,399 but below it I'll render a text that'll 3889 02:56:30,399 --> 02:56:32,800 say go 3890 02:56:32,800 --> 02:56:35,760 back and I'll give it a class 3891 02:56:35,760 --> 02:56:41,279 name equal to text- White font D 3892 02:56:41,279 --> 02:56:43,720 semibold 3893 02:56:43,720 --> 02:56:46,439 text-base and now you can see it but of 3894 02:56:46,439 --> 02:56:47,960 course we have to style this touchable 3895 02:56:47,960 --> 02:56:50,920 opat capacity a bit better by giving it 3896 02:56:50,920 --> 02:56:53,920 a class name of 3897 02:56:53,920 --> 02:56:56,279 absolute 3898 02:56:56,279 --> 02:57:03,279 bottom-5 left- 0 right- Z margin X of 3899 02:57:03,279 --> 02:57:05,800 five BG of 3900 02:57:05,800 --> 02:57:08,920 accent rounded 3901 02:57:08,920 --> 02:57:12,720 dlg padding y of 3902 02:57:12,720 --> 02:57:14,520 3.5 3903 02:57:14,520 --> 02:57:19,479 Flex Flex Das row items Das Center 3904 02:57:19,479 --> 02:57:20,840 justify Dash 3905 02:57:20,840 --> 02:57:24,640 Center and a z of 50 so it appears above 3906 02:57:24,640 --> 02:57:28,000 other elements and there you have it a 3907 02:57:28,000 --> 02:57:31,040 movie Details page with a Gob back 3908 02:57:31,040 --> 02:57:33,560 button of course to actually make it 3909 02:57:33,560 --> 02:57:35,760 work we can use the router 3910 02:57:35,760 --> 02:57:38,200 functionalities so let me give it an 3911 02:57:38,200 --> 02:57:40,600 onpress and call the 3912 02:57:40,600 --> 02:57:43,640 router which we can import from Expo 3913 02:57:43,640 --> 02:57:47,800 router dot back if you save it and click 3914 02:57:47,800 --> 02:57:50,120 go back back take a look at that it 3915 02:57:50,120 --> 02:57:53,000 actually goes back but you can also just 3916 02:57:53,000 --> 02:57:56,479 scroll or swipe from left to right on 3917 02:57:56,479 --> 02:58:00,160 iOS to go back as well and now you can 3918 02:58:00,160 --> 02:58:03,160 see the movie details for all of these 3919 02:58:03,160 --> 02:58:05,520 different movies not only the popular 3920 02:58:05,520 --> 02:58:08,520 ones or the trending ones but also the 3921 02:58:08,520 --> 02:58:10,720 ones that you search for so if you have 3922 02:58:10,720 --> 02:58:12,600 your favorite 3923 02:58:12,600 --> 02:58:15,080 movie I don't know which one it is once 3924 02:58:15,080 --> 02:58:17,399 again let me know down in the comments 3925 02:58:17,399 --> 02:58:19,760 well you can find it right here and see 3926 02:58:19,760 --> 02:58:20,920 all of its 3927 02:58:20,920 --> 02:58:24,000 details and I got to say the app is 3928 02:58:24,000 --> 02:58:27,560 super super responsive it works very 3929 02:58:27,560 --> 02:58:30,040 well and you can see as I swipe up and 3930 02:58:30,040 --> 02:58:32,720 down and as I open different pages it is 3931 02:58:32,720 --> 02:58:36,200 just super efficient and this brings us 3932 02:58:36,200 --> 02:58:39,439 to the end of the movie Details page and 3933 02:58:39,439 --> 02:58:41,680 we're almost done with the entire app 3934 02:58:41,680 --> 02:58:44,920 this is pretty amazing I got to say just 3935 02:58:44,920 --> 02:58:46,680 before we finish it off I want to make 3936 02:58:46,680 --> 02:58:48,800 sure that we have something on the saved 3937 02:58:48,800 --> 02:58:51,560 and profile Pages too because right now 3938 02:58:51,560 --> 02:58:54,600 they look super blank so let's head over 3939 02:58:54,600 --> 02:58:57,359 into those two pages starting with a 3940 02:58:57,359 --> 02:58:59,640 profile and I'll just tighten them up a 3941 02:58:59,640 --> 02:59:02,520 bit so we have a nice blank screen but 3942 02:59:02,520 --> 02:59:04,760 then if you want to you can go ahead and 3943 02:59:04,760 --> 02:59:06,560 Implement additional 3944 02:59:06,560 --> 02:59:09,520 functionalities this is an exercise for 3945 02:59:09,520 --> 02:59:12,920 you to improve this app even further and 3946 02:59:12,920 --> 02:59:14,880 to put the skills you've gained from 3947 02:59:14,880 --> 02:59:17,680 this video to the test first things 3948 02:59:17,680 --> 02:59:20,800 first let's get rid of this ugly white 3949 02:59:20,800 --> 02:59:24,920 screen by rendering a class name to this 3950 02:59:24,920 --> 02:59:27,920 View and giving it a BG 3951 02:59:27,920 --> 02:59:31,319 primary as well as a flex of one and the 3952 02:59:31,319 --> 02:59:35,279 padding X of 10 that's better within it 3953 02:59:35,279 --> 02:59:37,800 let's also render another view which 3954 02:59:37,800 --> 02:59:40,200 we'll use to Center our icon in the 3955 02:59:40,200 --> 02:59:44,040 middle so I'll give it a class name of 3956 02:59:44,040 --> 02:59:48,880 flex justify Das center items Dash 3957 02:59:48,880 --> 02:59:52,640 Center Flex D1 3958 02:59:52,640 --> 02:59:56,120 flex-all and a gap of five within it we 3959 02:59:56,120 --> 02:59:58,840 can render an image that'll have a 3960 02:59:58,840 --> 03:00:02,720 source equal to icons. 3961 03:00:02,720 --> 03:00:06,840 person and a class name equal to size of 3962 03:00:06,840 --> 03:00:12,479 10 as well as a tint color equal to # FF 3963 03:00:12,479 --> 03:00:14,640 oh and make sure to import the icons 3964 03:00:14,640 --> 03:00:18,520 from constants and then reload the app 3965 03:00:18,520 --> 03:00:21,120 while it's reloading we can also add the 3966 03:00:21,120 --> 03:00:23,640 text element right below it that will 3967 03:00:23,640 --> 03:00:27,399 simply say profile and we can style it 3968 03:00:27,399 --> 03:00:30,520 by giving it a text- 3969 03:00:30,520 --> 03:00:33,200 g-500 as well as 3970 03:00:33,200 --> 03:00:36,000 text-base so now if you head over to the 3971 03:00:36,000 --> 03:00:38,600 profile you see a little profile icon in 3972 03:00:38,600 --> 03:00:40,960 the middle waiting for you to implement 3973 03:00:40,960 --> 03:00:43,920 that profile screen what we can do is 3974 03:00:43,920 --> 03:00:46,920 also copy this entire view head over 3975 03:00:46,920 --> 03:00:48,439 into saved 3976 03:00:48,439 --> 03:00:51,680 and override the saved as well but this 3977 03:00:51,680 --> 03:00:54,560 time it's not going to be icons. person 3978 03:00:54,560 --> 03:00:57,920 it'll be icons. saave as well as it'll 3979 03:00:57,920 --> 03:00:59,160 say 3980 03:00:59,160 --> 03:01:01,880 save so now if you head over into the 3981 03:01:01,880 --> 03:01:04,880 saved you can see that it looks great as 3982 03:01:04,880 --> 03:01:08,319 well again I don't want to Simply give 3983 03:01:08,319 --> 03:01:10,520 you everything in this course because 3984 03:01:10,520 --> 03:01:11,600 then there's not going to be an 3985 03:01:11,600 --> 03:01:14,560 incentive for you to try some things out 3986 03:01:14,560 --> 03:01:16,920 so I invite you to go ahead and 3987 03:01:16,920 --> 03:01:19,479 Implement that save movie functionality 3988 03:01:19,479 --> 03:01:21,600 to save your favorite movies into a 3989 03:01:21,600 --> 03:01:23,319 collection you'll have to work a bit 3990 03:01:23,319 --> 03:01:25,200 with aight to have some persistent 3991 03:01:25,200 --> 03:01:27,600 storage and it'll be very similar to 3992 03:01:27,600 --> 03:01:29,880 tracking our metrics right now instead 3993 03:01:29,880 --> 03:01:32,040 of searches you'll be tracking the 3994 03:01:32,040 --> 03:01:35,120 clicks when somebody clicks a heart on a 3995 03:01:35,120 --> 03:01:37,399 specific movie for example and then 3996 03:01:37,399 --> 03:01:39,640 you'll have to create a second function 3997 03:01:39,640 --> 03:01:42,040 that will fetch all of the favorite 3998 03:01:42,040 --> 03:01:45,040 movies pretty cool right I know it might 3999 03:01:45,040 --> 03:01:48,040 sound difficult at first but trust me as 4000 03:01:48,040 --> 03:01:50,560 you get a hang of react native it'll all 4001 03:01:50,560 --> 03:01:54,080 start making sense very soon especially 4002 03:01:54,080 --> 03:01:56,680 if you dive into JS Mastery Pro where we 4003 03:01:56,680 --> 03:01:59,200 dive a bit deeper into how react native 4004 03:01:59,200 --> 03:02:01,600 Works under the hood as well as how we 4005 03:02:01,600 --> 03:02:04,520 can optimize it for bigger applications 4006 03:02:04,520 --> 03:02:07,800 great that's it for this lesson this was 4007 03:02:07,800 --> 03:02:09,840 a big 4008 03:02:09,840 --> 03:02:12,800 one and to finish this course off I want 4009 03:02:12,800 --> 03:02:15,160 to show you one little gotcha that I 4010 03:02:15,160 --> 03:02:17,560 found it's those little things that you 4011 03:02:17,560 --> 03:02:19,520 don't find in the documentation very 4012 03:02:19,520 --> 03:02:22,200 easily but rather it's a best practice 4013 03:02:22,200 --> 03:02:23,760 that you have to dig through GitHub 4014 03:02:23,760 --> 03:02:25,560 discussions to figure it out fully I 4015 03:02:25,560 --> 03:02:27,720 zoomed out this code so you get a better 4016 03:02:27,720 --> 03:02:29,359 understanding of the entire homepage 4017 03:02:29,359 --> 03:02:31,279 that we have right now notice a couple 4018 03:02:31,279 --> 03:02:34,040 of things we have a single scroll view 4019 03:02:34,040 --> 03:02:36,840 right here where we said show vertical 4020 03:02:36,840 --> 03:02:40,319 scroll indicator is set to false but 4021 03:02:40,319 --> 03:02:41,680 doesn't matter that we're hiding the 4022 03:02:41,680 --> 03:02:45,600 indicator this scroll view is a vertical 4023 03:02:45,600 --> 03:02:48,800 View and within that vertical view we 4024 03:02:48,800 --> 03:02:51,840 also have another flat list this one 4025 03:02:51,840 --> 03:02:53,840 right here which renders all the movie 4026 03:02:53,840 --> 03:02:56,760 cards those movies are also in a 4027 03:02:56,760 --> 03:03:00,200 vertical View and it is not generally 4028 03:03:00,200 --> 03:03:02,600 recommended to have two virtualized 4029 03:03:02,600 --> 03:03:05,800 lists or scroll views or flat lists in 4030 03:03:05,800 --> 03:03:09,279 the same orientation see this flat list 4031 03:03:09,279 --> 03:03:11,960 is not a problem this one is horizontal 4032 03:03:11,960 --> 03:03:13,239 and that's okay when it comes to the 4033 03:03:13,239 --> 03:03:16,680 performance but having two huge flat 4034 03:03:16,680 --> 03:03:18,960 lists that are of the same orientation 4035 03:03:18,960 --> 03:03:21,560 is generally not considered a good 4036 03:03:21,560 --> 03:03:24,080 practice we're using a scroll view to 4037 03:03:24,080 --> 03:03:26,560 render most of the movies and if you go 4038 03:03:26,560 --> 03:03:28,760 to the docs it's going to say scroll 4039 03:03:28,760 --> 03:03:31,439 view versus flatlist which one should 4040 03:03:31,439 --> 03:03:34,960 you use well scroll view renders all its 4041 03:03:34,960 --> 03:03:38,080 children components at once but this has 4042 03:03:38,080 --> 03:03:41,359 a performance downside imagine you have 4043 03:03:41,359 --> 03:03:43,560 a very long list of items you want to 4044 03:03:43,560 --> 03:03:46,040 display maybe several screens worth of 4045 03:03:46,040 --> 03:03:48,560 content creating Js components and 4046 03:03:48,560 --> 03:03:51,200 Native use for everything all at once 4047 03:03:51,200 --> 03:03:53,319 much of which may not be even shown will 4048 03:03:53,319 --> 03:03:55,359 contribute to slow rendering and 4049 03:03:55,359 --> 03:03:58,279 increased memory usage and this is where 4050 03:03:58,279 --> 03:04:00,880 the flatlist comes into play because 4051 03:04:00,880 --> 03:04:03,960 flatlist is smart IT renders items 4052 03:04:03,960 --> 03:04:05,960 lazily just before they're about to 4053 03:04:05,960 --> 03:04:08,239 appear and it removes the items that 4054 03:04:08,239 --> 03:04:11,040 scroll way off the screen to save memory 4055 03:04:11,040 --> 03:04:13,960 and processing time so in other words 4056 03:04:13,960 --> 03:04:16,239 when you have large lists of vertical 4057 03:04:16,239 --> 03:04:19,000 elements you want to use a flat list and 4058 03:04:19,000 --> 03:04:21,640 not a scroll View and in our case if you 4059 03:04:21,640 --> 03:04:23,840 look at the flat list we technically 4060 03:04:23,840 --> 03:04:25,560 didn't allow it to reach its full 4061 03:04:25,560 --> 03:04:28,040 potential because we have set scroll 4062 03:04:28,040 --> 03:04:30,560 enable to FSE which technically means 4063 03:04:30,560 --> 03:04:33,960 that we let the scroll view do its job 4064 03:04:33,960 --> 03:04:36,640 even though it is totally fine perfectly 4065 03:04:36,640 --> 03:04:38,960 fine for our use case as we don't have 4066 03:04:38,960 --> 03:04:41,040 many elements and we wouldn't even been 4067 03:04:41,040 --> 03:04:43,359 able to harness the power of the flat 4068 03:04:43,359 --> 03:04:46,479 list for bigger applications it makes a 4069 03:04:46,479 --> 03:04:49,520 big difference and that's exactly why I 4070 03:04:49,520 --> 03:04:51,600 wanted to leave this for the end of this 4071 03:04:51,600 --> 03:04:54,359 video while it is totally fine for 4072 03:04:54,359 --> 03:04:57,399 smaller apps for larger apps you just 4073 03:04:57,399 --> 03:05:00,239 got to be smarter and utilize everything 4074 03:05:00,239 --> 03:05:02,520 that the software allows you to do in 4075 03:05:02,520 --> 03:05:04,319 this case react natives built-in 4076 03:05:04,319 --> 03:05:07,080 components like the flatlist are super 4077 03:05:07,080 --> 03:05:09,520 powerful but you got to know how to use 4078 03:05:09,520 --> 03:05:12,319 them below this lesson I'll leave the 4079 03:05:12,319 --> 03:05:14,920 improved codebase for how the homepage 4080 03:05:14,920 --> 03:05:16,960 should have looked like if it had 4081 03:05:16,960 --> 03:05:20,040 hundreds or thousands of elements so if 4082 03:05:20,040 --> 03:05:21,520 you want to check it out you can go 4083 03:05:21,520 --> 03:05:23,720 ahead and do that but this is just one 4084 03:05:23,720 --> 03:05:26,399 little optimization out of hundreds or 4085 03:05:26,399 --> 03:05:29,319 thousands that we go over on JS Mastery 4086 03:05:29,319 --> 03:05:32,479 Pro so check it out cancel at any time 4087 03:05:32,479 --> 03:05:35,200 or get a refund if you don't like it but 4088 03:05:35,200 --> 03:05:37,160 given how many resources we have in our 4089 03:05:37,160 --> 03:05:39,600 knowledge base and within our pads it's 4090 03:05:39,600 --> 03:05:41,680 hard not to find something that you can 4091 03:05:41,680 --> 03:05:43,600 learned from and that'll help you 4092 03:05:43,600 --> 03:05:46,120 advance your career with that in mind 4093 03:05:46,120 --> 03:05:48,160 great job on coming to the end end of 4094 03:05:48,160 --> 03:05:51,160 this phenomenal project allowing users 4095 03:05:51,160 --> 03:05:53,800 to find their favorite movies search for 4096 03:05:53,800 --> 03:05:56,279 them and then the algorithm that 4097 03:05:56,279 --> 03:05:58,359 actually checks which movies have been 4098 03:05:58,359 --> 03:06:00,960 searched most often and therefore they 4099 03:06:00,960 --> 03:06:04,160 get displayed right here on the homepage 4100 03:06:04,160 --> 03:06:06,760 looking good feeling good it is 4101 03:06:06,760 --> 03:06:09,359 responsive and it is the best of mobile 4102 03:06:09,359 --> 03:06:12,680 development that react native offers so 4103 03:06:12,680 --> 03:06:15,000 thank you so much for watching and I'll 4104 03:06:15,000 --> 03:06:18,439 see you on Js mastery. proo have a great 4105 03:06:18,439 --> 03:06:19,439 day315225

Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.