How to create stack of screens in react native?
import React from 'react';
import { View, Text } from 'react-native';
import { createAppContainer } from 'react-navigation';
import { createStackNavigator } from 'react-navigation-stack';
class HomePage extends React.Component {
render() {
return (
<view>
<text>Home Page</text></view>
);
}
}
class DetailPage extends React.Component{
render(){
return (
<view>
<text>Detail Page</text></view>
)
}
}
const AppNavigator = createStackNavigator({
Home: HomePage,
Details: DetailPage,
},
{
initialRouteName: 'Home',
});
export default createAppContainer(AppNavigator);
BY Best Interview Question ON 18 Jan 2020