Using Button and Pressable components in React Native has minimal impact on frame rate and memory when used properly. Both are lightweight UI elements designed for touch interaction. However, excessive nesting or complex logic inside their event handlers can cause frame drops below the smooth 60fps target. Battery usage is low unless the button triggers heavy background tasks.
Optimization Tips
Keep event handlers simple and fast to avoid blocking the UI thread.
Use Pressable for custom touch feedback and avoid unnecessary re-renders by memoizing handlers.
Limit the number of buttons on screen to reduce layout complexity.
Use native driver animations for touch feedback to maintain smooth 60fps.
App Size and Startup Time
Both Button and Pressable are part of React Native core and add negligible size to the app bundle. They do not significantly affect startup time. Customizing Pressable with many styles or animations may slightly increase bundle size but remains small compared to images or libraries.
iOS vs Android Differences
Button renders differently: iOS uses a native UIButton style, Android uses Material Design button style.
Pressable provides consistent touch handling on both platforms but touch feedback appearance may differ.
iOS requires accessibility labels for VoiceOver; Android uses accessibilityLabel or accessibilityHint for TalkBack.
Ripple effect on Android can be enabled with android_ripple prop on Pressable, not available on iOS.
Store Review Guidelines
Ensure buttons are large enough for easy tapping (Apple HIG recommends minimum 44x44 points).
Provide accessibility labels for all interactive elements to pass accessibility audits.
Do not use buttons to trigger unexpected or disruptive behaviors (Apple App Store guideline 4.2).
Follow platform UI conventions to avoid rejection for confusing UI.
Self-Check
Your app takes 5 seconds to load this screen with buttons. What's likely wrong?
Heavy logic or network calls inside button event handlers blocking the UI thread.
Too many nested buttons causing complex layout calculations.
Unoptimized animations or re-renders triggered by button state changes.
Key Result
Using Button and Pressable in React Native is efficient and lightweight. Optimize event handlers and touch feedback for smooth 60fps UI. Follow platform accessibility and size guidelines to pass app store reviews.
Practice
(1/5)
1. Which React Native component is best for a simple clickable button with default styling?
easy
A. Button
B. Pressable
C. View
D. TextInput
Solution
Step 1: Understand the purpose of Button
Button is designed for simple clickable buttons with default styles provided by React Native.
Step 2: Compare with other components
Pressable is for custom touchable areas, View is a container, and TextInput is for text input, so they are not suitable for simple buttons.
Final Answer:
Button -> Option A
Quick Check:
Simple clickable button = Button [OK]
Hint: Simple buttons use Button, custom ones use Pressable [OK]
Common Mistakes:
Choosing Pressable for simple buttons
Confusing View with clickable components
Using TextInput for buttons
2. Which of the following is the correct way to import Pressable in a React Native file?
easy
A. import { Pressable } from 'react-native';
B. import Pressable from 'react-native';
C. import { Pressable } from 'react-native-pressable';
D. import Pressable from 'react-native-pressable';
Solution
Step 1: Recall React Native import syntax
React Native exports components like Pressable as named exports, so we use curly braces in import.
Step 2: Verify package name
The correct package is react-native, not react-native-pressable.
Final Answer:
import { Pressable } from 'react-native'; -> Option A
Quick Check:
Named import from 'react-native' = import { Pressable } from 'react-native'; [OK]
Hint: Use curly braces for named imports from 'react-native' [OK]
Common Mistakes:
Using default import instead of named import
Importing from wrong package
Omitting curly braces
3. What will happen when you press this React Native code snippet?
import React from 'react';
import { Pressable, Text, Alert } from 'react-native';
export default function App() {
return (
Alert.alert('Pressed!')}>
Click me
);
}
medium
A. The text changes color automatically on press.
B. Nothing happens when pressing the text.
C. The app crashes due to missing Button component.
D. An alert with message 'Pressed!' appears when pressing the text.
Solution
Step 1: Understand Pressable behavior
Pressable wraps the Text and triggers onPress callback when pressed.
Step 2: Check the onPress action
The onPress calls Alert.alert('Pressed!'), so an alert box will appear on press.
Final Answer:
An alert with message 'Pressed!' appears when pressing the text. -> Option D
Quick Check:
Pressable triggers alert on press = An alert with message 'Pressed!' appears when pressing the text. [OK]
Hint: Pressable triggers onPress alert if defined [OK]
Common Mistakes:
Thinking nothing happens on press
Expecting automatic color change without style
Confusing Button with Pressable behavior
4. Identify the error in this React Native code using Pressable:
import React from 'react';
import { Pressable, Text } from 'react-native';
export default function App() {
return (
console.log('Pressed')}>Click me
);
}
medium
A. The onPress callback is missing parentheses.
B. You cannot put text directly inside Pressable without a Text component.
C. The import statement is incorrect.
D. The function component must return a single View.
Solution
Step 1: Check children of Pressable
In React Native, text must be wrapped inside a Text component; raw strings are not allowed as direct children.
Step 2: Verify other parts
onPress is correctly defined, imports are correct, and returning a single component is valid.
Final Answer:
Text must be wrapped in a Text component inside Pressable. -> Option B
Quick Check:
Text inside Pressable needs Text wrapper [OK]
Hint: Always wrap text in Text inside Pressable [OK]
Common Mistakes:
Placing raw text directly inside Pressable
Missing parentheses in onPress (not true here)
Incorrect imports
5. You want a button that changes its background color to gray while pressed and shows the text "Tap me". Which code snippet correctly uses Pressable to achieve this?
hard
A.
import { Pressable, Text } from 'react-native';
alert('Tapped')}>
Tap me