Passing datas though Screens
📡 What you will learn
- Read
params
from theroute
props.
👾 Before we start the exercise
- Check the
route
prop documentation. - Do you remeber how to pass to the destination route?
👨🚀 Exercise 2
Navigating to another screens with params
Go to src/screens/StarshipFeedScreen.tsx
:
- The header title for this view should be
Starships
. - Update
Routes.ts
andNavigator.tsx
to add a new screen calledSTARSHIP_DETAIL_SCREEN
. - Implement
handlePress
function to send the user toSTARSHIP_DETAIL_SCREEN
, passing thestarship
data as parameters.
Create a details screen
- Go and create
src/screens/StarshipDetailsScreen.tsx
:

Each screen component in your app is provided with the route
prop automatically.
- Read the
params
of the screen and display thestarship
data.
You can use these component to make it pretty:
👽 Bonus
- Change the
screenOptions
to display your screen as amodal
. - Add a "close modal" Button with an icon.