Challenge: Build an Interactive Resort List
Task
Create a React Native component named InteractiveResortList that displays a list of resorts. In this list, showcase the names of all resorts. Next, incorporate functionality where clicking on a specific resort triggers an alert containing additional information about it.
The component should include the following elements:
FlatList: Utilize theFlatListcomponent to render the list of resorts;TouchableOpacity: Wrap each resort withTouchableOpacityto make it touchable;Text: Inside eachTouchableOpacity, display the name of the resort using theTextcomponent;- Alert Functionality: Implement an
onPressevent forTouchableOpacityto trigger thehandleItemPressfunction. The alert should display the resort's description.
We should see the following result after implementing those changes.
Repository with initial files and folders.
Start the project
To start the project, copy the initial files and data using the following command in the terminal.
Navigate to the newly created folder housing the project files using the command:
Afterward, install the required packages with:
To initiate the app and preview its initial appearance, execute the following command in the terminal:
Hint
- Utilize
FlatListto render the list of resorts; - Wrap each resort with
TouchableOpacityto make it touchable; - Implement an
onPressevent forTouchableOpacityto trigger thehandleItemPressfunction, passing the resort's description.
If you face any challenges while implementing the task, we suggest referring to the provided recording, which offers a step-by-step guide on navigating each aspect. Best of luck!
In Practice
Kiitos palautteestasi!
Kysy tekoälyä
Kysy tekoälyä
Kysy mitä tahansa tai kokeile jotakin ehdotetuista kysymyksistä aloittaaksesi keskustelumme
Kysy minulta kysymyksiä tästä aiheesta
Tiivistä tämä luku
Näytä käytännön esimerkkejä
Awesome!
Completion rate improved to 3.45
Challenge: Build an Interactive Resort List
Pyyhkäise näyttääksesi valikon
Task
Create a React Native component named InteractiveResortList that displays a list of resorts. In this list, showcase the names of all resorts. Next, incorporate functionality where clicking on a specific resort triggers an alert containing additional information about it.
The component should include the following elements:
FlatList: Utilize theFlatListcomponent to render the list of resorts;TouchableOpacity: Wrap each resort withTouchableOpacityto make it touchable;Text: Inside eachTouchableOpacity, display the name of the resort using theTextcomponent;- Alert Functionality: Implement an
onPressevent forTouchableOpacityto trigger thehandleItemPressfunction. The alert should display the resort's description.
We should see the following result after implementing those changes.
Repository with initial files and folders.
Start the project
To start the project, copy the initial files and data using the following command in the terminal.
Navigate to the newly created folder housing the project files using the command:
Afterward, install the required packages with:
To initiate the app and preview its initial appearance, execute the following command in the terminal:
Hint
- Utilize
FlatListto render the list of resorts; - Wrap each resort with
TouchableOpacityto make it touchable; - Implement an
onPressevent forTouchableOpacityto trigger thehandleItemPressfunction, passing the resort's description.
If you face any challenges while implementing the task, we suggest referring to the provided recording, which offers a step-by-step guide on navigating each aspect. Best of luck!
In Practice
Kiitos palautteestasi!