Skip to content

Commit

Permalink
비동기 처리
Browse files Browse the repository at this point in the history
  • Loading branch information
onting committed Aug 11, 2020
1 parent 76b9266 commit 88fccba
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
14 changes: 8 additions & 6 deletions App.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,12 @@ const MainView = () => {
<Tab.Navigator
screenOptions={({ route }) => ({
tabBarIcon: ({ color, size }) => {
return {Feed: <Entypo name='news' size={size} color={color} />,
Org: <Octicons name='organization' size={size} color={color} />,
Notice: <Entypo name='notification' size={size} color={color} />,
Profile: <AntDesign name='profile' size={size} color={color} />}[route.name];
return {
Feed: <Entypo name='news' size={size} color={color} />,
Org: <Octicons name='organization' size={size} color={color} />,
Notice: <Entypo name='notification' size={size} color={color} />,
Profile: <AntDesign name='profile' size={size} color={color} />,
}[route.name];
},
})}
tabBarOptions={{
Expand All @@ -41,8 +43,8 @@ const Stack = createStackNavigator();

export default function App() {
const [logined, setLogin] = React.useState(false);
const loginCheck = () => {
AsyncStorage.getItem('username')
const loginCheck = async () => {
await AsyncStorage.getItem('username')
.then((username) => {
setLogin(Boolean(username));
});
Expand Down
4 changes: 2 additions & 2 deletions compo/loginview.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ export default function LoginView({navigation}) {
);
}
else{
await AsyncStorage.setItem('username', username);
await SecureStore.setItemAsync("session", res.headers.get("Set-Cookie"))
AsyncStorage.setItem('username', username);
await SecureStore.setItemAsync("session", res.headers.get("Set-Cookie"));
navigation.reset({
index: 0,
routes: [{name: 'Main'}],
Expand Down

0 comments on commit 88fccba

Please sign in to comment.