This repository has been archived by the owner on Jan 4, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
16 changed files
with
8,054 additions
and
154 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,6 @@ | ||
{ | ||
"ec72f44c26176596b3f8f4ff2733f1c6a0f87fe6224a117439a1caea409505fd": true, | ||
"24272cdaeff82cc5facdaccd982a6f05b60c4504704bbf94c19a6388659880bb": true, | ||
"5193b4ad8735090dcbfaf0e070e7354ee4bc3b7951faf1edbe2757aa21757f96": true, | ||
"4c27b7466a8169ab063b6150f65d7c75c2919ff2c1e5572f55d537c6ca04ff9e": true, | ||
"5deb055be550b37ca358a297078e0b7f15f2a3f95c0c5cfb6db9c9e376cc7900": true | ||
"5deb055be550b37ca358a297078e0b7f15f2a3f95c0c5cfb6db9c9e376cc7900": true, | ||
"a6e8d411aca0ff090240d14acbd91ebb042e7c25efa95deea3e7decf80ea0cf2": true | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,89 +1,46 @@ | ||
import React from "react"; | ||
import React, { useEffect, useState } from "react"; | ||
import AppLoading from "expo-app-loading"; | ||
import { NavigationContainer } from "@react-navigation/native"; | ||
import { createStackNavigator } from "@react-navigation/stack"; | ||
|
||
// eslint-disable-next-line camelcase | ||
import { | ||
StyleSheet, | ||
Button, | ||
View, | ||
SafeAreaView, | ||
Text, | ||
Alert, | ||
} from "react-native"; | ||
useFonts, | ||
// eslint-disable-next-line camelcase | ||
Inter_300Light, | ||
// eslint-disable-next-line camelcase | ||
Inter_600SemiBold, | ||
} from "@expo-google-fonts/inter"; | ||
|
||
import Home from "./src/modules/Home"; | ||
import Settings from "./src/modules/Settings"; | ||
|
||
const styles = StyleSheet.create({ | ||
container: { | ||
flex: 1, | ||
justifyContent: "center", | ||
marginHorizontal: 16, | ||
}, | ||
title: { | ||
textAlign: "center", | ||
marginVertical: 8, | ||
}, | ||
fixToText: { | ||
flexDirection: "row", | ||
justifyContent: "space-between", | ||
}, | ||
separator: { | ||
marginVertical: 8, | ||
borderBottomColor: "#737373", | ||
borderBottomWidth: StyleSheet.hairlineWidth, | ||
}, | ||
}); | ||
import DarkModeContext from "./src/contexts/DarkModeContext"; | ||
import DarkTheme from "./src/themes/DarkTheme"; | ||
import DefaultTheme from "./src/themes/DefaultTheme"; | ||
|
||
const Separator = () => <View style={styles.separator} />; | ||
const Stack = createStackNavigator(); | ||
|
||
export default function App(): JSX.Element { | ||
return ( | ||
<SafeAreaView style={styles.container}> | ||
<View> | ||
<Text style={styles.title}> | ||
The title and onPress handler are required. It is recommended to set | ||
accessibilityLabel to help make your app usable by everyone. :) | ||
</Text> | ||
<Button | ||
title="Press me" | ||
onPress={() => Alert.alert("Simple Button pressed")} | ||
/> | ||
</View> | ||
<Separator /> | ||
<View> | ||
<Text style={styles.title}> | ||
Adjust the color in a way that looks standard on each platform. On | ||
iOS, the color prop controls the color of the text. On Android, the | ||
color adjusts the background color of the button. | ||
</Text> | ||
<Button | ||
title="Press me" | ||
color="#f194ff" | ||
onPress={() => Alert.alert("Button with adjusted color pressed")} | ||
/> | ||
</View> | ||
<Separator /> | ||
<View> | ||
<Text style={styles.title}> | ||
All interaction for the component are disabled. | ||
</Text> | ||
<Button | ||
title="Press me" | ||
disabled | ||
onPress={() => Alert.alert("Cannot press this one")} | ||
/> | ||
</View> | ||
<Separator /> | ||
<View> | ||
<Text style={styles.title}> | ||
This layout strategy lets the title define the width of the button. | ||
</Text> | ||
<View style={styles.fixToText}> | ||
<Button | ||
title="Left button" | ||
onPress={() => Alert.alert("Left button pressed")} | ||
/> | ||
<Button | ||
title="Right button" | ||
onPress={() => Alert.alert("Right button pressed")} | ||
/> | ||
</View> | ||
</View> | ||
</SafeAreaView> | ||
const [fontsLoaded] = useFonts({ Inter_300Light, Inter_600SemiBold }); | ||
const [dark, setDark] = useState(true); | ||
const [theme, setTheme] = useState(DarkTheme); | ||
|
||
useEffect(() => { | ||
const newTheme = dark ? DarkTheme : DefaultTheme; | ||
setTheme(newTheme); | ||
}, [dark]); | ||
|
||
return !fontsLoaded ? ( | ||
<AppLoading /> | ||
) : ( | ||
<NavigationContainer theme={theme}> | ||
<DarkModeContext.Provider value={{ dark, setDark }}> | ||
<Stack.Navigator initialRouteName="Home"> | ||
<Stack.Screen name="Home" component={Home} /> | ||
<Stack.Screen name="Settings" component={Settings} /> | ||
</Stack.Navigator> | ||
</DarkModeContext.Provider> | ||
</NavigationContainer> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import React from "react"; | ||
|
||
const DarkModeContext = React.createContext<{ | ||
dark: boolean; | ||
setDark: React.Dispatch<React.SetStateAction<boolean>>; | ||
}>({ | ||
dark: true, | ||
// eslint-disable-next-line @typescript-eslint/no-empty-function | ||
setDark: () => {}, | ||
}); | ||
|
||
export default DarkModeContext; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import React, { useContext } from "react"; | ||
import { View, SafeAreaView, Text, Button, StyleSheet } from "react-native"; | ||
import { useTheme } from "@react-navigation/native"; | ||
import DarkModeContext from "../contexts/DarkModeContext"; | ||
|
||
export default function Home(): JSX.Element { | ||
const { dark, setDark } = useContext(DarkModeContext); | ||
const { colors } = useTheme(); | ||
|
||
const styles = StyleSheet.create({ | ||
text: { | ||
color: colors.text, | ||
}, | ||
}); | ||
|
||
return ( | ||
<SafeAreaView | ||
style={{ | ||
flex: 1, | ||
flexDirection: "column", | ||
justifyContent: "center", | ||
alignItems: "center", | ||
}} | ||
> | ||
<View> | ||
<Text style={styles.text}>Bruh :) {String(dark)}</Text> | ||
<Button title={String(dark)} onPress={() => setDark((prev) => !prev)} /> | ||
</View> | ||
</SafeAreaView> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import React from "react"; | ||
import { View, SafeAreaView, Text } from "react-native"; | ||
|
||
export default function Settings(): JSX.Element { | ||
return ( | ||
<SafeAreaView | ||
style={{ | ||
flex: 1, | ||
flexDirection: "column", | ||
justifyContent: "center", | ||
alignItems: "center", | ||
}} | ||
> | ||
<View> | ||
<Text>Settings</Text> | ||
</View> | ||
</SafeAreaView> | ||
); | ||
} |
Oops, something went wrong.