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

266
Visualizações
How can I send text taken from user to another screen to display it in <text> in react native? (I am a beginner)
**App.js**

    function App() {
  const[getScreen, showScreen] = useState(false);  
  const[getEmail, setEmail] = useState("");  
  return (  
    <View>
   <LoginScreen/>  
    <LoginContexts.Provider value={{getEmail,setEmail,getScreen,showScreen}}>  
    {showScreen ? < Screen2/> : < LoginScreen />
    </LoginContexts.Provider>
    
  </View>
  );
}


export default App;


**Login**


function LoginScreen ({navigation}){   
   

const {getEmail,setEmail, showScreen} = useContext(LoginContexts);    
   
    
   


    function gotEmail(inputEmail){
        setEmail(inputEmail)
    }





    return(
        <View style={styles.container}>
            <Text style={styles.loginText}>Login</Text>


            <View style={styles.textInput}>
                <TextInput  placeholder='Please enter your email'
                defaultValue={getEmail}
                onChange={gotEmail}/>
            </View>

            <View style={styles.space}/>

            <View style={styles.passwordStyle}>
                
                <TextInput 
                 placeholder='password' 
                secureTextEntry
                autoCorrect={false}
                autoCapitalize='none'
                />
           
            </View>


            <View style={styles.space}/>

            <View>
                <Button style={styles.loginBTN} title="Login"
                onPress={() => {showScreen(true)}} />
            </View>
            </View>


        );
}



export default LoginScreen;


**Screen 2**

function Screen2() {
  
    const {getEmail} = useContext(LoginContexts);
    return (
      <View style={{ flex: 1, alignItems: 'center', justifyContent: 'center' }}>
       
        <Text>{getEmail}</Text>;
   
      </View>
    );
  }

export default Screen2;


**LoginContext**  <-- used context api


import { createContext} from "react";

export const  LoginContexts = createContext({});

Could you please tell me that why data is not going to another page ?? I used useContext but I am not able to send data to another page. Please help me to solve this problem.

In this I had taken input from user as email and I want to display that email in text view in another page but I am unable to do that. On button click nothing happens. please help me.

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