Layout changes, beginning of new entry page
This commit is contained in:
parent
25a7b4da7b
commit
6a117db0ae
@ -1,8 +1,7 @@
|
||||
<resources xmlns:tools="http://schemas.android.com/tools">
|
||||
<style name="AppTheme" parent="Theme.EdgeToEdge.Light">
|
||||
<style name="AppTheme" parent="Theme.EdgeToEdge">
|
||||
<item name="android:editTextBackground">@drawable/rn_edit_text_material</item>
|
||||
<item name="colorPrimary">@color/colorPrimary</item>
|
||||
<item name="enforceNavigationBarContrast">false</item>
|
||||
</style>
|
||||
<style name="Theme.App.SplashScreen" parent="Theme.SplashScreen">
|
||||
<item name="windowSplashScreenBackground">@color/splashscreen_background</item>
|
||||
|
||||
@ -36,8 +36,8 @@ module.exports = {
|
||||
"react-native-edge-to-edge",
|
||||
{
|
||||
"android": {
|
||||
"parentTheme": "Light",
|
||||
"enforceNavigationBarContrast": false
|
||||
// "parentTheme": "Light",
|
||||
// "enforceNavigationBarContrast": false
|
||||
}
|
||||
}
|
||||
],
|
||||
|
||||
@ -19,110 +19,83 @@ export default function TabLayout() {
|
||||
const navigation = useNavigation();
|
||||
|
||||
return (
|
||||
<View style={{ flex: 1 }}>
|
||||
<View
|
||||
// Top status bar background
|
||||
style={{
|
||||
<SafeAreaView style={{ flex: 1, paddingBottom: 5 }} edges={['top', 'left', 'right']}>
|
||||
<ThemedView style={{ flex: 1 }}>
|
||||
<View style={{
|
||||
backgroundColor: theme.colors.onPrimary,
|
||||
position: 'absolute',
|
||||
top: 0,
|
||||
left: 0,
|
||||
right: 0,
|
||||
height: insets.top,
|
||||
backgroundColor: theme.colors.primary, // Or any custom color
|
||||
display: 'flex',
|
||||
flexDirection: 'row',
|
||||
alignItems: 'center',
|
||||
justifyContent: 'space-between',
|
||||
top: 20,
|
||||
left: 20,
|
||||
right: 20,
|
||||
borderRadius: 12,
|
||||
zIndex: 1000,
|
||||
}}
|
||||
/>
|
||||
<View
|
||||
// Bottom navigation bar background
|
||||
style={{
|
||||
position: 'absolute',
|
||||
bottom: 0,
|
||||
left: 0,
|
||||
right: 0,
|
||||
height: insets.bottom,
|
||||
backgroundColor: theme.colors.primary, // Or any custom color
|
||||
zIndex: 1,
|
||||
}}
|
||||
/>
|
||||
|
||||
<SafeAreaView style={{ flex: 1, paddingBottom: 5 }} edges={['top', 'left', 'right']}>
|
||||
<ThemedView style={{ flex: 1 }}>
|
||||
<View style={{
|
||||
backgroundColor: theme.colors.onPrimary,
|
||||
position: 'absolute',
|
||||
display: 'flex',
|
||||
flexDirection: 'row',
|
||||
alignItems: 'center',
|
||||
justifyContent: 'space-between',
|
||||
top: 20,
|
||||
left: 20,
|
||||
right: 20,
|
||||
borderRadius: 12,
|
||||
zIndex: 1000,
|
||||
}}>
|
||||
<IconButton icon="menu" size={24} onPress={() => {
|
||||
navigation.dispatch({ type: 'OPEN_DRAWER' });
|
||||
}} />
|
||||
<ThemedText
|
||||
style={{ fontSize: 15, color: theme.colors.primary, letterSpacing: 2, fontWeight: 'bold' }}
|
||||
>JOURNEY</ThemedText>
|
||||
<IconButton icon="magnify" size={24} onPress={() => {
|
||||
console.log('Search pressed');
|
||||
}} />
|
||||
</View>
|
||||
<Tabs
|
||||
screenOptions={{
|
||||
tabBarActiveTintColor: theme.colors.primary,
|
||||
headerShown: false,
|
||||
tabBarLabelPosition: 'below-icon',
|
||||
tabBarButton: HapticTab,
|
||||
tabBarStyle: Platform.select({
|
||||
ios: {
|
||||
// Use a transparent background on iOS to show the blur effect
|
||||
position: 'absolute',
|
||||
},
|
||||
default: {
|
||||
},
|
||||
}),
|
||||
}}>
|
||||
<IconButton icon="menu" size={24} onPress={() => {
|
||||
navigation.dispatch({ type: 'OPEN_DRAWER' });
|
||||
}} />
|
||||
<ThemedText
|
||||
style={{ fontSize: 15, color: theme.colors.primary, letterSpacing: 2, fontWeight: 'bold' }}
|
||||
>JOURNEY</ThemedText>
|
||||
<IconButton icon="magnify" size={24} onPress={() => {
|
||||
console.log('Search pressed');
|
||||
}} />
|
||||
</View>
|
||||
<Tabs
|
||||
screenOptions={{
|
||||
tabBarActiveTintColor: theme.colors.primary,
|
||||
headerShown: false,
|
||||
tabBarLabelPosition: 'below-icon',
|
||||
tabBarButton: HapticTab,
|
||||
tabBarStyle: Platform.select({
|
||||
ios: {
|
||||
// Use a transparent background on iOS to show the blur effect
|
||||
position: 'absolute',
|
||||
},
|
||||
default: {
|
||||
},
|
||||
}),
|
||||
}}>
|
||||
<Tabs.Screen
|
||||
name="index"
|
||||
options={{
|
||||
title: 'Journey',
|
||||
tabBarIcon: ({ color }) => <IconSymbol size={28} name="book" color={color} />,
|
||||
}}
|
||||
/>
|
||||
<Tabs.Screen
|
||||
name="calendar"
|
||||
options={{
|
||||
title: 'Calendar',
|
||||
tabBarIcon: ({ color }) => <IconSymbol size={28} name="calendar-today" color={color} />,
|
||||
}}
|
||||
/>
|
||||
<Tabs.Screen
|
||||
name="media"
|
||||
options={{
|
||||
title: 'Media',
|
||||
tabBarIcon: ({ color }) => <IconSymbol size={28} name="photo" color={color} />,
|
||||
}}
|
||||
/>
|
||||
<Tabs.Screen
|
||||
name="atlas"
|
||||
options={{
|
||||
title: 'Atlas',
|
||||
tabBarIcon: ({ color }) => <IconSymbol size={28} name="map" color={color} />,
|
||||
}}
|
||||
/>
|
||||
<Tabs.Screen
|
||||
name="today"
|
||||
options={{
|
||||
title: 'Today',
|
||||
tabBarIcon: ({ color }) => <IconSymbol size={28} name="inbox" color={color} />,
|
||||
}}
|
||||
/>
|
||||
</Tabs>
|
||||
</ThemedView>
|
||||
</SafeAreaView>
|
||||
</View>
|
||||
<Tabs.Screen
|
||||
name="index"
|
||||
options={{
|
||||
title: 'Journey',
|
||||
tabBarIcon: ({ color }) => <IconSymbol size={28} name="book" color={color} />,
|
||||
}}
|
||||
/>
|
||||
<Tabs.Screen
|
||||
name="calendar"
|
||||
options={{
|
||||
title: 'Calendar',
|
||||
tabBarIcon: ({ color }) => <IconSymbol size={28} name="calendar-today" color={color} />,
|
||||
}}
|
||||
/>
|
||||
<Tabs.Screen
|
||||
name="media"
|
||||
options={{
|
||||
title: 'Media',
|
||||
tabBarIcon: ({ color }) => <IconSymbol size={28} name="photo" color={color} />,
|
||||
}}
|
||||
/>
|
||||
<Tabs.Screen
|
||||
name="atlas"
|
||||
options={{
|
||||
title: 'Atlas',
|
||||
tabBarIcon: ({ color }) => <IconSymbol size={28} name="map" color={color} />,
|
||||
}}
|
||||
/>
|
||||
<Tabs.Screen
|
||||
name="today"
|
||||
options={{
|
||||
title: 'Today',
|
||||
tabBarIcon: ({ color }) => <IconSymbol size={28} name="inbox" color={color} />,
|
||||
}}
|
||||
/>
|
||||
</Tabs>
|
||||
</ThemedView>
|
||||
</SafeAreaView>
|
||||
);
|
||||
}
|
||||
|
||||
@ -9,10 +9,11 @@ import { FAB, IconButton, List, Text, useTheme } from 'react-native-paper';
|
||||
import { useEffect, useState } from 'react';
|
||||
import AsyncStorage from '@react-native-async-storage/async-storage';
|
||||
import { DATA_DIRECTORY_URI_KEY } from '@/constants/Settings';
|
||||
import { useNavigation } from 'expo-router';
|
||||
|
||||
export default function HomeScreen() {
|
||||
const [dataDirectoryUri, setDirectoryUri] = useState<string | null>(null);
|
||||
|
||||
const navigation = useNavigation();
|
||||
useEffect(() => {
|
||||
const loadDirectoryUri = async () => {
|
||||
try {
|
||||
@ -66,7 +67,8 @@ export default function HomeScreen() {
|
||||
}} />
|
||||
<ThemedText>Directory: {dataDirectoryUri} </ThemedText>
|
||||
<FAB icon="plus" color={theme.colors.onPrimary} style={styles.fab} onPress={() => {
|
||||
console.log('Add new journey');
|
||||
console.log('New entry pressed');
|
||||
navigation.navigate('NewEntry' as never);
|
||||
}} />
|
||||
</ThemedView>
|
||||
);
|
||||
25
app/NewEntry.tsx
Normal file
25
app/NewEntry.tsx
Normal file
@ -0,0 +1,25 @@
|
||||
import React, { useState } from 'react';
|
||||
import { StyleSheet, ScrollView, View } from 'react-native';
|
||||
import { Button, Text, TextInput, useTheme, Appbar, IconButton } from 'react-native-paper';
|
||||
import { ThemedView } from '@/components/ThemedView';
|
||||
import { ThemedText } from '@/components/ThemedText';
|
||||
import { useRouter } from 'expo-router';
|
||||
import { SafeAreaView, useSafeAreaInsets } from 'react-native-safe-area-context';
|
||||
import { StatusBar } from 'expo-status-bar';
|
||||
import Wrapper from '@/components/ui/Wrapper';
|
||||
|
||||
export default function NewEntryScreen() {
|
||||
const navigation = useRouter();
|
||||
return (
|
||||
<Wrapper>
|
||||
<Appbar.Header>
|
||||
<Appbar.BackAction onPress={() => {
|
||||
navigation.back();
|
||||
}} />
|
||||
<Appbar.Content title="Title" />
|
||||
<Appbar.Action icon="calendar" onPress={() => { }} />
|
||||
<Appbar.Action icon="magnify" onPress={() => { }} />
|
||||
</Appbar.Header>
|
||||
</Wrapper>
|
||||
);
|
||||
}
|
||||
134
app/_layout.tsx
134
app/_layout.tsx
@ -1,10 +1,10 @@
|
||||
import { createDrawerNavigator } from '@react-navigation/drawer';
|
||||
import { createNativeStackNavigator } from '@react-navigation/native-stack';
|
||||
import { createBottomTabNavigator } from '@react-navigation/bottom-tabs';
|
||||
import { useFonts } from 'expo-font';
|
||||
import { Stack } from 'expo-router';
|
||||
import { StatusBar } from 'expo-status-bar';
|
||||
import 'react-native-reanimated';
|
||||
import { PaperProvider } from 'react-native-paper';
|
||||
import { IconButton, PaperProvider } from 'react-native-paper';
|
||||
import * as NavigationBar from 'expo-navigation-bar';
|
||||
|
||||
import { Platform, useColorScheme } from 'react-native';
|
||||
@ -14,22 +14,126 @@ import { IconSymbol } from '@/components/ui/IconSymbol';
|
||||
import { TouchableOpacity, View } from 'react-native';
|
||||
import NullComponent from '@/components/NullComponent';
|
||||
import { useEffect } from 'react';
|
||||
import NewEntryScreen from './NewEntry';
|
||||
import { SafeAreaView, useSafeAreaInsets } from 'react-native-safe-area-context';
|
||||
|
||||
// Import your tab screens directly
|
||||
import HomeScreen from './HomeScreen';
|
||||
import CalendarScreen from './(tabs)/calendar';
|
||||
import MediaScreen from './(tabs)/media';
|
||||
import AtlasScreen from './(tabs)/atlas';
|
||||
import TodayScreen from './(tabs)/today';
|
||||
import { ThemedView } from '@/components/ThemedView';
|
||||
import { useNavigation } from 'expo-router';
|
||||
import { ThemedText } from '@/components/ThemedText';
|
||||
import Wrapper from '@/components/ui/Wrapper';
|
||||
|
||||
const Drawer = createDrawerNavigator();
|
||||
const RootStack = createNativeStackNavigator();
|
||||
const Tab = createBottomTabNavigator();
|
||||
|
||||
function TabsNavigator() {
|
||||
const colorScheme = useColorScheme();
|
||||
const theme = colorScheme === 'dark' ? darkTheme : lightTheme;
|
||||
const navigation = useNavigation();
|
||||
const insets = useSafeAreaInsets();
|
||||
|
||||
return (
|
||||
<Stack>
|
||||
<Stack.Screen name="(tabs)" options={{ headerShown: false }} />
|
||||
<Stack.Screen name="+not-found" />
|
||||
</Stack>
|
||||
<Wrapper>
|
||||
<SafeAreaView
|
||||
edges={['top', 'left', 'right']}
|
||||
style={{
|
||||
flex: 1,
|
||||
}}>
|
||||
<View style={{
|
||||
backgroundColor: theme.colors.onPrimary,
|
||||
position: 'absolute',
|
||||
display: 'flex',
|
||||
flexDirection: 'row',
|
||||
alignItems: 'center',
|
||||
justifyContent: 'space-between',
|
||||
top: insets.top + 20,
|
||||
left: 20,
|
||||
right: 20,
|
||||
borderRadius: 12,
|
||||
zIndex: 1000,
|
||||
}}>
|
||||
<IconButton icon="menu" size={24} onPress={() => {
|
||||
navigation.dispatch({ type: 'OPEN_DRAWER' });
|
||||
}} />
|
||||
<ThemedText
|
||||
style={{ fontSize: 15, color: theme.colors.primary, letterSpacing: 2, fontWeight: 'bold' }}
|
||||
>JOURNEY</ThemedText>
|
||||
<IconButton icon="magnify" size={24} onPress={() => {
|
||||
console.log('Search pressed');
|
||||
}} />
|
||||
</View><Tab.Navigator
|
||||
screenOptions={{
|
||||
tabBarActiveTintColor: theme.colors.primary,
|
||||
headerShown: false,
|
||||
tabBarStyle: Platform.select({
|
||||
ios: {
|
||||
position: 'absolute',
|
||||
},
|
||||
default: {},
|
||||
}),
|
||||
}}
|
||||
>
|
||||
<Tab.Screen
|
||||
name="Journey"
|
||||
component={HomeScreen}
|
||||
options={{
|
||||
tabBarIcon: ({ color, size }) => (
|
||||
<IconSymbol name="book" size={size} color={color} />
|
||||
),
|
||||
}}
|
||||
/>
|
||||
<Tab.Screen
|
||||
name="Calendar"
|
||||
component={CalendarScreen}
|
||||
options={{
|
||||
tabBarIcon: ({ color, size }) => (
|
||||
<IconSymbol name="calendar" size={size} color={color} />
|
||||
),
|
||||
}}
|
||||
/>
|
||||
<Tab.Screen
|
||||
name="Media"
|
||||
component={MediaScreen}
|
||||
options={{
|
||||
tabBarIcon: ({ color, size }) => (
|
||||
<IconSymbol name="photo" size={size} color={color} />
|
||||
),
|
||||
}}
|
||||
/>
|
||||
<Tab.Screen
|
||||
name="Atlas"
|
||||
component={AtlasScreen}
|
||||
options={{
|
||||
tabBarIcon: ({ color, size }) => (
|
||||
<IconSymbol name="map" size={size} color={color} />
|
||||
),
|
||||
}}
|
||||
/>
|
||||
<Tab.Screen
|
||||
name="Today"
|
||||
component={TodayScreen}
|
||||
options={{
|
||||
tabBarIcon: ({ color, size }) => (
|
||||
<IconSymbol name="today" size={size} color={color} />
|
||||
),
|
||||
}}
|
||||
/>
|
||||
</Tab.Navigator>
|
||||
</SafeAreaView>
|
||||
</Wrapper>
|
||||
);
|
||||
}
|
||||
|
||||
function DrawerNavigator() {
|
||||
const colorScheme = useColorScheme();
|
||||
const theme = colorScheme === 'dark' ? darkTheme : lightTheme;
|
||||
|
||||
return (
|
||||
<Drawer.Navigator>
|
||||
<Drawer.Screen
|
||||
@ -53,23 +157,23 @@ function DrawerNavigator() {
|
||||
<Drawer.Screen
|
||||
name="SettingsDrawerItem"
|
||||
component={NullComponent}
|
||||
options={({ navigation }) => ({
|
||||
options={{
|
||||
title: 'Settings',
|
||||
headerShown: false,
|
||||
drawerLabel: 'Settings',
|
||||
drawerIcon: ({ color }) => (
|
||||
<IconSymbol name="settings" size={24} color={color} />
|
||||
),
|
||||
})}
|
||||
}}
|
||||
listeners={({ navigation }) => ({
|
||||
drawerItemPress: (e) => {
|
||||
e.preventDefault();
|
||||
// Navigate to the Settings screen in the root stack
|
||||
navigation.getParent()?.navigate('Settings');
|
||||
navigation.dispatch({ type: 'CLOSE_DRAWER' });
|
||||
},
|
||||
})}
|
||||
/></Drawer.Group>
|
||||
/>
|
||||
</Drawer.Group>
|
||||
</Drawer.Navigator>
|
||||
);
|
||||
}
|
||||
@ -87,19 +191,18 @@ export default function RootLayout() {
|
||||
}
|
||||
}, [colorScheme]);
|
||||
|
||||
|
||||
if (!loaded) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return (
|
||||
<PaperProvider theme={theme}>
|
||||
|
||||
<RootStack.Navigator>
|
||||
<RootStack.Screen
|
||||
name="Main"
|
||||
component={DrawerNavigator}
|
||||
options={{ headerShown: false }}
|
||||
|
||||
/>
|
||||
<RootStack.Screen
|
||||
name="Settings"
|
||||
@ -122,6 +225,13 @@ export default function RootLayout() {
|
||||
),
|
||||
})}
|
||||
/>
|
||||
<RootStack.Screen
|
||||
name="NewEntry"
|
||||
component={NewEntryScreen}
|
||||
options={{
|
||||
headerShown: false,
|
||||
}}
|
||||
/>
|
||||
</RootStack.Navigator>
|
||||
<StatusBar style={theme.dark ? 'light' : 'dark'} />
|
||||
</PaperProvider>
|
||||
|
||||
24
components/ui/Wrapper.tsx
Normal file
24
components/ui/Wrapper.tsx
Normal file
@ -0,0 +1,24 @@
|
||||
import { View } from "react-native";
|
||||
import { ThemedView } from "../ThemedView";
|
||||
import { SafeAreaView, useSafeAreaInsets } from "react-native-safe-area-context";
|
||||
import { useTheme } from "react-native-paper";
|
||||
|
||||
export default function Wrapper({ children }: { children: React.ReactNode }) {
|
||||
const insets = useSafeAreaInsets();
|
||||
const theme = useTheme();
|
||||
return (
|
||||
<ThemedView style={{ flex: 1 }}>
|
||||
<View style={{
|
||||
backgroundColor: theme.colors.primary,
|
||||
position: 'absolute',
|
||||
top: 0,
|
||||
left: 0,
|
||||
right: 0,
|
||||
height: insets.top,
|
||||
zIndex: 1000,
|
||||
}} />
|
||||
|
||||
{children}
|
||||
</ThemedView>
|
||||
);
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user