title: React native switch screen one component to another on button press
body: <p>I am new in react native, making a basic app that will find no of cases of corona in every country 
  so i have made 2 component both on separate file. how to switch from child to child component ?
  Now i want to switch between them when i click on a button using stack navigator</p>
  
  <p><strong>App.js</strong></p>
  
  <pre><code>import 'react-native-gesture-handler';
  import React from 'react';
  import { NavigationContainer } from '@react-navigation/native';
  import { createStackNavigator } from '@react-navigation/stack';
  import Splash from './scenes/splash';
  import Corona from './scenes/corona';
  
  const Stack = createStackNavigator();
  
  export default function App() {
    return (
      &lt;NavigationContainer&gt;
        &lt;Stack.Navigator initialRouteName="Splash"&gt;
          &lt;Stack.Screen name="Splash" component={Splash} /&gt;
          &lt;Stack.Screen name="Corona" component={Corona} /&gt;
        &lt;/Stack.Navigator&gt;
      &lt;/NavigationContainer&gt;
    );
  }
  </code></pre>
  
  <p><strong>splash.js</strong></p>
  
  <pre><code>import React from 'react'
  import { StyleSheet, Text, View, Image, Button} from 'react-native';
  
  export default function splash({navigation}) {
      return (
              &lt;View style={styles.container}&gt;
                  &lt;Image 
                  source={require('../assets/corona.jpg')} 
                  resizeMode="cover" style={styles.img} /&gt;
                  &lt;Text style={styles.txt}&gt;
                      Track the current status {"\n"} 
                      of the COVID-19 and{"\n"}
                      stay up to date.&lt;/Text&gt;
                  &lt;Text 
                  style={styles.btn}
                  onPress={() =&gt; this.props.navigation.navigate('Corona')}
                  &gt;Continue&lt;/Text&gt;
              &lt;/View&gt;
      )
  }      
  
  </code></pre>
  
  <p><strong>corona.js (navigate to here)</strong></p>
  
  <pre><code>import React from 'react'
  import { StyleSheet, Text, View, Image, Button} from 'react-native';
  
  export default function corona({navigation}) {
      return (
          &lt;div&gt;
              &lt;View&gt;
                  &lt;Text&gt;Hello next screen&lt;/Text&gt;
              &lt;/View&gt;
          &lt;/div&gt;
      )
  }
  
  </code></pre>