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

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

0

you need to define an initial state

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