title: I have a problem in navigation in react-native while using the Axios
body: <ol>
  <li>I want to navigate to a new page when the email and password is correct(when click the button) .</li>
  <li>ie while click button I i want to check API and navigate to another page ,if email and password is
  correct</li>
  <li>Here I use AXIOS for API integration.</li>
  </ol>
  <p>---------This is my code----------</p>
  <pre><code>import React, {useState} from 'react';
  import {View,Text, TextInput, Button} from 'react-native';
  import axios from 'axios';
  import { useNavigation } from '@react-navigation/native';
  const NewsCard = ()=&gt;{
  
    
    const navigation = useNavigation();
  
  
    const [email, setEmail] = useState(&quot;&quot;);
    const [password, setPassword] = useState(&quot;&quot;);
     const[name ,setName] = useState('namesssssssss')
      return(       
          &lt;View&gt;   
              &lt;Text&gt;{name}&lt;/Text&gt; 
              &lt;TextInput
            
            autoCorrect={false}
            autoCapitalize=&quot;none&quot;
            keyboardType=&quot;email-address&quot;
            onChangeText={ (text) =&gt; setEmail(text)}
            value={email}
          /&gt;
  
          &lt;TextInput
           
            
            autoCorrect={false}
            autoCapitalize=&quot;none&quot;
            onChangeText={(pswrd) =&gt; setPassword(pswrd)}
            value={password}
          /&gt;
              &lt;Button onPress={ ()=&gt;
  axios.post('http://10.0.2.2:5000/api/admin/login',
  {
    email: email,
    password: password,
  })
  .then(function (response) {
    // handle success
    console.log(response.data);
  })
  .catch(function (error) {
    // handle error
    alert('Wrong Email or Password');
  })
  .then(function () {
  })
             } title=&quot;Click&quot;&gt;&lt;/Button&gt;
          &lt;/View&gt;   
      )
  }
  
  export default NewsCard
  </code></pre>