Commit 203b5895 authored by Thor-Herman's avatar Thor-Herman
Browse files

Setup Routing in App #12

parent bb1dd536
import { Route, Switch } from 'react-router-native';
import BrowsePage from '../pages/BrowsePage';
import LandingPage from '../pages/LandingPage';
import MoviePage from '../pages/MoviePage';
......@@ -9,6 +8,15 @@ import { Ionicons } from '@expo/vector-icons';
import { Container, Footer, Icon, Input, Item, Left, Text } from 'native-base';
import SearchBar from './SearchBar';
import Header from './Header';
import { createStackNavigator } from '@react-navigation/stack';
import { NavigationContainer } from '@react-navigation/native';
export type StackParamList = {
Browse: undefined;
Movie: { id: number };
};
const Stack = createStackNavigator<StackParamList>();
const App = () => {
let [fontsLoaded] = useFonts({
......@@ -22,11 +30,14 @@ const App = () => {
}
return (
<Container>
<Header />
<Route exact path='/' component={BrowsePage} />
<Route path='/movie/:movieId' component={MoviePage} />
</Container>
<NavigationContainer>
<Container>
<Stack.Navigator initialRouteName='Browse'>
<Stack.Screen name='Browse' component={BrowsePage} />
<Stack.Screen name='Movie' component={MoviePage} />
</Stack.Navigator>
</Container>
</NavigationContainer>
);
};
......
......@@ -3,16 +3,13 @@ import createStore from './store';
import App from './components/App';
import React from 'react';
import { Provider } from 'react-redux';
import {NativeRouter} from 'react-router-native';
const store = createStore();
const ReduxApp = () => {
return (
<Provider store={store}>
<NativeRouter>
<App />
</NativeRouter>
</Provider>
);
};
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment