Skip to content

Commit

Permalink
feat(*): initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
craftzdog committed Nov 10, 2021
1 parent 6be4eec commit e86ccbb
Show file tree
Hide file tree
Showing 9 changed files with 1,517 additions and 32 deletions.
24 changes: 7 additions & 17 deletions App.tsx
Original file line number Diff line number Diff line change
@@ -1,21 +1,11 @@
import { StatusBar } from 'expo-status-bar';
import React from 'react';
import { StyleSheet, Text, View } from 'react-native';
import React from 'react'
import AppContainer from './src/components/app-container'
import Main from './src/screens/main'

export default function App() {
return (
<View style={styles.container}>
<Text>Open up App.tsx to start working on your app!</Text>
<StatusBar style="auto" />
</View>
);
<AppContainer>
<Main />
</AppContainer>
)
}

const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: '#fff',
alignItems: 'center',
justifyContent: 'center',
},
});
16 changes: 15 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,31 @@
"eject": "expo eject"
},
"dependencies": {
"@react-navigation/drawer": "^6.1.8",
"@react-navigation/native": "^6.0.6",
"@types/shortid": "^0.0.29",
"expo": "~43.0.2",
"expo-linking": "^2.4.2",
"expo-status-bar": "~1.1.0",
"moti": "^0.16.1",
"native-base": "^3.2.1",
"react": "17.0.1",
"react-dom": "17.0.1",
"react-native": "0.64.3",
"react-native-web": "0.17.1"
"react-native-reanimated": "^2.2.4",
"react-native-safe-area-context": "^3.3.2",
"react-native-screens": "^3.9.0",
"react-native-svg": "^12.1.1",
"react-native-web": "0.17.1",
"shortid": "^2.2.16",
"styled-components": "^5.3.3",
"styled-system": "^5.1.5"
},
"devDependencies": {
"@babel/core": "^7.12.9",
"@types/react": "~17.0.21",
"@types/react-native": "~0.64.12",
"prettier": "^2.4.1",
"typescript": "~4.3.5"
},
"private": true
Expand Down
10 changes: 10 additions & 0 deletions prettier.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
const options ={
arrowParens: 'avoid',
singleQuote: true,
backetSpacing: true,
endOfLine: 'lf',
semi: false,
tabWidth: 2,
trailingComma: 'none'
}
module.exports = options
16 changes: 16 additions & 0 deletions src/components/app-container.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import * as React from 'react'
import { NavigationContainer } from '@react-navigation/native'
import { NativeBaseProvider } from 'native-base'
import theme from '../theme'

type Props = {
children: React.ReactNode
}

export default function AppContainer(props: Props) {
return (
<NavigationContainer>
<NativeBaseProvider theme={theme}>{props.children}</NativeBaseProvider>
</NavigationContainer>
)
}
16 changes: 16 additions & 0 deletions src/components/theme-toggle.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import React from 'react'
import { Text, HStack, Switch, useColorMode } from 'native-base'

export default function ThemeToggle() {
const { colorMode, toggleColorMode } = useColorMode()
return (
<HStack space={2} alignItems="center">
<Text>Dark</Text>
<Switch
isChecked={colorMode === 'light'}
onToggle={toggleColorMode}
></Switch>
<Text>Light</Text>
</HStack>
)
}
21 changes: 21 additions & 0 deletions src/screens/main.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import * as React from 'react'
import { Text, Box, Center, VStack, useColorModeValue } from 'native-base'
import ThemeToggle from '../components/theme-toggle'

export default function MainScreen() {
return (
<Center
_dark={{ bg: 'blueGray.900' }}
_light={{ bg: 'blueGray.50' }}
px={4}
flex={1}
>
<VStack space={5} alignItems="center">
<Box p={10} bg={useColorModeValue('red.500', 'yellow.500')}>
<Text>Hello</Text>
</Box>
<ThemeToggle />
</VStack>
</Center>
)
}
23 changes: 23 additions & 0 deletions src/theme.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { extendTheme } from 'native-base'

const config = {
useSystemColorMode: false,
initialColorMode: 'light'
}

const colors = {
primary: {
50: '#EEF2F6',
100: '#CFD9E7',
200: '#B1C1D8',
300: '#92A9C9',
400: '#7491B9',
500: '#5578AA',
600: '#446088',
700: '#334866',
800: '#223044',
900: '#111822'
}
}

export default extendTheme({ config, colors })
12 changes: 11 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,16 @@
{
"extends": "expo/tsconfig.base",
"compilerOptions": {
"strict": true
"strict": true,
"allowSyntheticDefaultImports": true,
"jsx": "react-native",
"lib": [
"dom",
"esnext"
],
"moduleResolution": "node",
"noEmit": true,
"skipLibCheck": true,
"resolveJsonModule": true,
}
}
Loading

0 comments on commit e86ccbb

Please sign in to comment.