Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

317
Vistas
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 Respuestas
Responde la pregunta

0

you need to define an initial state

this.state = {
  index: 0
}
about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda