Skip to content

Commit fc0e968

Browse files
committed
rename STARSHIPS_STACK
1 parent 5db3c75 commit fc0e968

File tree

1 file changed

+10
-4
lines changed
  • challenges/react-navigation

1 file changed

+10
-4
lines changed

challenges/react-navigation/03.md

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,23 @@
99

1010
- [ ] Add an authentication flow to your application.
1111

12-
The App function should return the `NavigationContainer` component, and the `isSignedIn` state variable should determine which navigator is rendered, either the RootNavigator or the AuthNavigator.
12+
The App function should return the `NavigationContainer` component, and the `user` state variable should determine which navigator is rendered, either the `StarshipsNavigator` or the `AuthNavigator`.
1313

1414
Example:
1515

1616
```javascript
1717
function App() {
18-
const [isSignedIn, setIsSignedIn] = useState(false);
18+
const [user, setUser] = useState(false);
1919

2020
return (
2121
<NavigationContainer>
22-
{isSignedIn ? <RootNavigator /> : <AuthNavigator />}
22+
<Stack.Navigator screenOptions={{ headerShown: false }}>
23+
{user ? (
24+
<Stack.Screen name={"STARSHIPS_STACK"} component={StarshipsNavigator} />
25+
) : (
26+
<Stack.Screen name={"AUTH_STACK"} component={AuthNavigator} />
27+
)}
28+
</Stack.Navigator>
2329
</NavigationContainer>
2430
);
2531
}
@@ -30,7 +36,7 @@ The button to sign in should be in the AuthScreen component, and the button to s
3036
It should look like this:
3137

3238
```javascript
33-
<Button title="Sign in" onPress={() => setIsSignedIn(!isSignedIn)} />
39+
<Button title="Sign in" onPress={() => setUser(!user)} />
3440
```
3541

3642
You can read the documentation [https://reactnavigation.org/docs/auth-flow](https://reactnavigation.org/docs/auth-flow).

0 commit comments

Comments
 (0)