Skip to content

Commit

Permalink
sdp-tech#7 feat: add tab navigation structure (sdp-tech#9)
Browse files Browse the repository at this point in the history
  • Loading branch information
SJ-Kwak authored Jan 10, 2024
1 parent 4e0f0c5 commit 226b97b
Show file tree
Hide file tree
Showing 10 changed files with 2,363 additions and 471 deletions.
8 changes: 7 additions & 1 deletion .eslintrc.js
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'
],
};
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ ios/.xcode.env.local
Info.plist
ios/upcy.xcodeproj/project.xcworkspace/
ios/upcy.xcodeproj/xcuserdata
Podfile.lock

# Android/IntelliJ
#
Expand Down
136 changes: 31 additions & 105 deletions App.tsx
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;
Loading

0 comments on commit 226b97b

Please sign in to comment.