0
0
React Nativemobile~5 mins

Button and Pressable in React Native - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What is the main difference between Button and Pressable in React Native?

Button is a simple component for clickable buttons with limited styling options. Pressable is more flexible and lets you customize styles and behavior for different press states.

Click to reveal answer
beginner
How do you handle a tap event on a Pressable component?

You use the onPress prop and assign it a function to run when the user taps the component.

Click to reveal answer
intermediate
Which component provides built-in accessibility support for buttons in React Native?

Button provides built-in accessibility features like role and focus management automatically.

Click to reveal answer
intermediate
How can you change the style of a Pressable when it is pressed?

You can pass a function to the style prop that receives a parameter indicating if the component is pressed, then return different styles accordingly.

Click to reveal answer
intermediate
Why might you choose Pressable over Button in a React Native app?

Because Pressable allows full control over the button's appearance and behavior, letting you create custom interactive elements beyond the default button look.

Click to reveal answer
Which prop do you use to handle tap events on a Button or Pressable?
AonTouch
BonClick
ConPress
DonTap
What does the Pressable component provide that Button does not?
ACustomizable press states and styles
BAutomatic navigation
CBuilt-in text label
DDefault background color
Which component is simpler to use for a basic clickable button with default styling?
APressable
BButton
CTouchableOpacity
DView
How do you change the style of a Pressable when it is pressed?
AYou cannot change styles on press
BUse the <code>pressed</code> prop
CUse <code>onPressIn</code> to change styles
DPass a function to the <code>style</code> prop that receives a pressed state
Which component automatically handles accessibility roles for buttons?
AButton
BPressable
CView
DText
Explain how you would create a custom button using Pressable in React Native.
Think about how to detect press state and change styles dynamically.
You got /4 concepts.
    Describe the advantages and disadvantages of using Button versus Pressable.
    Consider ease of use versus customization.
    You got /4 concepts.