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

161
Visualizações
Log out button in drawer navigation - React native

Im trying to implement a button Log out into the drawer navigation. I have the function signOut that I want to call when I clcik on the button Log out from the drawer navigation :

App.js :

 const AppHomeTeacherDrawerNavigator = createDrawerNavigator({
  Home: {
    screen: Home,
    navigationOptions: {
      title: "Menu",
      drawerIcon: () => <Icon name="home" size={25} />,
    },
  },

  SettingsScreen: {
    screen: SettingsScreen,
    navigationOptions: {
      title: "Log out",
      drawerIcon: () => <Icon name="settings" size={25} />,
    },
  },
}); 

SettingsScreen.js :

export default class SettingsScreen extends React.Component {
  signOut = async () => {
    try {
      await firebase.auth().signOut();
      this.props.navigation.navigate("WelcomeScreen");
    } catch (error) {
      Alert.alert("", "");
    }
  };


  render() {
    return (
      <View>
       <CustomValidationButton onPress={this.signOut}>
              <Text>Log out</Text>
            </CustomValidationButton>
      </View>  
    );
  }
}

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