51일 차 회고
- 오타 에러!
useFocusEffect(
useCallback(() => {
if (!authService.currentUser) {
reset({
index: 1,
routes: [
{
name: 'Tabs',
params: {
screen: 'Slide',
},
},
{
name: 'Stack',
params: {
screen: 'Login',
},
},
],
});
return;
}
setOptions({
headerRight: () => {
return (
<TouchableOpacity style={{ marginRight: 10 }} onPress={logout}>
<Text>로그아웃</Text>
</TouchableOpacity>
);
},
});
const q = query(
collection(dbService, 'profile'),
orderBy('createdAt', 'desc'),
where('userId', '==', authService.currentUser?.uid)
);
onSnapshot(q, (snapshot) => {
const newProfiles = snapshot.docs.map((doc) => {
const newProfile = {
id: doc.id,
...doc.data(),
};
return newProfile;
});
setProfile(newProfiles);
});
}, [])
);
const profileFirst = profile[0];
const Root = () => {
return (
<Stack.Navigator
screenOptions={{
headerShown: false,
}}
>
<Stack.Screen name="Tabs" component={Tabs} />
<Stack.Screen name="Stacks" component={Stacks} />
</Stack.Navigator>
);
};
export default Root;
뭐든 오타로 고생하지말자..