Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

476
Visualizações
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 Respostas
Responde à pergunta

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 Relatório

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda