Skip to content
Open
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
43 changes: 43 additions & 0 deletions jinwon/threads/.gitignore
Original file line number Diff line number Diff line change
@@ -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 change: 1 addition & 0 deletions jinwon/threads/.vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{ "recommendations": ["expo.vscode-expo-tools"] }
7 changes: 7 additions & 0 deletions jinwon/threads/.vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"editor.codeActionsOnSave": {
"source.fixAll": "explicit",
"source.organizeImports": "explicit",
"source.sortMembers": "explicit"
}
}
50 changes: 50 additions & 0 deletions jinwon/threads/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.
62 changes: 62 additions & 0 deletions jinwon/threads/app.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
{
"expo": {
"name": "threads",
"slug": "threads",
"version": "1.0.0",
"orientation": "portrait",
"icon": "./assets/images/icon.png",
"scheme": "threads",
"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,
"package": "com.jjing_wong.threads"
},
"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"
}
}
],
[
"expo-location",
{
"locationAlwaysAndWhenInUsePermission": "Allow $(PRODUCT_NAME) to use your location."
}
],
"expo-secure-store"
],
"experiments": {
"typedRoutes": true,
"reactCompiler": true
},
"extra": {
"router": {},
"eas": {
"projectId": "daa969a2-1fd0-4dd1-9d51-495bacd69045"
}
}
}
}
196 changes: 196 additions & 0 deletions jinwon/threads/app/(tabs)/(home)/_layout.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,196 @@
import {
type MaterialTopTabNavigationEventMap,
type MaterialTopTabNavigationOptions,
createMaterialTopTabNavigator,
} from "@react-navigation/material-top-tabs";
import { Slot, withLayoutContext } from "expo-router";
import type {
ParamListBase,
TabNavigationState,
} from "@react-navigation/native";
import {
Pressable,
View,
Image,
Text,
useColorScheme,
Appearance,
} from "react-native";
import { useState } from "react";
import { AuthContext } from "@/app/_layout";
import { useContext } from "react";
import { useSafeAreaInsets } from "react-native-safe-area-context";
import { StyleSheet } from "react-native";
import { Ionicons } from "@expo/vector-icons";
import SideMenu from "@/components/SideMenu";
import { BlurView } from "expo-blur";
import { TouchableOpacity } from "react-native";
import { router } from "expo-router";
const { Navigator } = createMaterialTopTabNavigator();

export const MaterialTopTabs = withLayoutContext<
MaterialTopTabNavigationOptions,
typeof Navigator,
TabNavigationState<ParamListBase>,
MaterialTopTabNavigationEventMap
>(Navigator);

export default function TabLayout() {
const colorScheme = useColorScheme();
const insets = useSafeAreaInsets();
const [isSideMenuOpen, setIsSideMenuOpen] = useState(false);
const { user } = useContext(AuthContext);
const isLoggedIn = !!user;

return (
<View
style={[
styles.container,
{ paddingTop: insets.top, paddingBottom: insets.bottom },
colorScheme === "dark" ? styles.containerDark : styles.containerLight,
]}
>
<BlurView
style={[
styles.header,
colorScheme === "dark" ? styles.headerDark : styles.headerLight,
]}
intensity={colorScheme === "dark" ? 5 : 70}
>
{isLoggedIn && (
<Pressable
style={styles.menuButton}
onPress={() => {
setIsSideMenuOpen(true);
}}
>
<Ionicons
name="menu"
size={24}
color={colorScheme === "dark" ? "gray" : "black"}
/>
</Pressable>
)}
<SideMenu
isVisible={isSideMenuOpen}
onClose={() => setIsSideMenuOpen(false)}
/>
<Image
source={require("../../../assets/images/react-logo.png")}
style={styles.headerLogo}
/>
{!isLoggedIn && (
<TouchableOpacity
style={[
styles.loginButton,
colorScheme === "dark"
? styles.loginButtonDark
: styles.loginButtonLight,
]}
onPress={() => {
console.log("loginButton onPress");
router.navigate(`/login`);
}}
>
<Text
style={
colorScheme === "dark"
? styles.loginButtonTextDark
: styles.loginButtonTextLight
}
>
로그인
</Text>
</TouchableOpacity>
)}
</BlurView>
{isLoggedIn ? (
<MaterialTopTabs
screenOptions={{
lazy: true,
tabBarStyle: {
backgroundColor: colorScheme === "dark" ? "#101010" : "white",
shadowColor: "transparent",
position: "relative",
},
tabBarLabelStyle: {
fontSize: 16,
fontWeight: "bold",
},
tabBarPressColor: "transparent",
tabBarActiveTintColor: colorScheme === "dark" ? "white" : "#555",
tabBarIndicatorStyle: {
backgroundColor: colorScheme === "dark" ? "white" : "black",
height: 1,
},
tabBarIndicatorContainerStyle: {
backgroundColor: colorScheme === "dark" ? "#aaa" : "#555",
position: "absolute",
top: 49,
height: 1,
},
}}
>
<MaterialTopTabs.Screen name="index" options={{ title: "For You" }} />
<MaterialTopTabs.Screen
name="following"
options={{ title: "Following" }}
/>
</MaterialTopTabs>
) : (
<Slot />
)}
</View>
);
}

const styles = StyleSheet.create({
container: {
flex: 1,
},
containerLight: {
backgroundColor: "white",
},
containerDark: {
backgroundColor: "#101010",
},
header: {
flexDirection: "row",
justifyContent: "center",
alignItems: "center",
paddingHorizontal: 16,
height: 50,
},
headerLight: {
backgroundColor: "white",
},
headerDark: {
backgroundColor: "#101010",
},
menuButton: {
position: "absolute",
left: 16,
},
headerLogo: {
width: 32,
height: 32,
},
loginButton: {
padding: 8,
borderRadius: 4,
position: "absolute",
right: 16,
},
loginButtonLight: {
backgroundColor: "black",
},
loginButtonDark: {
backgroundColor: "white",
},
loginButtonTextLight: {
color: "white",
},
loginButtonTextDark: {
color: "black",
},
});
1 change: 1 addition & 0 deletions jinwon/threads/app/(tabs)/(home)/following.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { default } from ".";
Loading