forked from sdp-tech/UPCY_Mobile
-
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.
sdp-tech#7 feat: add tab navigation structure (sdp-tech#9)
- Loading branch information
Showing
10 changed files
with
2,363 additions
and
471 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,10 @@ | ||
module.exports = { | ||
root: true, | ||
extends: '@react-native', | ||
extends: [ | ||
'eslint:recommended', | ||
'@react-native-community', | ||
'airbnb', | ||
'airbnb/hooks', | ||
'plugin:prettier/recommended' | ||
], | ||
}; |
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,118 +1,44 @@ | ||
/** | ||
* Sample React Native App | ||
* https://github.com/facebook/react-native | ||
* | ||
* @format | ||
*/ | ||
|
||
import React from 'react'; | ||
import type {PropsWithChildren} from 'react'; | ||
import { | ||
SafeAreaView, | ||
ScrollView, | ||
StatusBar, | ||
StyleSheet, | ||
Text, | ||
useColorScheme, | ||
View, | ||
} from 'react-native'; | ||
import { NavigationContainer } from '@react-navigation/native'; | ||
import { createNativeStackNavigator } from '@react-navigation/native-stack'; | ||
import { createBottomTabNavigator } from '@react-navigation/bottom-tabs'; | ||
|
||
import { | ||
Colors, | ||
DebugInstructions, | ||
Header, | ||
LearnMoreLinks, | ||
ReloadInstructions, | ||
} from 'react-native/Libraries/NewAppScreen'; | ||
import HomeScreen from './src/pages/Home'; | ||
import MyPageScreen from './src/pages/MyPage'; | ||
|
||
type SectionProps = PropsWithChildren<{ | ||
title: string; | ||
}>; | ||
const Stack = createNativeStackNavigator(); | ||
|
||
function Section({children, title}: SectionProps): React.JSX.Element { | ||
const isDarkMode = useColorScheme() === 'dark'; | ||
function App(): React.JSX.Element { | ||
return ( | ||
<View style={styles.sectionContainer}> | ||
<Text | ||
style={[ | ||
styles.sectionTitle, | ||
{ | ||
color: isDarkMode ? Colors.white : Colors.black, | ||
}, | ||
]}> | ||
{title} | ||
</Text> | ||
<Text | ||
style={[ | ||
styles.sectionDescription, | ||
{ | ||
color: isDarkMode ? Colors.light : Colors.dark, | ||
}, | ||
]}> | ||
{children} | ||
</Text> | ||
</View> | ||
<NavigationContainer> | ||
<Stack.Navigator | ||
screenOptions={() => ({ | ||
headerShown: false, | ||
})}> | ||
<Stack.Screen name="Home" component={HomeTab} /> | ||
{/* <Stack.Screen name="Login" component={LoginScreen} /> */} | ||
</Stack.Navigator> | ||
</NavigationContainer> | ||
); | ||
} | ||
|
||
function App(): React.JSX.Element { | ||
const isDarkMode = useColorScheme() === 'dark'; | ||
|
||
const backgroundStyle = { | ||
backgroundColor: isDarkMode ? Colors.darker : Colors.lighter, | ||
}; | ||
export type TabProps = { | ||
홈: undefined; | ||
마이페이지: undefined; | ||
}; | ||
|
||
const Tab = createBottomTabNavigator<TabProps>(); | ||
const HomeTab = (): JSX.Element => { | ||
return ( | ||
<SafeAreaView style={backgroundStyle}> | ||
<StatusBar | ||
barStyle={isDarkMode ? 'light-content' : 'dark-content'} | ||
backgroundColor={backgroundStyle.backgroundColor} | ||
/> | ||
<ScrollView | ||
contentInsetAdjustmentBehavior="automatic" | ||
style={backgroundStyle}> | ||
<Header /> | ||
<View | ||
style={{ | ||
backgroundColor: isDarkMode ? Colors.black : Colors.white, | ||
}}> | ||
<Section title="Step One"> | ||
Edit <Text style={styles.highlight}>App.tsx</Text> to change this | ||
screen and then come back to see your edits. | ||
</Section> | ||
<Section title="See Your Changes"> | ||
<ReloadInstructions /> | ||
</Section> | ||
<Section title="Debug"> | ||
<DebugInstructions /> | ||
</Section> | ||
<Section title="Learn More"> | ||
Read the docs to discover what to do next: | ||
</Section> | ||
<LearnMoreLinks /> | ||
</View> | ||
</ScrollView> | ||
</SafeAreaView> | ||
<Tab.Navigator | ||
initialRouteName="홈" | ||
screenOptions={() => ({ | ||
headerShown: false, | ||
})}> | ||
<Tab.Screen name={'홈'} component={HomeScreen} /> | ||
<Tab.Screen name={'마이페이지'} component={MyPageScreen} /> | ||
</Tab.Navigator> | ||
); | ||
} | ||
|
||
const styles = StyleSheet.create({ | ||
sectionContainer: { | ||
marginTop: 32, | ||
paddingHorizontal: 24, | ||
}, | ||
sectionTitle: { | ||
fontSize: 24, | ||
fontWeight: '600', | ||
}, | ||
sectionDescription: { | ||
marginTop: 8, | ||
fontSize: 18, | ||
fontWeight: '400', | ||
}, | ||
highlight: { | ||
fontWeight: '700', | ||
}, | ||
}); | ||
}; | ||
|
||
export default App; |
Oops, something went wrong.