0
0
React Nativemobile~5 mins

TouchableOpacity and TouchableHighlight in React Native - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
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?
ATouchableOpacity
BTouchableHighlight
CView
DScrollView
What prop do you use to change the highlight color in TouchableHighlight?
AunderlayColor
BpressColor
CactiveColor
DhighlightColor
Which component is better for subtle press feedback without changing background color?
ATouchableHighlight
BTouchableOpacity
CButton
DTextInput
Can TouchableHighlight wrap an Image component?
ANo
BOnly on iOS
COnly on Android
DYes
What happens if you press a TouchableHighlight without setting underlayColor?
AApp crashes
BNo visual feedback
CDefault highlight color is used
DOpacity changes
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.