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

165
Visualizações
How to display another icon when tab is active in Ionic React?

I have this tab-bar where active elements have another icon than inactive:

enter image description here

It will also change the item with the onIonTabsDidChange-hook from IonTabBar:

const [activeTab, setActiveTab] = useState<string>()

return 
<IonTabBar onIonTabsDidChange={(event) => setActiveTab(event.detail.tab)}>
  <IonTabButton  tab="explore" href="/explore">
    {activeTab === 'explore' ? <HomeIconSolid /> : <HomeIcon />}
  </IonTabButton>
  <IonTabButton tab="game" href="/game" >
    {activeTab === 'game' ? <PlayIconSolid/> : <PlayIcon />}
  </IonTabButton>
</IonTabBar>

My problem is that when the page is loaded first time (without any change Tab events) it will not display the correct item:

enter image description here

How can I achieve to set the icon at first load as well?

  • I'm not able to define a default! Because users could enter the page from a different url (e.g.: game is the first page)
  • I searched for an init / load hook but didn't find one
about 4 years ago · Juan Pablo Isaza
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