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

163
Views
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
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!