Skip to content
Snippets Groups Projects
Commit 7d2ad5dc authored by Lukas Nicholas Tveiten's avatar Lukas Nicholas Tveiten
Browse files

#2 - Added support for theming and other small changes

parent ca23fe82
No related branches found
No related tags found
No related merge requests found
import React from 'react';
import { StyleSheet } from 'react-native';
import { DefaultTheme, Provider as PaperProvider } from 'react-native-paper';
import { Provider } from 'react-redux';
import { store } from './redux/store';
import Constants from 'expo-constants';
import { NavigationContainer } from '@react-navigation/native';
import { NavigationContainer, Theme } from '@react-navigation/native';
import { createStackNavigator } from '@react-navigation/stack';
import MoviePage from './components/movie/moviepage';
import SearchPage from "./components/search/searchpage";
const statusBarHeight : number = Constants.statusBarHeight
export default function App() {
......@@ -16,7 +15,8 @@ export default function App() {
return (
<Provider store={store}>
<NavigationContainer>
<PaperProvider theme={theme}>
<NavigationContainer theme={navTheme}>
<Stack.Navigator initialRouteName="Search">
<Stack.Screen
name="Search"
......@@ -31,6 +31,7 @@ export default function App() {
</Stack.Navigator>
</NavigationContainer>
</PaperProvider>
</Provider>
);
}
......@@ -40,7 +41,25 @@ const styles = StyleSheet.create({
flex: 1,
backgroundColor: '#fff',
alignItems: 'center',
justifyContent: 'center',
marginTop: statusBarHeight + "px"
justifyContent: 'center'
},
});
const theme : ReactNativePaper.Theme = {
...DefaultTheme,
// Specify custom property in nested object
colors: {
...DefaultTheme.colors,
backdrop: '#BADA55',
}
};
const navTheme : Theme = {
dark: false,
colors: {
...theme.colors,
card: "white",
text: "black",
border: theme.colors.primary,
}
}
\ No newline at end of file
......@@ -60,5 +60,13 @@ export function searchParamsReducer(state : SearchParams = {
newState = state;
break;
}
if (!searchParamsEquals(state, newState))
return newState;
else
return state;
}
// Just a simple equal check so that it doesn't detect a new change when no actual value have changed
function searchParamsEquals(param1 : SearchParams, param2 : SearchParams) : boolean {
return JSON.stringify(param1) === JSON.stringify(param2);
}
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment