Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/reaction speed test #44

Merged
merged 9 commits into from
Nov 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions apps/reaction-speed-test/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
npm-debug.*
*.jks
*.p8
*.p12
*.key
*.mobileprovision
*.orig.*
web-build/

# @generated expo-cli sync-2b81b286409207a5da26e14c78851eb30d8ccbdb
# The following patterns were generated by expo-cli

expo-env.d.ts
# @end expo-cli
50 changes: 50 additions & 0 deletions apps/reaction-speed-test/README.md
Original file line number Diff line number Diff line change
@@ -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.
37 changes: 37 additions & 0 deletions apps/reaction-speed-test/app.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import type { ConfigContext, ExpoConfig } from "expo/config";

export default ({ config }: ConfigContext): ExpoConfig => ({
...config,
name: "reaction-speed-test",
slug: "reaction-speed-test",
scheme: "reaction-speed-test",
version: "1.0.0",
orientation: "portrait",
icon: "./assets/images/icon.png",
userInterfaceStyle: "automatic",
splash: {
image: "./assets/images/splash.png",
resizeMode: "contain",
backgroundColor: "#ffffff",
},
ios: {
supportsTablet: true,
},
android: {
adaptiveIcon: {
foregroundImage: "./assets/images/adaptive-icon.png",
backgroundColor: "#ffffff",
},
},
web: {
bundler: "metro",
output: "static",
favicon: "./assets/images/favicon.png",
},
plugins: ["expo-router", "expo-localization"],
experiments: {
tsconfigPaths: true,
typedRoutes: true,
baseUrl: "/app-factory/reaction-speed-test",
},
});
9 changes: 9 additions & 0 deletions apps/reaction-speed-test/app/(pages)/_layout.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { Stack } from "expo-router";

export default function PagesLayout() {
return (
<Stack>
<Stack.Screen name="index" options={{ headerShown: false }} />
</Stack>
);
}
20 changes: 20 additions & 0 deletions apps/reaction-speed-test/app/(pages)/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import { Link } from "expo-router";
import { SafeAreaView, Text, View } from "react-native";

export default function HomeScreen() {
return (
<SafeAreaView className="h-full">
<View className="flex-auto items-center justify-center gap-y-10">
<Link href={{ pathname: "./measurement" }}>
<Text>시작하기</Text>
</Link>
<Link href={{ pathname: "./results" }}>
<Text>기록보기</Text>
</Link>
<Link href={{ pathname: "./settings" }}>
<Text>설정</Text>
</Link>
</View>
</SafeAreaView>
);
}
20 changes: 20 additions & 0 deletions apps/reaction-speed-test/app/(pages)/measurement.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import { Button, ButtonText } from "@/components/ui/button";
import { Stack, useRouter } from "expo-router";
import type { FC } from "react";
import { Text, View } from "react-native";

const Measurement: FC = () => {
const router = useRouter();

return (
<View className="flex-1 items-center justify-center">
<Stack.Screen options={{ title: "측정 페이지", headerShown: false }} />
<Text className="mb-5 text-2xl">측정 페이지</Text>
<Button className="bg-slate-500" onPress={() => router.back()}>
<ButtonText>뒤로 가기</ButtonText>
</Button>
</View>
);
};

export default Measurement;
20 changes: 20 additions & 0 deletions apps/reaction-speed-test/app/(pages)/results.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import { Button, ButtonText } from "@/components/ui/button";
import { Stack, useRouter } from "expo-router";
import type { FC } from "react";
import { Text, View } from "react-native";

const Results: FC = () => {
const router = useRouter();

return (
<View className="flex-1 items-center justify-center">
<Stack.Screen options={{ title: "기록 페이지", headerShown: false }} />
<Text className="mb-5 text-2xl">기록 페이지</Text>
<Button className="bg-slate-500" onPress={() => router.back()}>
<ButtonText>뒤로 가기</ButtonText>
</Button>
</View>
);
};

export default Results;
20 changes: 20 additions & 0 deletions apps/reaction-speed-test/app/(pages)/settings.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import { Button, ButtonText } from "@/components/ui/button";
import { Stack, useRouter } from "expo-router";
import type { FC } from "react";
import { Text, View } from "react-native";

const Settings: FC = () => {
const router = useRouter();

return (
<View className="flex-1 items-center justify-center">
<Stack.Screen options={{ title: "설정 페이지", headerShown: false }} />
<Text className="mb-5 text-2xl">설정 페이지</Text>
<Button className="bg-slate-500" onPress={() => router.back()}>
<ButtonText>뒤로 가기</ButtonText>
</Button>
</View>
);
};

export default Settings;
44 changes: 44 additions & 0 deletions apps/reaction-speed-test/app/+html.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
import type { PropsWithChildren } from "react";

import { ScrollViewStyleReset } from "expo-router/html";

/**
* This file is web-only and used to configure the root HTML for every web page during static rendering.
* The contents of this function only run in Node.js environments and do not have access to the DOM or browser APIs.
*/
export default function Root({ children }: PropsWithChildren) {
return (
<html lang="en">
<head>
<meta charSet="utf-8" />
<meta httpEquiv="X-UA-Compatible" content="IE=edge" />
<meta
name="viewport"
content="width=device-width, initial-scale=1, shrink-to-fit=no"
/>

{/*
Disable body scrolling on web. This makes ScrollView components work closer to how they do on native.
However, body scrolling is often nice to have for mobile web. If you want to enable it, remove this line.
*/}
<ScrollViewStyleReset />

{/* Using raw CSS styles as an escape-hatch to ensure the background color never flickers in dark-mode. */}
{/* biome-ignore lint/security/noDangerouslySetInnerHtml: for css */}
<style dangerouslySetInnerHTML={{ __html: responsiveBackground }} />
{/* Add any additional <head> elements that you want globally available on web... */}
</head>
<body>{children}</body>
</html>
);
}

const responsiveBackground = `
body {
background-color: #fff;
}
@media (prefers-color-scheme: dark) {
body {
background-color: #000;
}
}`;
17 changes: 17 additions & 0 deletions apps/reaction-speed-test/app/+not-found.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { ThemedText } from "@/components/ThemedText";
import { ThemedView } from "@/components/ThemedView";
import { Link, Stack } from "expo-router";

export default function NotFoundScreen() {
return (
<>
<Stack.Screen options={{ title: "Oops!" }} />
<ThemedView className="flex-1 items-center justify-center p-5">
<ThemedText type="title">This screen doesn't exist.</ThemedText>
<Link href="/" className="mt-4 py-4">
<ThemedText type="link">Go to home screen!</ThemedText>
</Link>
</ThemedView>
</>
);
}
58 changes: 58 additions & 0 deletions apps/reaction-speed-test/app/_layout.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
import "@/global.css";
import { GluestackUIProvider } from "@/components/ui/gluestack-ui-provider";
import {
DarkTheme,
DefaultTheme,
ThemeProvider,
} from "@react-navigation/native";
import { useFonts } from "expo-font";
import * as SplashScreen from "expo-splash-screen";
import { useColorScheme } from "nativewind";
import { type PropsWithChildren, useEffect, useState } from "react";
import "react-native-reanimated";
import WebviewLayout from "@/components/WebviewLayout";
import "@/i18n";
import { Stack } from "expo-router";

SplashScreen.preventAutoHideAsync();

function AppContainer({ children }: PropsWithChildren) {
const { colorScheme } = useColorScheme();

return (
<ThemeProvider value={colorScheme === "dark" ? DarkTheme : DefaultTheme}>
{children}
</ThemeProvider>
);
}

export default function RootLayout() {
const [loaded] = useFonts({
SpaceMono: require("../assets/fonts/SpaceMono-Regular.ttf"),
});
const [isReady, setIsReady] = useState(false);

useEffect(() => {
if (loaded) {
SplashScreen.hideAsync();
setIsReady(true);
}
}, [loaded]);

if (!(loaded && isReady)) {
return null;
}

return (
<GluestackUIProvider mode="light">
<AppContainer>
<WebviewLayout>
<Stack>
<Stack.Screen name="(pages)" options={{ headerShown: false }} />
<Stack.Screen name="+not-found" />
</Stack>
</WebviewLayout>
</AppContainer>
</GluestackUIProvider>
);
}
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added apps/reaction-speed-test/assets/images/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added apps/reaction-speed-test/assets/images/il.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
27 changes: 27 additions & 0 deletions apps/reaction-speed-test/babel.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
module.exports = (api) => {
api.cache(true);
return {
presets: [
[
"babel-preset-expo",
{
jsxImportSource: "nativewind",
},
],
"nativewind/babel",
],
plugins: [
"react-native-reanimated/plugin",
[
"module-resolver",
{
root: ["./"],

alias: {
"@": "./",
},
},
],
],
};
};
36 changes: 36 additions & 0 deletions apps/reaction-speed-test/components/Collapsible.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import type { PropsWithChildren } from "react";

import Ionicons from "@expo/vector-icons/Ionicons";
import { useColorScheme } from "nativewind";
import { useState } from "react";
import { TouchableOpacity } from "react-native";

import { ThemedText } from "@/components/ThemedText";
import { ThemedView } from "@/components/ThemedView";
import { Colors } from "@/constants/Colors";

export function Collapsible({
children,
title,
}: PropsWithChildren & { title: string }) {
const [isOpen, setIsOpen] = useState(false);
const { colorScheme = "light" } = useColorScheme();

return (
<ThemedView>
<TouchableOpacity
className="flex-row items-center gap-1.5"
onPress={() => setIsOpen((value) => !value)}
activeOpacity={0.8}
>
<Ionicons
name={isOpen ? "chevron-down" : "chevron-forward-outline"}
size={18}
color={colorScheme === "light" ? Colors.light.icon : Colors.dark.icon}
/>
<ThemedText type="defaultSemiBold">{title}</ThemedText>
</TouchableOpacity>
{isOpen && <ThemedView className="mt-1.5 ml-6">{children}</ThemedView>}
</ThemedView>
);
}
Loading