First commit

This commit is contained in:
2026-04-21 16:48:51 +02:00
parent 82bfb1666e
commit c751e28fce
45 changed files with 420 additions and 684 deletions

43
apk/.gitignore vendored Normal file
View File

@@ -0,0 +1,43 @@
# Learn more https://docs.github.com/en/get-started/getting-started-with-git/ignoring-files
# dependencies
node_modules/
# Expo
.expo/
dist/
web-build/
expo-env.d.ts
# Native
.kotlin/
*.orig.*
*.jks
*.p8
*.p12
*.key
*.mobileprovision
# Metro
.metro-health-check*
# debug
npm-debug.*
yarn-debug.*
yarn-error.*
# macOS
.DS_Store
*.pem
# local env files
.env*.local
# typescript
*.tsbuildinfo
app-example
# generated native folders
/ios
/android

1
apk/.vscode/extensions.json vendored Normal file
View File

@@ -0,0 +1 @@
{ "recommendations": ["expo.vscode-expo-tools"] }

7
apk/.vscode/settings.json vendored Normal file
View File

@@ -0,0 +1,7 @@
{
"editor.codeActionsOnSave": {
"source.fixAll": "explicit",
"source.organizeImports": "explicit",
"source.sortMembers": "explicit"
}
}

50
apk/README.md Normal file
View File

@@ -0,0 +1,50 @@
# Welcome to your Expo app 👋
This is an [Expo](https://expo.dev) project created with [`create-expo-app`](https://www.npmjs.com/package/create-expo-app).
## Get started
1. Install dependencies
```bash
npm install
```
2. Start the app
```bash
npx expo start
```
In the output, you'll find options to open the app in a
- [development build](https://docs.expo.dev/develop/development-builds/introduction/)
- [Android emulator](https://docs.expo.dev/workflow/android-studio-emulator/)
- [iOS simulator](https://docs.expo.dev/workflow/ios-simulator/)
- [Expo Go](https://expo.dev/go), a limited sandbox for trying out app development with Expo
You can start developing by editing the files inside the **app** directory. This project uses [file-based routing](https://docs.expo.dev/router/introduction).
## Get a fresh project
When you're ready, run:
```bash
npm run reset-project
```
This command will move the starter code to the **app-example** directory and create a blank **app** directory where you can start developing.
## Learn more
To learn more about developing your project with Expo, look at the following resources:
- [Expo documentation](https://docs.expo.dev/): Learn fundamentals, or go into advanced topics with our [guides](https://docs.expo.dev/guides).
- [Learn Expo tutorial](https://docs.expo.dev/tutorial/introduction/): Follow a step-by-step tutorial where you'll create a project that runs on Android, iOS, and the web.
## Join the community
Join our community of developers creating universal apps.
- [Expo on GitHub](https://github.com/expo/expo): View our open source platform and contribute.
- [Discord community](https://chat.expo.dev): Chat with Expo users and ask questions.

48
apk/app.json Normal file
View File

@@ -0,0 +1,48 @@
{
"expo": {
"name": "Birthday",
"slug": "Birthday",
"version": "1.0.0",
"orientation": "portrait",
"icon": "./assets/images/icon.png",
"scheme": "birthday",
"userInterfaceStyle": "automatic",
"newArchEnabled": true,
"ios": {
"supportsTablet": true
},
"android": {
"adaptiveIcon": {
"backgroundColor": "#E6F4FE",
"foregroundImage": "./assets/images/android-icon-foreground.png",
"backgroundImage": "./assets/images/android-icon-background.png",
"monochromeImage": "./assets/images/android-icon-monochrome.png"
},
"edgeToEdgeEnabled": true,
"predictiveBackGestureEnabled": false
},
"web": {
"output": "static",
"favicon": "./assets/images/favicon.png"
},
"plugins": [
"expo-router",
[
"expo-splash-screen",
{
"image": "./assets/images/splash-icon.png",
"imageWidth": 200,
"resizeMode": "contain",
"backgroundColor": "#ffffff",
"dark": {
"backgroundColor": "#000000"
}
}
]
],
"experiments": {
"typedRoutes": true,
"reactCompiler": true
}
}
}

28
apk/app/_layout.tsx Normal file
View File

@@ -0,0 +1,28 @@
import {
DarkTheme,
DefaultTheme,
ThemeProvider,
} from "@react-navigation/native";
import { Stack } from "expo-router";
import { StatusBar } from "expo-status-bar";
import "react-native-reanimated";
import { useColorScheme } from "@/hooks/use-color-scheme";
export const unstable_settings = {
anchor: "(tabs)",
};
export default function RootLayout() {
const colorScheme = useColorScheme();
return (
<ThemeProvider value={colorScheme === "dark" ? DarkTheme : DefaultTheme}>
<Stack>
<Stack.Screen name="index" options={{ headerShown: false }} />
<Stack.Screen name="add" options={{ headerShown: false }} />
</Stack>
<StatusBar style="auto" />
</ThemeProvider>
);
}

80
apk/app/add.tsx Normal file
View File

@@ -0,0 +1,80 @@
import DateTimePicker from "@react-native-community/datetimepicker";
import { useRouter } from "expo-router";
import React, { useState } from "react";
import {
Button,
Platform,
StyleSheet,
Text,
TextInput,
View,
} from "react-native";
export default function SimpleForm() {
const router = useRouter();
const [name, setName] = useState("");
const [date, setDate] = useState(new Date());
const [showPicker, setShowPicker] = useState(false);
const onChangeDate = (event, selectedDate) => {
setShowPicker(Platform.OS === "ios");
if (selectedDate) {
setDate(selectedDate);
}
};
const handleSubmit = () => {
alert(`Name: ${name}\nDate: ${date.toDateString()}`);
router.push("/");
};
return (
<View style={styles.container}>
<Text style={styles.label}>Name:</Text>
<TextInput
style={styles.input}
placeholder="Enter your name"
value={name}
onChangeText={setName}
/>
<Text style={styles.label}>Date:</Text>
<Button title="Select Date" onPress={() => setShowPicker(true)} />
<Text style={styles.dateText}>{date.toDateString()}</Text>
{showPicker && (
<DateTimePicker
value={date}
mode="date"
display="default"
onChange={onChangeDate}
/>
)}
<Button title="Submit" onPress={handleSubmit} />
</View>
);
}
const styles = StyleSheet.create({
container: {
padding: 20,
marginTop: 50,
},
label: {
fontSize: 16,
marginBottom: 5,
},
input: {
borderWidth: 1,
borderColor: "#ccc",
padding: 10,
marginBottom: 15,
borderRadius: 5,
},
dateText: {
marginVertical: 10,
fontSize: 16,
},
});

22
apk/app/index.tsx Normal file
View File

@@ -0,0 +1,22 @@
import { StyleSheet } from "react-native";
import { BirthdayList } from "@/components/birthdate-list";
import ScrollView from "@/components/scroll-view";
import { View } from "react-native";
export default function HomeScreen() {
return (
<ScrollView>
<View style={styles.titleContainer}>
<BirthdayList></BirthdayList>
</View>
</ScrollView>
);
}
const styles = StyleSheet.create({
titleContainer: {
gap: 8,
margin: 20,
},
});

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 77 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

BIN
apk/assets/images/icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 384 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

View File

@@ -0,0 +1,38 @@
// BirthdayItem.tsx
import { StyleSheet, Text, View } from "react-native";
interface BirthdayItemProps {
name: string;
date: string;
age?: number;
}
export function BirthdayItem({ name, date, age }: BirthdayItemProps) {
return (
<View style={styles.itemContainer}>
<Text style={styles.name}>{name}</Text>
{age && <Text style={styles.age}>Age: {age}</Text>}
</View>
);
}
const styles = StyleSheet.create({
itemContainer: {
padding: 15,
borderRadius: 8,
backgroundColor: "#f0f0f0",
boxShadow: "0 1px 4px rgba(0,0,0,0.3)",
marginBottom: 10,
},
name: {
fontSize: 16,
fontWeight: "bold",
},
date: {
fontSize: 14,
},
age: {
fontSize: 12,
marginTop: 5,
},
});

View File

@@ -0,0 +1,127 @@
// birthdate-list.tsx
import { useRouter } from "expo-router";
import {
SectionList,
StyleSheet,
Text,
TouchableOpacity,
View,
} from "react-native";
import { BirthdayItem } from "./birthdate-item";
const DATA = [
{ id: "1", name: "John Doe", date: "2024-01-15" },
{ id: "2", name: "Jane Smith", date: "2024-01-15" },
{ id: "3", name: "Bob Johnson", date: "2024-02-10" },
{ id: "4", name: "Alice Brown", date: "2024-02-10" },
{ id: "5", name: "Charlie Wilson", date: "2024-01-20" },
{ id: "6", name: "Bob Johnson", date: "2024-02-10" },
{ id: "7", name: "Alice Brown", date: "2024-02-10" },
{ id: "8", name: "Charlie Wilson", date: "2024-01-20" },
{ id: "9", name: "Bob Johnson", date: "2024-02-10" },
{ id: "10", name: "Alice Brown", date: "2024-02-10" },
{ id: "11", name: "Charlie Wilson", date: "2024-01-20" },
{ id: "12", name: "Charlie Wilson", date: "2024-01-20" },
{ id: "13", name: "Charlie Wilson", date: "2024-01-20" },
{ id: "14", name: "Charlie Wilson", date: "2024-01-20" },
];
interface BirthdayItemData {
id: string;
name: string;
date: string;
}
interface SectionData {
title: string;
data: BirthdayItemData[];
}
export function BirthdayList() {
const router = useRouter();
const groupedData = groupBirthdaysByDate(DATA);
return (
<View>
<View style={styles.titleContainer}>
<Text style={{ fontSize: 24, fontWeight: "bold" }}>
Upcoming Birthdays
</Text>
<TouchableOpacity
onPress={() => router.push("/add")}
style={styles.addButton}
>
<Text style={styles.addButtonText}>+</Text>
</TouchableOpacity>
</View>
<SectionList
sections={groupedData}
keyExtractor={(item) => item.id}
renderItem={({ item }) => (
<BirthdayItem name={item.name} date={item.date} />
)}
showsVerticalScrollIndicator={false}
renderSectionHeader={({ section: { title } }) => (
<View style={styles.headerContainer}>
<Text style={styles.sectionHeader}>{title}</Text>
</View>
)}
/>
</View>
);
}
// Helper function to group and sort
function groupBirthdaysByDate(data: BirthdayItemData[]): SectionData[] {
// Sort by date
const sorted = [...data].sort((a, b) => {
return new Date(a.date).getTime() - new Date(b.date).getTime();
});
// Group by date
const grouped = sorted.reduce((acc, item) => {
const existing = acc.find((section) => section.title === item.date);
if (existing) {
existing.data.push(item);
} else {
acc.push({ title: item.date, data: [item] });
}
return acc;
}, [] as SectionData[]);
return grouped;
}
const styles = StyleSheet.create({
titleContainer: {
flexDirection: "row",
justifyContent: "space-between",
alignItems: "center",
paddingHorizontal: 5,
paddingVertical: 10,
},
addButton: {
width: 40,
height: 40,
borderRadius: 20,
backgroundColor: "#007AFF",
justifyContent: "center",
alignItems: "center",
},
addButtonText: {
fontSize: 24,
color: "white",
fontWeight: "bold",
},
headerContainer: {
paddingVertical: 10,
paddingHorizontal: 5,
},
sectionHeader: {
fontSize: 18,
fontWeight: "bold",
},
});

View File

@@ -0,0 +1,44 @@
import { StyleSheet } from "react-native";
import Animated, { useAnimatedRef } from "react-native-reanimated";
import { useColorScheme } from "@/hooks/use-color-scheme";
import { useThemeColor } from "@/hooks/use-theme-color";
import { PropsWithChildren } from "react";
import { View } from "react-native";
import { useSafeAreaInsets } from "react-native-safe-area-context";
type Props = PropsWithChildren<{
headerBackgroundColor: { dark: string; light: string };
}>;
export default function ScrollView({ children, headerBackgroundColor }: Props) {
const scrollRef = useAnimatedRef<Animated.ScrollView>();
const insets = useSafeAreaInsets();
const colorScheme = useColorScheme() ?? "light";
const backgroundColor = useThemeColor({}, "background");
return (
<View
ref={scrollRef}
style={[
styles.container,
{
backgroundColor,
paddingTop: insets.top,
},
]}
scrollEventThrottle={16}
>
<View style={styles.content}>{children}</View>
</View>
);
}
const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: "#ccc",
},
content: {},
});

53
apk/constants/theme.ts Normal file
View File

@@ -0,0 +1,53 @@
/**
* 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.
*/
import { Platform } from 'react-native';
const tintColorLight = '#0a7ea4';
const tintColorDark = '#fff';
export const Colors = {
light: {
text: '#11181C',
background: '#fff',
tint: tintColorLight,
icon: '#687076',
tabIconDefault: '#687076',
tabIconSelected: tintColorLight,
},
dark: {
text: '#ECEDEE',
background: '#151718',
tint: tintColorDark,
icon: '#9BA1A6',
tabIconDefault: '#9BA1A6',
tabIconSelected: tintColorDark,
},
};
export const Fonts = Platform.select({
ios: {
/** iOS `UIFontDescriptorSystemDesignDefault` */
sans: 'system-ui',
/** iOS `UIFontDescriptorSystemDesignSerif` */
serif: 'ui-serif',
/** iOS `UIFontDescriptorSystemDesignRounded` */
rounded: 'ui-rounded',
/** iOS `UIFontDescriptorSystemDesignMonospaced` */
mono: 'ui-monospace',
},
default: {
sans: 'normal',
serif: 'serif',
rounded: 'normal',
mono: 'monospace',
},
web: {
sans: "system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif",
serif: "Georgia, 'Times New Roman', serif",
rounded: "'SF Pro Rounded', 'Hiragino Maru Gothic ProN', Meiryo, 'MS PGothic', sans-serif",
mono: "SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', monospace",
},
});

10
apk/eslint.config.js Normal file
View File

@@ -0,0 +1,10 @@
// https://docs.expo.dev/guides/using-eslint/
const { defineConfig } = require('eslint/config');
const expoConfig = require('eslint-config-expo/flat');
module.exports = defineConfig([
expoConfig,
{
ignores: ['dist/*'],
},
]);

View File

@@ -0,0 +1 @@
export { useColorScheme } from 'react-native';

View File

@@ -0,0 +1,21 @@
import { useEffect, useState } from 'react';
import { useColorScheme as useRNColorScheme } from 'react-native';
/**
* To support static rendering, this value needs to be re-calculated on the client side for web
*/
export function useColorScheme() {
const [hasHydrated, setHasHydrated] = useState(false);
useEffect(() => {
setHasHydrated(true);
}, []);
const colorScheme = useRNColorScheme();
if (hasHydrated) {
return colorScheme;
}
return 'light';
}

View File

@@ -0,0 +1,21 @@
/**
* Learn more about light and dark modes:
* https://docs.expo.dev/guides/color-schemes/
*/
import { Colors } from '@/constants/theme';
import { useColorScheme } from '@/hooks/use-color-scheme';
export function useThemeColor(
props: { light?: string; dark?: string },
colorName: keyof typeof Colors.light & keyof typeof Colors.dark
) {
const theme = useColorScheme() ?? 'light';
const colorFromProps = props[theme];
if (colorFromProps) {
return colorFromProps;
} else {
return Colors[theme][colorName];
}
}

12922
apk/package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

48
apk/package.json Normal file
View File

@@ -0,0 +1,48 @@
{
"name": "birthday",
"main": "expo-router/entry",
"version": "1.0.0",
"scripts": {
"start": "expo start",
"reset-project": "node ./scripts/reset-project.js",
"android": "expo start --android",
"ios": "expo start --ios",
"web": "expo start --web",
"lint": "expo lint"
},
"dependencies": {
"@expo/vector-icons": "^15.0.3",
"@react-native-community/datetimepicker": "^9.1.0",
"@react-navigation/bottom-tabs": "^7.4.0",
"@react-navigation/elements": "^2.6.3",
"@react-navigation/native": "^7.1.8",
"expo": "~54.0.33",
"expo-constants": "~18.0.13",
"expo-font": "~14.0.11",
"expo-haptics": "~15.0.8",
"expo-image": "~3.0.11",
"expo-linking": "~8.0.11",
"expo-router": "~6.0.23",
"expo-splash-screen": "~31.0.13",
"expo-status-bar": "~3.0.9",
"expo-symbols": "~1.0.8",
"expo-system-ui": "~6.0.9",
"expo-web-browser": "~15.0.10",
"react": "19.1.0",
"react-dom": "19.1.0",
"react-native": "0.81.5",
"react-native-gesture-handler": "~2.28.0",
"react-native-reanimated": "~4.1.1",
"react-native-safe-area-context": "~5.6.0",
"react-native-screens": "~4.16.0",
"react-native-web": "~0.21.0",
"react-native-worklets": "0.5.1"
},
"devDependencies": {
"@types/react": "~19.1.0",
"eslint": "^9.25.0",
"eslint-config-expo": "~10.0.0",
"typescript": "~5.9.2"
},
"private": true
}

112
apk/scripts/reset-project.js Executable file
View File

@@ -0,0 +1,112 @@
#!/usr/bin/env node
/**
* This script is used to reset the project to a blank state.
* It deletes or moves the /app, /components, /hooks, /scripts, and /constants directories to /app-example based on user input and creates a new /app directory with an index.tsx and _layout.tsx file.
* You can remove the `reset-project` script from package.json and safely delete this file after running it.
*/
const fs = require("fs");
const path = require("path");
const readline = require("readline");
const root = process.cwd();
const oldDirs = ["app", "components", "hooks", "constants", "scripts"];
const exampleDir = "app-example";
const newAppDir = "app";
const exampleDirPath = path.join(root, exampleDir);
const indexContent = `import { Text, View } from "react-native";
export default function Index() {
return (
<View
style={{
flex: 1,
justifyContent: "center",
alignItems: "center",
}}
>
<Text>Edit app/index.tsx to edit this screen.</Text>
</View>
);
}
`;
const layoutContent = `import { Stack } from "expo-router";
export default function RootLayout() {
return <Stack />;
}
`;
const rl = readline.createInterface({
input: process.stdin,
output: process.stdout,
});
const moveDirectories = async (userInput) => {
try {
if (userInput === "y") {
// Create the app-example directory
await fs.promises.mkdir(exampleDirPath, { recursive: true });
console.log(`📁 /${exampleDir} directory created.`);
}
// Move old directories to new app-example directory or delete them
for (const dir of oldDirs) {
const oldDirPath = path.join(root, dir);
if (fs.existsSync(oldDirPath)) {
if (userInput === "y") {
const newDirPath = path.join(root, exampleDir, dir);
await fs.promises.rename(oldDirPath, newDirPath);
console.log(`➡️ /${dir} moved to /${exampleDir}/${dir}.`);
} else {
await fs.promises.rm(oldDirPath, { recursive: true, force: true });
console.log(`❌ /${dir} deleted.`);
}
} else {
console.log(`➡️ /${dir} does not exist, skipping.`);
}
}
// Create new /app directory
const newAppDirPath = path.join(root, newAppDir);
await fs.promises.mkdir(newAppDirPath, { recursive: true });
console.log("\n📁 New /app directory created.");
// Create index.tsx
const indexPath = path.join(newAppDirPath, "index.tsx");
await fs.promises.writeFile(indexPath, indexContent);
console.log("📄 app/index.tsx created.");
// Create _layout.tsx
const layoutPath = path.join(newAppDirPath, "_layout.tsx");
await fs.promises.writeFile(layoutPath, layoutContent);
console.log("📄 app/_layout.tsx created.");
console.log("\n✅ Project reset complete. Next steps:");
console.log(
`1. Run \`npx expo start\` to start a development server.\n2. Edit app/index.tsx to edit the main screen.${
userInput === "y"
? `\n3. Delete the /${exampleDir} directory when you're done referencing it.`
: ""
}`
);
} catch (error) {
console.error(`❌ Error during script execution: ${error.message}`);
}
};
rl.question(
"Do you want to move existing files to /app-example instead of deleting them? (Y/n): ",
(answer) => {
const userInput = answer.trim().toLowerCase() || "y";
if (userInput === "y" || userInput === "n") {
moveDirectories(userInput).finally(() => rl.close());
} else {
console.log("❌ Invalid input. Please enter 'Y' or 'N'.");
rl.close();
}
}
);

17
apk/tsconfig.json Normal file
View File

@@ -0,0 +1,17 @@
{
"extends": "expo/tsconfig.base",
"compilerOptions": {
"strict": true,
"paths": {
"@/*": [
"./*"
]
}
},
"include": [
"**/*.ts",
"**/*.tsx",
".expo/types/**/*.ts",
"expo-env.d.ts"
]
}