Clean up header. Add theme.
This commit is contained in:
parent
0b688fc4f5
commit
90ec951b0c
@ -1,18 +1,22 @@
|
||||
import { Image, StyleSheet, Platform } from 'react-native';
|
||||
import ParallaxScrollView from '@/components/default/ParallaxScrollView';
|
||||
import { ThemedText, ThemedView } from '@/components/theme/Theme';
|
||||
import { Colors } from '@/constants/Colors';
|
||||
import { useColorScheme } from '@/hooks/useColorScheme';
|
||||
|
||||
const HomeScreen = () => {
|
||||
const scheme = useColorScheme() ?? 'dark';
|
||||
return (
|
||||
<ParallaxScrollView
|
||||
headerBackgroundColor={{ light: '#A1CEDC', dark: '#1D3D47' }}
|
||||
headerHeight={200}
|
||||
headerImage={
|
||||
<Image
|
||||
source={require('@/assets/images/partial-react-logo.png')}
|
||||
source={require('@/assets/images/tech_tracker_logo.png')}
|
||||
style={styles.reactLogo}
|
||||
/>
|
||||
}
|
||||
headerTitle={
|
||||
<ThemedText type='title' style={styles.headerTitle}>Tech Tracker</ThemedText>
|
||||
}
|
||||
>
|
||||
<ThemedView style={styles.titleContainer}>
|
||||
<ThemedText type='title'>Welcome!</ThemedText>
|
||||
@ -64,10 +68,20 @@ const styles = StyleSheet.create({
|
||||
marginBottom: 8,
|
||||
},
|
||||
reactLogo: {
|
||||
height: 178,
|
||||
width: 290,
|
||||
bottom: 0,
|
||||
left: 0,
|
||||
height: 80,
|
||||
width: 82,
|
||||
bottom: 10,
|
||||
left: 10,
|
||||
position: 'absolute',
|
||||
},
|
||||
headerTitle: {
|
||||
position: 'absolute',
|
||||
bottom: 20,
|
||||
left: 40,
|
||||
right: 0,
|
||||
textAlign: 'center',
|
||||
fontSize: 48,
|
||||
lineHeight: 64,
|
||||
fontWeight: 'bold',
|
||||
},
|
||||
});
|
||||
|
@ -44,7 +44,7 @@ const TabTwoScreen = () => {
|
||||
<ThemedText type='defaultSemiBold'>@3x</ThemedText> suffixes to provide files for
|
||||
different screen densities
|
||||
</ThemedText>
|
||||
<Image source={require('@/assets/images/react-logo.png')} style={{ alignSelf: 'center' }} />
|
||||
<Image source={require('@/assets/images/tech_tracker_logo.png')} style={{ alignSelf: 'center' }} />
|
||||
<ExternalLink href='https://reactnative.dev/docs/images'>
|
||||
<ThemedText type='link'>Learn more</ThemedText>
|
||||
</ExternalLink>
|
||||
|
@ -1,28 +1,31 @@
|
||||
import type { PropsWithChildren, ReactElement } from 'react';
|
||||
import { StyleSheet } from 'react-native';
|
||||
import { StyleSheet, ViewStyle, StyleProp } from 'react-native';
|
||||
import Animated, {
|
||||
interpolate,
|
||||
useAnimatedRef,
|
||||
useAnimatedStyle,
|
||||
useScrollViewOffset,
|
||||
} from 'react-native-reanimated';
|
||||
import { ThemedView } from '@/components/theme/Theme';
|
||||
import { ThemedText, ThemedView } from '@/components/theme/Theme';
|
||||
import { useBottomTabOverflow } from '@/components/ui/TabBarBackground';
|
||||
import { Colors } from '@/constants/Colors';
|
||||
import { useColorScheme } from '@/hooks/useColorScheme';
|
||||
|
||||
const HEADER_HEIGHT = 250;
|
||||
const HEADER_HEIGHT = 150;
|
||||
|
||||
type Props = PropsWithChildren<{
|
||||
headerImage: ReactElement;
|
||||
headerBackgroundColor: { dark: string; light: string };
|
||||
headerImage?: ReactElement;
|
||||
headerBackgroundColor?: { dark: string; light: string };
|
||||
headerHeight?: number;
|
||||
headerTitle?: ReactElement;
|
||||
}>;
|
||||
|
||||
const ParallaxScrollView = ({
|
||||
children,
|
||||
headerImage,
|
||||
headerBackgroundColor,
|
||||
headerImage = <ThemedView />,
|
||||
headerBackgroundColor = { light: Colors.light.accent, dark: Colors.dark.accent },
|
||||
headerHeight = HEADER_HEIGHT,
|
||||
headerTitle = <ThemedText />,
|
||||
}: Props) => {
|
||||
const scheme = useColorScheme() ?? 'dark';
|
||||
const scrollRef = useAnimatedRef<Animated.ScrollView>();
|
||||
@ -64,6 +67,7 @@ const ParallaxScrollView = ({
|
||||
]}
|
||||
>
|
||||
{headerImage}
|
||||
{headerTitle}
|
||||
</Animated.View>
|
||||
<ThemedView style={styles.content}>{children}</ThemedView>
|
||||
</Animated.ScrollView>
|
||||
@ -73,6 +77,9 @@ const ParallaxScrollView = ({
|
||||
export default ParallaxScrollView;
|
||||
|
||||
const styles = StyleSheet.create({
|
||||
blank: {
|
||||
|
||||
},
|
||||
container: {
|
||||
flex: 1,
|
||||
},
|
||||
|
@ -1,26 +1,32 @@
|
||||
/**
|
||||
* Below are the colors that are used in the app. The colors are defined in the light and dark mode.
|
||||
* There are many other ways to style your app. For example, [Nativewind](https://www.nativewind.dev/), [Tamagui](https://tamagui.dev/), [unistyles](https://reactnativeunistyles.vercel.app), etc.
|
||||
*/
|
||||
|
||||
const tintColorLight = '#0a7ea4';
|
||||
const tintColorDark = '#fff';
|
||||
const black = '#1f1e2c';
|
||||
const white = '#ECEDEE'
|
||||
const darkTint = '#fff';
|
||||
const lightTint = '#0a7ea4';
|
||||
const darkIcon = '#9BA1A6';
|
||||
const lightIcon = '#687076';
|
||||
const ttBlue = '#4d5eae';
|
||||
const ttDarkBlue = '#2e2f3d';
|
||||
const ttLightBlue = '#c8d0d7';
|
||||
|
||||
export const Colors = {
|
||||
light: {
|
||||
text: '#11181C',
|
||||
background: '#fff',
|
||||
tint: tintColorLight,
|
||||
icon: '#687076',
|
||||
tabIconDefault: '#687076',
|
||||
tabIconSelected: tintColorLight,
|
||||
text: black,
|
||||
background: white,
|
||||
tint: lightTint,
|
||||
icon: lightIcon,
|
||||
tabIconDefault: lightIcon,
|
||||
tabIconSelected: lightTint,
|
||||
ttBlue,
|
||||
accent: ttLightBlue,
|
||||
},
|
||||
dark: {
|
||||
text: '#ECEDEE',
|
||||
background: '#151718',
|
||||
tint: tintColorDark,
|
||||
icon: '#9BA1A6',
|
||||
tabIconDefault: '#9BA1A6',
|
||||
tabIconSelected: tintColorDark,
|
||||
text: white,
|
||||
background: black,
|
||||
tint: darkTint,
|
||||
icon: darkIcon,
|
||||
tabIconDefault: darkIcon,
|
||||
tabIconSelected: darkTint,
|
||||
ttBlue,
|
||||
accent: ttDarkBlue,
|
||||
},
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user