Skip to content

Commit e86ccbb

Browse files
committed
feat(*): initial commit
1 parent 6be4eec commit e86ccbb

File tree

9 files changed

+1517
-32
lines changed

9 files changed

+1517
-32
lines changed

App.tsx

Lines changed: 7 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,11 @@
1-
import { StatusBar } from 'expo-status-bar';
2-
import React from 'react';
3-
import { StyleSheet, Text, View } from 'react-native';
1+
import React from 'react'
2+
import AppContainer from './src/components/app-container'
3+
import Main from './src/screens/main'
44

55
export default function App() {
66
return (
7-
<View style={styles.container}>
8-
<Text>Open up App.tsx to start working on your app!</Text>
9-
<StatusBar style="auto" />
10-
</View>
11-
);
7+
<AppContainer>
8+
<Main />
9+
</AppContainer>
10+
)
1211
}
13-
14-
const styles = StyleSheet.create({
15-
container: {
16-
flex: 1,
17-
backgroundColor: '#fff',
18-
alignItems: 'center',
19-
justifyContent: 'center',
20-
},
21-
});

package.json

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,31 @@
1010
"eject": "expo eject"
1111
},
1212
"dependencies": {
13+
"@react-navigation/drawer": "^6.1.8",
14+
"@react-navigation/native": "^6.0.6",
15+
"@types/shortid": "^0.0.29",
1316
"expo": "~43.0.2",
17+
"expo-linking": "^2.4.2",
1418
"expo-status-bar": "~1.1.0",
19+
"moti": "^0.16.1",
20+
"native-base": "^3.2.1",
1521
"react": "17.0.1",
1622
"react-dom": "17.0.1",
1723
"react-native": "0.64.3",
18-
"react-native-web": "0.17.1"
24+
"react-native-reanimated": "^2.2.4",
25+
"react-native-safe-area-context": "^3.3.2",
26+
"react-native-screens": "^3.9.0",
27+
"react-native-svg": "^12.1.1",
28+
"react-native-web": "0.17.1",
29+
"shortid": "^2.2.16",
30+
"styled-components": "^5.3.3",
31+
"styled-system": "^5.1.5"
1932
},
2033
"devDependencies": {
2134
"@babel/core": "^7.12.9",
2235
"@types/react": "~17.0.21",
2336
"@types/react-native": "~0.64.12",
37+
"prettier": "^2.4.1",
2438
"typescript": "~4.3.5"
2539
},
2640
"private": true

prettier.config.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
const options ={
2+
arrowParens: 'avoid',
3+
singleQuote: true,
4+
backetSpacing: true,
5+
endOfLine: 'lf',
6+
semi: false,
7+
tabWidth: 2,
8+
trailingComma: 'none'
9+
}
10+
module.exports = options

src/components/app-container.tsx

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import * as React from 'react'
2+
import { NavigationContainer } from '@react-navigation/native'
3+
import { NativeBaseProvider } from 'native-base'
4+
import theme from '../theme'
5+
6+
type Props = {
7+
children: React.ReactNode
8+
}
9+
10+
export default function AppContainer(props: Props) {
11+
return (
12+
<NavigationContainer>
13+
<NativeBaseProvider theme={theme}>{props.children}</NativeBaseProvider>
14+
</NavigationContainer>
15+
)
16+
}

src/components/theme-toggle.tsx

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import React from 'react'
2+
import { Text, HStack, Switch, useColorMode } from 'native-base'
3+
4+
export default function ThemeToggle() {
5+
const { colorMode, toggleColorMode } = useColorMode()
6+
return (
7+
<HStack space={2} alignItems="center">
8+
<Text>Dark</Text>
9+
<Switch
10+
isChecked={colorMode === 'light'}
11+
onToggle={toggleColorMode}
12+
></Switch>
13+
<Text>Light</Text>
14+
</HStack>
15+
)
16+
}

src/screens/main.tsx

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import * as React from 'react'
2+
import { Text, Box, Center, VStack, useColorModeValue } from 'native-base'
3+
import ThemeToggle from '../components/theme-toggle'
4+
5+
export default function MainScreen() {
6+
return (
7+
<Center
8+
_dark={{ bg: 'blueGray.900' }}
9+
_light={{ bg: 'blueGray.50' }}
10+
px={4}
11+
flex={1}
12+
>
13+
<VStack space={5} alignItems="center">
14+
<Box p={10} bg={useColorModeValue('red.500', 'yellow.500')}>
15+
<Text>Hello</Text>
16+
</Box>
17+
<ThemeToggle />
18+
</VStack>
19+
</Center>
20+
)
21+
}

src/theme.ts

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import { extendTheme } from 'native-base'
2+
3+
const config = {
4+
useSystemColorMode: false,
5+
initialColorMode: 'light'
6+
}
7+
8+
const colors = {
9+
primary: {
10+
50: '#EEF2F6',
11+
100: '#CFD9E7',
12+
200: '#B1C1D8',
13+
300: '#92A9C9',
14+
400: '#7491B9',
15+
500: '#5578AA',
16+
600: '#446088',
17+
700: '#334866',
18+
800: '#223044',
19+
900: '#111822'
20+
}
21+
}
22+
23+
export default extendTheme({ config, colors })

tsconfig.json

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,16 @@
11
{
22
"extends": "expo/tsconfig.base",
33
"compilerOptions": {
4-
"strict": true
4+
"strict": true,
5+
"allowSyntheticDefaultImports": true,
6+
"jsx": "react-native",
7+
"lib": [
8+
"dom",
9+
"esnext"
10+
],
11+
"moduleResolution": "node",
12+
"noEmit": true,
13+
"skipLibCheck": true,
14+
"resolveJsonModule": true,
515
}
616
}

0 commit comments

Comments
 (0)