Challenge - 5 Problems
Swipe Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
❓ ui_behavior
intermediate1:30remaining
Swipeable list item behavior
What happens when you swipe a list item to the left using a typical swipeable list component in React Native?
Attempts:
2 left
💡 Hint
Think about common email apps where you swipe left on a message.
✗ Incorrect
Swiping left on a list item usually reveals hidden buttons such as Delete or Archive, allowing the user to take quick actions.
❓ lifecycle
intermediate1:30remaining
State update after swipe action
After a user swipes a list item and taps the Delete button, what is the best way to update the list in React Native?
Attempts:
2 left
💡 Hint
React Native UI updates when state changes.
✗ Incorrect
To update the UI after deleting an item, you must update the state holding the list data. Direct mutation without state update won't re-render the list.
📝 Syntax
advanced2:00remaining
Correct usage of Swipeable component
Which code snippet correctly implements a swipeable list item using the 'react-native-gesture-handler' Swipeable component?
React Native
import React from 'react'; import { View, Text, Button } from 'react-native'; import { Swipeable } from 'react-native-gesture-handler'; function ListItem({ item, onDelete }) { const renderRightActions = () => ( <Button title="Delete" onPress={() => onDelete(item.id)} /> ); return ( <Swipeable renderRightActions={renderRightActions}> <View><Text>{item.text}</Text></View> </Swipeable> ); }
Attempts:
2 left
💡 Hint
Check the official docs for Swipeable usage.
✗ Incorrect
The Swipeable component wraps the list item and uses renderRightActions to display buttons when swiped left.
🔧 Debug
advanced2:00remaining
Swipeable item not responding to gestures
You implemented Swipeable list items, but swiping does nothing. What is the most likely cause?
Attempts:
2 left
💡 Hint
Gesture handler library requires a special root wrapper.
✗ Incorrect
GestureHandlerRootView is required at the root of your app to enable gesture handling for Swipeable components.
🧠 Conceptual
expert2:30remaining
Managing multiple swipeable items open
In a list with many swipeable items, what is the best approach to ensure only one item is open (swiped) at a time?
Attempts:
2 left
💡 Hint
Think about how to control one open item at a time.
✗ Incorrect
Keeping a ref to the open Swipeable and closing it before opening another ensures only one item is open, improving UX and preventing overlap.