React Native Tab Bar Routing with Expo Router

Поділитися
Вставка
  • Опубліковано 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
    #############################
  • Наука та технологія

КОМЕНТАРІ • 136

  • @ChrisPrakoso
    @ChrisPrakoso 8 місяців тому +8

    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.

  • @rapepongpitijaroonpong1036
    @rapepongpitijaroonpong1036 11 місяців тому +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  10 місяців тому

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

  • @michelro
    @michelro 11 місяців тому +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  10 місяців тому

      Yeah finally figured that out as well :D

  • @Baconbrix
    @Baconbrix 11 місяців тому +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  11 місяців тому +2

      Ahh thank you Evan!!

    • @mrd.j.2303
      @mrd.j.2303 9 місяців тому

      What would be the better way?

  • @tusharnagar1398
    @tusharnagar1398 3 місяці тому +1

    Thanks dear for helping me to digest cool stuff easily.

  • @rafacanical
    @rafacanical 10 місяців тому +1

    I was looking for this! Thanks

  • @VHM_Dev
    @VHM_Dev 2 місяці тому +1

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

  • @klincoder
    @klincoder Рік тому +1

    Very useful and saved me time. Thank you.

    • @galaxies_dev
      @galaxies_dev  Рік тому

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

  • @CalvinTeixeira
    @CalvinTeixeira Місяць тому +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!

  • @rishabh1S
    @rishabh1S 3 місяці тому +2

    Exact Video, I needed!! Thanks Man

  • @edena276
    @edena276 7 місяців тому +1

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

  • @alistairholt
    @alistairholt 10 місяців тому +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  10 місяців тому

      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!

  • @brunovivaldodev
    @brunovivaldodev 7 місяців тому +1

    Great video, and good explanation

  • @tomhopkinslondon
    @tomhopkinslondon 3 місяці тому +1

    This is a really helpful intro. Many many thanks.

  • @korkechoussama5116
    @korkechoussama5116 2 місяці тому

    that was exaactly what i was looking for ty man

  • @karldtrumpeter
    @karldtrumpeter 10 місяців тому +1

    Thanks. This helped me a great deal.

  • @junioroga
    @junioroga 3 місяці тому

    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.

  • @davidadokuru8139
    @davidadokuru8139 Рік тому +2

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

  • @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 ✌️

  • @shinypants2204
    @shinypants2204 9 місяців тому +1

    good stuff! thank you

  • @tikod7236
    @tikod7236 10 місяців тому

    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

  • @formerly_chucks
    @formerly_chucks 2 місяці тому +1

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

  • @user-sj5in5lt8s
    @user-sj5in5lt8s 11 місяців тому

    This video is amazing!

  • @disminliguido
    @disminliguido 11 місяців тому

    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?

  • @homerreal
    @homerreal 7 місяців тому +1

    Simply, Thanks

  • @IRazerIGhost
    @IRazerIGhost 3 місяці тому +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!

  • @davidadokuru8139
    @davidadokuru8139 Рік тому +3

    Thanks😊

  • @vitor-is5od
    @vitor-is5od 9 місяців тому +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  9 місяців тому +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 9 місяців тому

      @@galaxies_dev ok! :). Thankss

  • @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 10 місяців тому +1

    thank you man

  • @jareeshcm444
    @jareeshcm444 8 місяців тому +1

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

  • @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

  • @arozendojr
    @arozendojr Рік тому

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

  • @kingdre2485
    @kingdre2485 8 місяців тому

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

  • @JordanHesse
    @JordanHesse 10 місяців тому

    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 10 місяців тому

      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  10 місяців тому

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

  • @MrAvelino2010
    @MrAvelino2010 9 місяців тому +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  9 місяців тому +1

      Thanks for the ideas - noted!

  • @trollflix
    @trollflix 10 місяців тому +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 6 місяців тому

      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)

  • @benadams8998
    @benadams8998 4 місяці тому

    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  4 місяці тому

      You should be able to set the headerBackTitle

  • @khaledsanny4817
    @khaledsanny4817 Рік тому +3

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

  • @j4ck3
    @j4ck3 10 місяців тому

    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  10 місяців тому

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

  • @lolekakaa
    @lolekakaa 9 місяців тому

    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  8 місяців тому

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

  • @yankelmelloul8245
    @yankelmelloul8245 4 дні тому

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

  • @valentinsoto7533
    @valentinsoto7533 5 місяців тому

    Gracias hermano

  • @frankfu1122
    @frankfu1122 Місяць тому

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

    • @galaxies_dev
      @galaxies_dev  Місяць тому +1

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

    • @frankfu1122
      @frankfu1122 Місяць тому

      @@galaxies_dev thanks!

  • @aroyanbs
    @aroyanbs 11 місяців тому +1

    Awesome

  • @cfo3049
    @cfo3049 6 місяців тому

    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  6 місяців тому

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

  • @delanick
    @delanick 29 днів тому

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

  • @glaze4629
    @glaze4629 7 місяців тому

    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  7 місяців тому

      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!

  • @restenmadzalo1029
    @restenmadzalo1029 8 місяців тому +1

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

    • @galaxies_dev
      @galaxies_dev  8 місяців тому

      Alright will talk about Tamagui soon!

  • @z1haze
    @z1haze 8 місяців тому

    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  8 місяців тому

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

  • @galaxies_dev
    @galaxies_dev  10 місяців тому

    Become a Stellar React Native dev @ galaxies.dev 🚀

  • @desislavanedeva9209
    @desislavanedeva9209 Місяць тому

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

  • @cfo3049
    @cfo3049 8 місяців тому

    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  8 місяців тому +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.

  • @jeegargoyani
    @jeegargoyani 5 місяців тому

    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

  • @mrlectus
    @mrlectus 9 місяців тому

    I am getting Attempted to navigate before mounting RootLayout Component

  • @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

  • @aomafura3374
    @aomafura3374 Рік тому

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

    • @galaxies_dev
      @galaxies_dev  11 місяців тому

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

  • @victorzerefos6557
    @victorzerefos6557 10 місяців тому

    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  10 місяців тому

      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 10 місяців тому

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

  • @bullettime2808
    @bullettime2808 9 місяців тому +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  9 місяців тому

      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 9 місяців тому

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

  • @paysnug4470
    @paysnug4470 5 місяців тому

    The background in tab is not working please help

  • @oussamasethoum1665
    @oussamasethoum1665 Місяць тому

    How can we have transition between tabs when navigating?

    • @galaxies_dev
      @galaxies_dev  Місяць тому +1

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

  • @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.

  • @hafsahabibs
    @hafsahabibs 6 місяців тому

    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  6 місяців тому

      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 6 місяців тому

      @@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 6 місяців тому

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

  • @yucelduz4897
    @yucelduz4897 8 місяців тому

    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

  • @Matheus_1582
    @Matheus_1582 Рік тому

    Show👍

  • @zon6423
    @zon6423 11 місяців тому

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

    • @zon6423
      @zon6423 11 місяців тому

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

  • @ahmedhamed5093
    @ahmedhamed5093 9 місяців тому

    better than docs wow, any source code for that ?

    • @galaxies_dev
      @galaxies_dev  8 місяців тому

      All linked in the description!

  • @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

  • @br4ndon364
    @br4ndon364 11 місяців тому

    Still don't know how to actually customize each tab

    • @michelro
      @michelro 11 місяців тому

      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

  • @jskaall
    @jskaall 10 місяців тому +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  10 місяців тому

      Trying my best to answer questions around it!

  • @mrd.j.2303
    @mrd.j.2303 9 місяців тому +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  9 місяців тому

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

    • @mrd.j.2303
      @mrd.j.2303 9 місяців тому

      @@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