Skip to content

Commit

Permalink
base core
Browse files Browse the repository at this point in the history
  • Loading branch information
dotfelixb committed Feb 25, 2022
1 parent 1a63411 commit 35ae83c
Show file tree
Hide file tree
Showing 11 changed files with 588 additions and 48 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,6 @@ web-build/

# macOS
.DS_Store

# lock
*.lock
50 changes: 35 additions & 15 deletions App.tsx
Original file line number Diff line number Diff line change
@@ -1,20 +1,40 @@
import { StatusBar } from 'expo-status-bar';
import { StyleSheet, Text, View } from 'react-native';
import 'react-native-gesture-handler';
import { DripsyProvider } from 'dripsy';
import AppLoading from 'expo-app-loading';
import { useFonts } from 'expo-font';
import { StatusBar } from 'expo-status-bar';
import React from 'react';
import { useColorScheme } from 'react-native';
import { AppProvider } from './src/ctx';
import { DarkTheme, LightTheme } from './src/theme';
import { NavigationContainer } from '@react-navigation/native';
import { createNativeStackNavigator } from '@react-navigation/native-stack';
import { HomeScreen } from './src/screens';

const Stack = createNativeStackNavigator();

export default function App() {
const theme = useColorScheme() === "light" ? LightTheme : DarkTheme

let [fontsLoaded] = useFonts({
"OpenSans": require("./assets/fonts/OpenSans-Regular.ttf")
});

if (!fontsLoaded) {
return <AppLoading />
}

return (
<View style={styles.container}>
<Text>Open up App.tsx to start working on your app!</Text>
<StatusBar style="auto" />
</View>
);
<DripsyProvider theme={theme}>
<StatusBar style='auto'/>
<AppProvider value={{}}>
<NavigationContainer>
<Stack.Navigator screenOptions={{headerShown: false}}>
<Stack.Screen name="Home" component={HomeScreen} />
</Stack.Navigator>
</NavigationContainer>
</AppProvider>
</DripsyProvider>
)
}

const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: '#fff',
alignItems: 'center',
justifyContent: 'center',
},
});
Binary file added assets/fonts/OpenSans-Regular.ttf
Binary file not shown.
3 changes: 3 additions & 0 deletions babel.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,8 @@ module.exports = function(api) {
api.cache(true);
return {
presets: ['babel-preset-expo'],
plugins: [
'react-native-reanimated/plugin',
],
};
};
9 changes: 9 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,20 @@
"eject": "expo eject"
},
"dependencies": {
"@react-navigation/native": "^6.0.8",
"@react-navigation/native-stack": "^6.5.0",
"dripsy": "^3.6.0",
"expo": "~44.0.0",
"expo-app-loading": "~1.3.0",
"expo-font": "~10.0.4",
"expo-status-bar": "~1.2.0",
"react": "17.0.1",
"react-dom": "17.0.1",
"react-native": "0.64.3",
"react-native-gesture-handler": "~2.1.0",
"react-native-reanimated": "~2.3.1",
"react-native-safe-area-context": "3.3.2",
"react-native-screens": "~3.10.1",
"react-native-web": "0.17.1"
},
"devDependencies": {
Expand Down
10 changes: 10 additions & 0 deletions src/ctx/AppCtx.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import React, { createContext } from "react";
import { ProviderProps } from "react";

interface IAppContext {}

export const AppContext = createContext<IAppContext>({});

export const AppProvider = ({ children }: ProviderProps<IAppContext>) => {
return <AppContext.Provider value={{}}>{children}</AppContext.Provider>;
};
1 change: 1 addition & 0 deletions src/ctx/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { AppContext, AppProvider } from "./AppCtx";
8 changes: 8 additions & 0 deletions src/screens/HomeScreen.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import React from "react";
import { View, Text } from "dripsy";

const HomeScreen = () => {
return <View sx={{ flex: 1, backgroundColor: "background" }}></View>;
};

export default HomeScreen;
1 change: 1 addition & 0 deletions src/screens/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export {default as HomeScreen} from "./HomeScreen"
67 changes: 67 additions & 0 deletions src/theme/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
import { makeTheme } from "dripsy";
import { Platform } from "react-native";

const webFont = (font: string) =>
Platform.select({
web: `${font}, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif`,
default: font,
});

const Colors = {
White: "#ffffff",
Button: "#5766f2",
BackgroundLight: "#fff",
BackgroundDark: "#36393f",
};

const LightTheme = makeTheme({
customFonts: {
"OpenSans": {
default: webFont("OpenSans"),
bold: webFont("OpenSans"),
normal: webFont("OpenSans"),
400: "OpenSans",
500: "OpenSans",
600: "OpenSans",
700: "OpenSans",
800: "OpenSans",
900: "OpenSans",
},
},
colors: {
text: "#2e3338",
heading: "#060607",
button: Colors.Button,
buttontext: "#ffffff",
background: "#fff",
backgroundalt: "#f2f3f5",
},
fonts: { root: "Whitney-Regular" },
});

const DarkTheme = makeTheme({
customFonts: {
"OpenSans": {
default: webFont("OpenSans"),
bold: webFont("OpenSans"),
normal: webFont("OpenSans"),
400: "OpenSans",
500: "OpenSans",
600: "OpenSans",
700: "OpenSans",
800: "OpenSans",
900: "OpenSans",
},
},
colors: {
text: "#dcddde",
heading: "#ffffff",
button: Colors.Button,
buttontext: "#ffffff",
background: Colors.BackgroundDark,
backgroundalt: "#2f3136",
},
fonts: { root: "Whitney-Regular" },
});

export { Colors, DarkTheme, LightTheme };
Loading

0 comments on commit 35ae83c

Please sign in to comment.