React Native Tab Bar Routing with Expo Router

Поделиться
HTML-код
  • Опубликовано: 29 апр 2023
  • Learn to use the new Expo File-based routing to create a tab bar with nested stack layouts!
    🔥 Learn React Native FAST: galaxies.dev/reactnative
    #############################
    👨‍💻 Want to read instead of watch?
    Here's the full Ionic tutorial: galaxies.dev/react-native-tab...
    #############################
    ❤️ You can also find me on:
    Instagram: / simongrimm_
    Twitter: / schlimmson
    Facebook: / devdactic
    TikTok: / simongrimm_
    Or join the Simonics Facebook group:
    / simonics
    #############################
  • НаукаНаука

Комментарии • 153

  • @ChrisPrakoso
    @ChrisPrakoso 10 месяцев назад +11

    I can't thank you enough for this! I was going on looking for all possible info on the net about how exactly to do what you are explaining here, and I just couldn't find the right info. It was a bit frustrating to say the least. But you've successfully explained it in just 10 minutes!! That's just awesome! Thank you again.

  • @Baconbrix
    @Baconbrix Год назад +20

    At 3:14, if you define a React component as an anonymous function, i.e. `export default () => `, then React Refresh won't be able to restore the state inside that component correctly. This is because the function name is used as a restoration ID for components.

    • @galaxies_dev
      @galaxies_dev  Год назад +2

      Ahh thank you Evan!!

    • @mrd.j.2303
      @mrd.j.2303 11 месяцев назад

      What would be the better way?

  • @disminliguido
    @disminliguido Год назад

    After i do the redirect with replace to a page that is inside the file (tabs) it shows this error " The action 'REPLACE' with payload {"name":"agenda"} was not handled by any navigator.
    Do you have a screen named 'agenda'?
    Do you know what could be happening?

  • @michelro
    @michelro Год назад +4

    This is exactly what I was looking for, thanks a lot. I think if you need to say home/index when you don’t have the layout file and that’s why you were getting a warning.

    • @galaxies_dev
      @galaxies_dev  Год назад

      Yeah finally figured that out as well :D

  • @rapepongpitijaroonpong1036
    @rapepongpitijaroonpong1036 Год назад +2

    The contents in this channel is very infomative,it really helps me understand react native and able to go on. and I like how you explain in each part which important but most tutorial i found don't have.

    • @galaxies_dev
      @galaxies_dev  Год назад

      Happy to hear that and thank you for the kind words - more React Native coming soon :)

  • @tusharnagar1398
    @tusharnagar1398 5 месяцев назад +1

    Thanks dear for helping me to digest cool stuff easily.

  • @isaaccastillo8628
    @isaaccastillo8628 Месяц назад

    Hey Simon great video. I want to ask, if I have certain state in my "HomeScreen" page, and I want to make a new page with details with the info of my state of the HomeScreen, I need to use the useContext in the root layout.tsx of the Expo-router thing in order to do that? Sorry if this question is a dummy question, I'm a newbie with React actually.

  • @jareeshcm444
    @jareeshcm444 10 месяцев назад +1

    This sample as is didn't work for me. anywhere i can find the code? not sure what i am missing.

  • @rafacanical
    @rafacanical Год назад +1

    I was looking for this! Thanks

  • @tikod7236
    @tikod7236 Год назад

    Hey thanks for your awesome video!
    Tell me, please, how can I connect redux in such a breakdown into files and such an architecture. I mean, exactly where should I use to push state to each page

  • @klincoder
    @klincoder Год назад +2

    Very useful and saved me time. Thank you.

    • @galaxies_dev
      @galaxies_dev  Год назад

      Happy to help - let me know when you encounter problems!

  • @rishabh1S
    @rishabh1S 5 месяцев назад +2

    Exact Video, I needed!! Thanks Man

  • @brunovivaldodev
    @brunovivaldodev 9 месяцев назад +1

    Great video, and good explanation

  • @bassamsami7319
    @bassamsami7319 Месяц назад

    thanks for your efforts , but how to make the tab bar shows in all pages of react native expo mobile app even the page is not shown in shortcuts of tab bar?

  • @arozendojr
    @arozendojr Год назад

    What is the safest way to send firebase data in ionic?

  • @j4ck3
    @j4ck3 Год назад

    If you want to use a context. where is the best place to warp the context provider? i have my index on the same level as my login and register screens/components

    • @galaxies_dev
      @galaxies_dev  Год назад

      Context should be in the top _layout, as this will always be applied!

  • @VHM_Dev
    @VHM_Dev 4 месяца назад +1

    Great stuff. It actually helped me to understand how using Stack works - godsend!!

  • @edena276
    @edena276 9 месяцев назад +2

    You speak and do thing fast, love it !!!

  • @drivekashmir7049
    @drivekashmir7049 Месяц назад +1

    thank you very much i was lot confused about the index gile

    • @galaxies_dev
      @galaxies_dev  Месяц назад

      If you enjoyed it, maybe you can share the channel with your RN colleagues ✌️

  • @yankelmelloul8245
    @yankelmelloul8245 2 месяца назад

    How can we keep the bottom tab bar after the push ?

  • @CalvinTeixeira
    @CalvinTeixeira 3 месяца назад +1

    i was getting crazy trying to create nested routes inside tabs, every time i created a new route it was creating a new tab... the point is the use of _layout.tsx inside my tab screen folder (like your /home/_layout.tsx)... thank you!!!!!!! i must to say that i've searching for a solution even the IA and even that can't help me until now!! hahahahha ty again!

  • @karldtrumpeter
    @karldtrumpeter Год назад +1

    Thanks. This helped me a great deal.

  • @ethanjones9578
    @ethanjones9578 15 часов назад

    This was very helpful, thank you! I am trying to do somethign similar to this with one exception. Is there a way to navigate from a tab directly to a screen with a hidden tab bar? For instance, your 'list' tab navigated to a screen that linked to a 'New One' screen which did not have that tab bar. Is there a way to skip the middle screen and have the 'New One' screen be represented in the tab bar? Think of the 'new post' button in Instagram's tab bar. When the user presses on 'new post' it navigates to directly to a screen without the tab bar.

  • @cbHasib
    @cbHasib Месяц назад

    Thank you so much, Simon, for your great content. I am facing some issues with nested routes. In my case, the parent layout is a Tab (Tab 1, Tab 2, Tab 3). I have a nested stack layout inside each tab.
    Suppose I am on Tab 1 and there is a link that routes to Tab 2 > Screen 3 (not the initial route). Now, on Tab 2, I can't go back to the main screen of Tab 2. It gets stuck on Screen 3 (clicking on Tab 2 does not route me to the main screen of the Tab 2). It would be great if you could give me a solution or make a short video about that.
    Thank you so much! 💖💖

  • @korkechoussama5116
    @korkechoussama5116 4 месяца назад

    that was exaactly what i was looking for ty man

  • @tomhopkinslondon
    @tomhopkinslondon 5 месяцев назад +1

    This is a really helpful intro. Many many thanks.

  • @trollflix
    @trollflix Год назад +2

    I am getting "Unmatched Route" error, even though i just copied everything you did. I think there is some diff b/n JS and TS about routing. How to make this work on JS project, without TS?

    • @darkwoodmovies
      @darkwoodmovies 8 месяцев назад

      I was having the same issue with TS. My issue was that I stupidly put the (tabs) folder under src/(tabs) instead of src/app/(tabs)

  • @davidadokuru8139
    @davidadokuru8139 Год назад +2

    Thanks
    This is what I did to solve it. I was wondering if there was a better way 😅

  • @mata3649
    @mata3649 22 дня назад +1

    Thanks mate really helpful stuff 👍

    • @galaxies_dev
      @galaxies_dev  19 дней назад +1

      If you enjoyed it, you could share the channel with your RN buddies ✌️
      Thanks!

  • @lolekakaa
    @lolekakaa 11 месяцев назад

    Thats great tutorial! I have a question, Is it possible to combine Tab Bar Nav with Drawer in Expo, as I spent hours to do so unsuccessfully. I would like the bottom menu to be Tab Bar Nav, and also have the option to call Drawer Nav for example as an app settings menu. Thanks in Advance!

    • @galaxies_dev
      @galaxies_dev  10 месяцев назад

      Yes absolutely! Will prepare a new stream about all the different ways to handle this!

  • @vitor-is5od
    @vitor-is5od 11 месяцев назад +1

    i never work with mobile development. Do you think that is a good idea start by expo? Or should I learn react-native concepts first? I only choose expo, because seems to be a new react-native patterns (something similiar to CRA in react web dev)

    • @galaxies_dev
      @galaxies_dev  11 месяцев назад +1

      Expo is React Native, and everyone agrees that starting with Expo is the right way in 2023! So yes, use Expo and get started with React Native - it just helps with a lot of things :)

    • @vitor-is5od
      @vitor-is5od 11 месяцев назад

      @@galaxies_dev ok! :). Thankss

  • @JordanHesse
    @JordanHesse Год назад

    Hi Simon, nice video!
    I was wondering if its possible to navigate between two tabs programatically without the user clicking the tab at the bottom.
    Say there is a button in the home tab which when the user clicks it brings the list tab into view?

    • @JordanHesse
      @JordanHesse Год назад

      Nevermind, I figured it out. I just did router.push("route/to/tab") and it worked. I wish the documentation was more thorough.

    • @galaxies_dev
      @galaxies_dev  Год назад

      Yeah it's sparse, so if you got any questions, let us know in our Galaxies Discord channel!

  • @glaze4629
    @glaze4629 9 месяцев назад

    I'm really new to this concept of file based navigation, if every file is route and so do folders are, how does one organizes these files and folders? For instance i usually have screens on its own folder and sometimes within this folder i also have a components folder with ui speficic componentes to this screen as well as a styles file. How can you ignore files and folders with this system? I'd like to ignore this components folder (including all the files inside it) as well as any .tsx file of my desire, thank you before hand if you know how!

    • @galaxies_dev
      @galaxies_dev  9 месяцев назад

      You can have folders at the top level next to the app directory and have like hooks, features, whatever.. Simply somewhere else but not in that folder!

  • @MrSlim-yf7xo
    @MrSlim-yf7xo Месяц назад

    at 7:13 how we remove "< (tabs)" ?
    thnk you

  • @alfangr
    @alfangr 18 дней назад

    Thanks perfect tutorial.

  • @alistairholt
    @alistairholt Год назад +12

    You did a much better job than the docs and example repos. I spent a few hours on this as it’s completely counter intuitive to do things this way. I wouldn’t say Expo Router is anywhere near being ready for production especially given the state of the docs. It’s far simpler to just use React Navigation directly right now.

    • @galaxies_dev
      @galaxies_dev  Год назад

      It is a mindset shift, I agree. But it also simplifies things later on, so I think it's worth investing time into it - especially with Expo Router v2 out now!

  • @cfo3049
    @cfo3049 10 месяцев назад

    Is it possible to implement a home/splash screen without all those tab bars and headers? I need to create a home screen with a button. This button navigates to the tab bar home screen. In React Navigation it's easy. I hope you know what I mean. best regards

    • @galaxies_dev
      @galaxies_dev  10 месяцев назад +1

      Sure, you can design this with layout files and simply not use a specific Stack layout for that home page! Will also do a tutorial on all things router soon again.

  • @artemalekseev2360
    @artemalekseev2360 Год назад

    How do you implement drawer in here? is it a folder like (drawer) ?

    • @galaxies_dev
      @galaxies_dev  Год назад

      Yes you would define the drawer in your layout and have the files next to it, just like with tabs: expo.github.io/router/docs/migration/react-navigation/drawer-navigator

  • @shinypants2204
    @shinypants2204 11 месяцев назад +1

    good stuff! thank you

  • @benadams8998
    @benadams8998 6 месяцев назад

    Great video! Did anyone manage to replace (tabs) in the header when navigating backwards to say something else like the name of the page you came from or using the word "Back"?

    • @galaxies_dev
      @galaxies_dev  6 месяцев назад

      You should be able to set the headerBackTitle

  • @homerreal
    @homerreal 9 месяцев назад +1

    Simply, Thanks

  • @frankfu1122
    @frankfu1122 3 месяца назад

    Hi may I ask what extensions you used for code completion when you type ‘rnf…’

    • @galaxies_dev
      @galaxies_dev  3 месяца назад +1

      I think it's this: marketplace.visualstudio.com/items?itemName=jundat95.react-native-snippet

    • @frankfu1122
      @frankfu1122 3 месяца назад

      @@galaxies_dev thanks!

  • @formerly_chucks
    @formerly_chucks 4 месяца назад +1

    Dude you just saved my bacon, thank you so much for this vid!

  • @fernandolara630
    @fernandolara630 Год назад +1

    Great video Simon! I like how you explain everything, most tutorials feel slow for people that are already familiar with React

    • @galaxies_dev
      @galaxies_dev  Год назад

      Happy I had the right pace in this video :)
      If you enjoyed it, maybe you can share the channel with your RN colleagues ✌️

  • @junioroga
    @junioroga 5 месяцев назад

    Thank you very much for the video, really clarifying.
    I have 3 questions, I am doing the migration in a medium-sized project, with a mixed navigation of Tabs with Stack in each Tab.Screen.
    1 - What is the best way to do this on the Expo router? I've seen several videos, docs and tutorials and I'm skating. I'm having a lot of difficulty.
    2 - Can I point out the Expo Router Stacks while keeping the screen files in the src/screens folder?
    3 - How to reuse the same screen in 2 different stacks? I have a screen that repeats in 2 stacks.
    Could you make a video about this, I believe that most React Navigation projects have these characteristics that I am having difficulty with.

  • @galaxies_dev
    @galaxies_dev  Год назад

    Become a Stellar React Native dev @ galaxies.dev 🚀

  • @yutsacarm8021
    @yutsacarm8021 Месяц назад

    why do we need 2 lists ?
    one inside the tab one under the root folder
    why not just one

  • @aomafura3374
    @aomafura3374 Год назад

    Is it possible to transfer the tab bar from the bottom to the top of screen?

    • @galaxies_dev
      @galaxies_dev  Год назад

      I'm not sure, only thing I found is this experimental package from Evan: github.com/EvanBacon/expo-router-top-tabs

  • @user-sj5in5lt8s
    @user-sj5in5lt8s Год назад

    This video is amazing!

  • @davidadokuru8139
    @davidadokuru8139 Год назад +3

    Thanks😊

  • @delanick
    @delanick 2 месяца назад

    Can a person use Expo Router with Javascript file sinstead of TypeScript? I prefer JS and would just like to know.

    • @gentlekboy
      @gentlekboy Месяц назад

      Yes, you can. However, it's preferable to use Typescript to avoid some unnecessary bugs.

  • @khaledsanny4817
    @khaledsanny4817 Год назад +3

    Thank you ☝😉... make a video on expo router authentication implementation with ... i dont know... appwrite or firebase ?

  • @desislavanedeva9209
    @desislavanedeva9209 3 месяца назад

    does expo router is used for real projects, like react navigation library? thanks

  • @z1haze
    @z1haze 10 месяцев назад

    so you have to keep duplicating the same layout file if you want to nest routes within the tab bar and still show the tab bar? That doesn't seem right, I hope I am misunderstanding

    • @galaxies_dev
      @galaxies_dev  10 месяцев назад

      I guess you could group them like (tab1,tab2) as the folder name and then reuse them!

  • @baron_adams
    @baron_adams Год назад +1

    Hi Simon and thanks for your video. Can you make a video where you make an application with a drawer menu and with top swiper tabs in expo-router? Please

    • @galaxies_dev
      @galaxies_dev  Год назад +2

      Top tabs, interesting. Will see what I can do!

    • @davidadokuru8139
      @davidadokuru8139 Год назад

      I did this in the same project,
      I brought in react navigation top tabs
      And it worked easily with expo router

  • @MrAvelino2010
    @MrAvelino2010 11 месяцев назад +2

    Congratulations 👏. Can you make a series of clean architecture in React Native projects, cover pattern like atomic design and how to apply it in React Native Projects. I have been thinking build an app for authentication I wanna use third services such firebase auth or clerk, and maybe later change to another provider, with good practices to avoid accomplishment with one specific provider follow strategy pattern or other one for a particular case
    Also build from scratch or use one of your existent project to convert into PWA using expo.

    • @galaxies_dev
      @galaxies_dev  11 месяцев назад +1

      Thanks for the ideas - noted!

  • @Kevin-jc1fx
    @Kevin-jc1fx Год назад +1

    That looks cool. Is it ready for production yet?

    • @galaxies_dev
      @galaxies_dev  Год назад +1

      Well v1 is stable as they say here: expo.github.io/router/docs/

  • @emenikeanigbogu9368
    @emenikeanigbogu9368 Год назад +1

    thank you man

  • @hafsahabibs
    @hafsahabibs 8 месяцев назад

    If i want to hide my tab bar from
    One of the screens using expo router. How to do that in my react native app?

    • @galaxies_dev
      @galaxies_dev  8 месяцев назад

      Usually you want to have that screen one level higher than the tabs layout so it's wrapped in a Stack and gets pushed!

    • @hafsahabibs
      @hafsahabibs 8 месяцев назад

      @@galaxies_dev thanks for your reply. Currently, the parent route is /home/ and the dynamic route I am looking to remove the tabbar is is /home/marketplace/search/[id]. Here id is creates a dynamic route. How will the solution your provided work in this case?

    • @hafsahabibs
      @hafsahabibs 8 месяцев назад

      I figured that out, I moved [ad] folder out of the (home) directory and it worked like a charm. Thank you so much.

  • @oussamasethoum1665
    @oussamasethoum1665 3 месяца назад

    How can we have transition between tabs when navigating?

    • @galaxies_dev
      @galaxies_dev  3 месяца назад +1

      I think not yet with the default tabs based on React Navigation.

  • @paysnug4470
    @paysnug4470 7 месяцев назад

    The background in tab is not working please help

  • @IRazerIGhost
    @IRazerIGhost 5 месяцев назад +1

    Somehow the articles i followed excluded the index file which constantly gave me unmatched routes :/ Thank you for saving me and making me learn some more about expo routs!

  • @davidlintin
    @davidlintin Год назад

    Hi. Can you please ask your buddies @expo how to hide a tab bar within a nested stack inside a tabbar thanks 😅

    • @davidadokuru8139
      @davidadokuru8139 Год назад +3

      That’s what he is showing in this video
      I asked the question in the last video.

  • @aroyanbs
    @aroyanbs Год назад +1

    Awesome

  • @kingdre2485
    @kingdre2485 10 месяцев назад

    We need a run through of a top tab with expo router

  • @mrlectus
    @mrlectus 11 месяцев назад

    I am getting Attempted to navigate before mounting RootLayout Component

  • @bullettime2808
    @bullettime2808 11 месяцев назад +1

    This works but the route outside the tabs is mounted twice and the animation also plays twice I think I'm gonna just refactor the whole app to use react navigation directly I've wasted like 6-7 hours trying to fix it

    • @galaxies_dev
      @galaxies_dev  11 месяцев назад

      Why is it mounted twice? There are some edge cases with Router that are not perfect yet, but usually it's an issue of the setup (and maybe not 100% complete docs)

    • @bullettime2808
      @bullettime2808 11 месяцев назад

      @@galaxies_dev it was a bug in expo router, It just got fixed 2 days ago with v2.0.4

  • @restenmadzalo1029
    @restenmadzalo1029 10 месяцев назад +1

    Please make a tutorial on how to customize and change theme in tamagui

    • @galaxies_dev
      @galaxies_dev  10 месяцев назад

      Alright will talk about Tamagui soon!

  • @valentinsoto7533
    @valentinsoto7533 7 месяцев назад

    Gracias hermano

  • @zon6423
    @zon6423 Год назад

    Why is my (tabs) constantly displayed on the screen?

    • @zon6423
      @zon6423 Год назад

      sorry,when I continue watching,I find the answer.

  • @cfo3049
    @cfo3049 8 месяцев назад

    It would be helpfull, you make a video, about pass API-data from one tab to another tab, with TS an expo-router.🙏

    • @galaxies_dev
      @galaxies_dev  8 месяцев назад

      You would either have to use state or only pass an ID and retrieve the details on the following page!

  • @newtonsarr1234
    @newtonsarr1234 Месяц назад

    Why don' t you do drawer-navigation with dynamic routes on expo ?

    • @galaxies_dev
      @galaxies_dev  27 дней назад

      Because this video was about tabs, but you can do drawer easily as well!

  • @Juju-ch5it
    @Juju-ch5it Год назад

    How did you do that 'rnfe' TAB short cut to create the index.js component?

    • @JEsterCW
      @JEsterCW Год назад +1

      Hes a Wizard

    • @galaxies_dev
      @galaxies_dev  Год назад

      I like how you think, but the snippets are simply part of this extension: marketplace.visualstudio.com/items?itemName=dsznajder.es7-react-js-snippets

  • @simplexble3188
    @simplexble3188 Месяц назад

    what about navigation

  • @yucelduz4897
    @yucelduz4897 10 месяцев назад

    test,
    headerTitle: "title",
    headerTitleAlign: "center",
    headerTitleStyle: {
    fontSize: 25,
    fontWeight: 'bold',
    color: 'red'
    },
    headerStyle: {
    backgroundColor: 'orange',
    }
    }}
    />
    Error -> The `redirect` prop on is deprecated and will be removed. Please use `router.redirect` instead
    what is problem and how to fix

  • @victorzerefos6557
    @victorzerefos6557 Год назад

    Hi there Simon, thanks a lot for the tutorial. There one thing I'm a little confused about, you showed how to use a tab screen as your first screen and How can we make a first screen with no tabbar and the second screen we navigate with a tabbar?

    • @galaxies_dev
      @galaxies_dev  Год назад

      You would need a layout file above the tabs layout - I think I'll do another detailed video on it now with router v2!

    • @victorzerefos6557
      @victorzerefos6557 Год назад

      @@galaxies_dev that would be amazing! thank you very much for the amazing content you share with us on youtube!

  • @ahmedhamed5093
    @ahmedhamed5093 11 месяцев назад

    better than docs wow, any source code for that ?

    • @galaxies_dev
      @galaxies_dev  10 месяцев назад

      All linked in the description!

  • @msahu2595
    @msahu2595 Месяц назад

  • @br4ndon364
    @br4ndon364 Год назад

    Still don't know how to actually customize each tab

    • @michelro
      @michelro Год назад

      You can pass options to each Tab.Screen or to the Tab to do different things with then like hiding, changing the label and much more

  • @Matheus_1582
    @Matheus_1582 Год назад

    Show👍

  • @jskaall
    @jskaall Год назад +1

    Expo Router seems very messed up, it’s hard to understand, the docs are awful/useless and theres no big advantage on using it

    • @galaxies_dev
      @galaxies_dev  Год назад

      Trying my best to answer questions around it!

  • @mrd.j.2303
    @mrd.j.2303 11 месяцев назад +1

    Good info.. but who are you racing? Lol. I never understand why people put out tutorials and then talk and work as fast as humanly possible. I’m trying to wrap my head around these dynamic routes. With an image modal

    • @galaxies_dev
      @galaxies_dev  11 месяцев назад

      Sorry, will try to take more time to explain next time!

    • @mrd.j.2303
      @mrd.j.2303 11 месяцев назад

      @@galaxies_dev lol thanks. It’s not just you. I get that you’re excited and that’s awesome. Just a little too fast for me. Some people sound really weird at .75 speed lol

    • @gentlekboy
      @gentlekboy Месяц назад

      For the very first time, I had to slow down the speed of a RUclips video to 0.5x 😂😂

  • @jeegargoyani
    @jeegargoyani 7 месяцев назад

    it's really helpful and easy understand for the tab bar in expo-route. can you do one thing simon can we do the live talk for more about expo route so you and we can share the ideas each other. I think sound go. what do you think @simon