Fix minor details

Signed-off-by: Nikolaos Karaolidis <nick@karaolidis.com>
This commit is contained in:
2023-07-09 10:36:21 +03:00
parent 2c5bd7cda2
commit a93630e1e9
5 changed files with 16 additions and 16 deletions

0
.env
View File

5
.gitignore vendored
View File

@@ -62,5 +62,8 @@ yarn-error.log
# Temporary files created by Metro to check the health of the file watcher # Temporary files created by Metro to check the health of the file watcher
.metro-health-check* .metro-health-check*
# testing # Testing
/coverage /coverage
# Environment variables
.env

View File

@@ -10,7 +10,8 @@ import { SettingsProvider } from './contexts/settings';
function App(): JSX.Element { function App(): JSX.Element {
const colorScheme = Appearance.getColorScheme(); const colorScheme = Appearance.getColorScheme();
const theme = colorScheme === 'dark' ? lightTheme : darkTheme; const isDarkMode = colorScheme === 'dark';
const theme = isDarkMode ? darkTheme : lightTheme;
return ( return (
<RealmProvider schema={[Meme, Tag]}> <RealmProvider schema={[Meme, Tag]}>
@@ -19,7 +20,7 @@ function App(): JSX.Element {
<SafeAreaProvider> <SafeAreaProvider>
<StatusBar <StatusBar
barStyle={ barStyle={
colorScheme === 'dark' ? 'dark-content' : 'light-content' isDarkMode ? 'light-content' : 'dark-content'
} }
backgroundColor={theme.colors.background} backgroundColor={theme.colors.background}
/> />

View File

@@ -1,22 +1,15 @@
import React from 'react'; import React from 'react';
import { ActivityIndicator, StyleSheet, View } from 'react-native'; import { ActivityIndicator } from 'react-native';
import { useTheme } from 'react-native-paper'; import { useTheme } from 'react-native-paper';
import PaddedView from './paddedView';
const styles = StyleSheet.create({
container: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
},
});
const LoadingView = () => { const LoadingView = () => {
const { colors } = useTheme(); const { colors } = useTheme();
return ( return (
<View style={[styles.container, { backgroundColor: colors.background }]}> <PaddedView centered>
<ActivityIndicator size="large" color={colors.primary} /> <ActivityIndicator size="large" color={colors.primary} />
</View> </PaddedView>
); );
}; };

View File

@@ -1,5 +1,6 @@
import React from 'react'; import React from 'react';
import { StyleProp, StyleSheet, View, ViewStyle } from 'react-native'; import { StyleProp, StyleSheet, View, ViewStyle } from 'react-native';
import { useTheme } from 'react-native-paper';
const styles = StyleSheet.create({ const styles = StyleSheet.create({
container: { container: {
@@ -20,9 +21,11 @@ const PaddedView = ({
children: React.ReactNode; children: React.ReactNode;
style?: StyleProp<ViewStyle>; style?: StyleProp<ViewStyle>;
centered?: boolean; centered?: boolean;
}): React.JSX.Element => { }): React.JSX.Element => {
const { colors } = useTheme();
return ( return (
<View style={[styles.container, centered && styles.centered, style]}> <View style={[styles.container, centered && styles.centered, { backgroundColor: colors.background }, style]}>
{children} {children}
</View> </View>
); );