Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

472
Views
Configuring React Navigation on web: hiding bottom tab bar based on platform

Looking for general advice on best practices for adapting React Navigation for web. I would like to move the bottom tabs(in native) to the top(on web) for instance? What's a good approach for doing that? Is there a way to hide/show/change navigation based on platform?

about 4 years ago · Juan Pablo Isaza
2 answers
Answer question

0

Turned out to be easier than I thought. Thank you @Drew Reese

If the following is your root navigator for instance -:

function RootNavigator() {

  return (
    <Stack.Navigator>
        <Stack.Screen name="authNav" component={AuthNavigator} />
        <Stack.Screen name="main" component={MainNavigator} />
    </Stack.Navigator>
  );
}

If you'd like for your web app to load the main navigator as a sidebar, and for your natives to load the main navigator as a bottom navigator, for example, create a bottom tabs navigator in MainNavigator.native.js and a sidebar(drawer navigator with drawerType set to permanent) in MainNavigator.js.

Even the import remains that same. Efficient!

import MainNavigator from './MainNavigator'

about 4 years ago · Juan Pablo Isaza Report

0

You can accomplish this in at least two different ways, though I think the better one is with media queries.

Media queries

One way to do that is with Media Queries, where you basically check against screen sizes.

You can render conditionally for current screen size being in a particular range, or smaller or larger than a particular size.

Here is a Guide to Media Queries from CSS Tricks

I'll abbreviate with xs, sm,md,lg,xl for certain sizes (extra-small, small, medium, large, extra-large).

In your scenario

So basically, you can then render the tabs (or any UI element, really) or hide them, or apply css conditionally.

User Agent

Another way you could do this is with the User Agent.

You could check for platform specific strings such as Android, iPhone, iPad, Macintosh etc.

const { userAgent } = window.navigator

console.log(userAgent)
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!