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

319
Views
React ScrollableTabView onChangeTab

I have an application with 3 tabs, what I want to achieve is that the floating button icon changes when changing tab

For that I have the onChangeTab function and the changeState, but I can't get it out. Now when executing I get

Can't find variable: index

The library I'm using is react native scrollable tab view, can someone help me??

Thanks!!

    export default class App extends Component{

      changeState =(i, ref) => {
        this.setState({index : i})
      }
 
      render() {
   
       return(
       
      <View style={styles.contentContainer}>
       <ScrollableTabView
       tabBarUnderlineIcon="#fff"
       tabBarUnderlineStyle={{backgroundColor: "#fff"}}
       tabBarActiveTextColor="#fff"
       tabBarInactiveTextColor="#ddd"
       tabBarBackgroundColor="#075e54"
       onChangeTab={({i,ref}) => this.changeState(i,ref)}
      >
       <Chats tabLabel="CHATS" />
       <States tabLabel="STATES" />
       <Calls tabLabel="CALLS" />
           
     </ScrollableTabView>
     </View>
     <ActionButton buttonColor="#075e54"
       icon={<Icon name={index === 1 ? 'chat' : index === 2 ? 'call' : 'photo-camera'}></Icon>}
     />
   </View>
   )
 }
}
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

you need to define an initial state

this.state = {
  index: 0
}
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!