Recall & Review
beginner
What is TouchableOpacity in React Native?
TouchableOpacity is a component that makes an area respond to touches by reducing its opacity, giving a fade effect when pressed.
Click to reveal answer
beginner
How does TouchableHighlight visually respond to a press?
TouchableHighlight darkens or highlights its child view by applying a color overlay when pressed, making it look like it is highlighted.
Click to reveal answer
intermediate
When should you use TouchableOpacity instead of TouchableHighlight?
Use TouchableOpacity when you want a fade effect on press without changing the background color. It is good for buttons or icons that need subtle feedback.
Click to reveal answer
beginner
What prop controls the color shown when a TouchableHighlight is pressed?
The
underlayColor prop sets the color overlay shown when the TouchableHighlight is pressed.Click to reveal answer
beginner
Can TouchableOpacity and TouchableHighlight wrap any component?
Yes, both can wrap any React Native component to make it respond to touches with visual feedback.
Click to reveal answer
Which component fades the wrapped content when pressed?
✗ Incorrect
TouchableOpacity reduces the opacity of its child components to create a fade effect on press.
What prop do you use to change the highlight color in TouchableHighlight?
✗ Incorrect
The underlayColor prop sets the color shown when TouchableHighlight is pressed.
Which component is better for subtle press feedback without changing background color?
✗ Incorrect
TouchableOpacity provides a fade effect which is subtle and does not change background color.
Can TouchableHighlight wrap an Image component?
✗ Incorrect
TouchableHighlight can wrap any component, including Image, to provide touch feedback.
What happens if you press a TouchableHighlight without setting underlayColor?
✗ Incorrect
TouchableHighlight uses a default underlay color if none is specified.
Explain the difference between TouchableOpacity and TouchableHighlight and when to use each.
Think about how the visual feedback looks when you press each component.
You got /4 concepts.
Describe how to customize the press feedback color in TouchableHighlight.
Look for a prop that controls the highlight color.
You got /3 concepts.