Skip to main content

Beginner-Friendly Topic

Take your time - it's perfectly normal to re-read this topic 2-3 times. Try the interactive code editor below to run code yourself. Use the Q&A section to check your understanding before moving on.You've got this!

Lesson 5 of 10

Core Components - View, Text, Image, ScrollView, Pressable

These five components are the vocabulary of every React Native UI. Master their production props - not just the basics, but the props that matter in real apps: accessibility, performance, and cross-platform behavior.

25 minBy Priygop Editorial TeamUpdated 2026Peer Reviewed & Verified

View - The Container

View - The Container
import { View, Text, Image, ScrollView, Pressable, StyleSheet } from 'react-native';

// View maps to UIView (iOS) and android.view.View (Android)
// Handles layout, styling, touch, and accessibility

// Production props worth knowing:
<View
  style={styles.card}
  accessible={true}                // group children as one accessibility element
  accessibilityLabel="User card"   // VoiceOver / TalkBack reads this
  accessibilityRole="button"       // SR announces it as interactive
  testID="user-card"               // for Detox E2E tests
/>

Text - All Strings Live Here

Text - All Strings Live Here
// numberOfLines + ellipsizeMode - truncate long text
<Text numberOfLines={2} ellipsizeMode="tail">
  This is a very long bio that might overflow the card layout on small phones...
</Text>

// selectable - copy-paste support (disabled by default)
<Text selectable>{userEmail}</Text>

// Nested Text - inline styling (like <span> inside <p>)
<Text style={styles.body}>
  Posted by{' '}
  <Text style={styles.username} onPress={goToProfile}>
    @johndoe
  </Text>
  {' '}3 hours ago
</Text>

Image - Local and Network

Image - Local and Network
// Network image - MUST specify width and height (no auto-sizing from URL)
<Image
  source={{ uri: 'https://api.example.com/avatar/123.jpg' }}
  style={{ width: 60, height: 60, borderRadius: 30 }}
  resizeMode="cover"     // cover | contain | stretch | repeat | center
  onLoadStart={() => setLoading(true)}
  onLoadEnd={() => setLoading(false)}
  onError={() => setFallback(true)}
  defaultSource={require('../assets/avatar-placeholder.png')} // iOS only
/>

// Local image - bundled with app (no size required, inferred)
<Image source={require('../assets/logo.png')} style={styles.logo} />

// Production tip: use expo-image for better caching, AVIF/WebP support,
// and thumbhash blurHash placeholders
import { Image as ExpoImage } from 'expo-image';
<ExpoImage
  source={{ uri: avatarUrl }}
  placeholder={{ thumbhash: user.thumbhash }}
  style={styles.avatar}
  transition={200}
/>

Pressable vs TouchableOpacity

Pressable vs TouchableOpacity
// Pressable (recommended for new code) - more flexible
<Pressable
  onPress={handlePress}
  onLongPress={handleLongPress}
  delayLongPress={500}
  hitSlop={{ top: 10, bottom: 10, left: 10, right: 10 }} // larger tap target
  style={({ pressed }) => [
    styles.button,
    pressed && styles.buttonPressed,   // no need for Animated
  ]}
  android_ripple={{ color: '#00000020', borderless: false }}
  accessibilityRole="button"
  accessibilityLabel="Submit form"
>
  <Text style={styles.label}>Submit</Text>
</Pressable>

// TouchableOpacity - simpler, automatically animates opacity
<TouchableOpacity onPress={handlePress} activeOpacity={0.7}>
  <Text>Tap me</Text>
</TouchableOpacity>

Common Mistakes

  • Not setting `width` and `height` on network images - Image has no intrinsic dimensions from a URL; without explicit size it renders at 0×0
  • Wrapping `FlatList` in `ScrollView` - causes the entire list to render at once (virtualization is destroyed). Use `FlatList.ListHeaderComponent` instead
  • Using `TouchableOpacity` for Android button feedback - Pressable's `android_ripple` gives the native Material Design ripple effect that users expect
  • Forgetting `hitSlop` on small touch targets - all touch targets should be at least 44×44 points per Apple HIG and 48×48dp per Material Design

Tip

Tip

Practice Core Components View Text Image ScrollView Pressable in small, isolated examples before integrating into larger projects. Breaking concepts into small experiments builds genuine understanding faster than reading alone.

Diagram
Loading diagram…

The core fundamental building blocks of native mobile UI

Practice Task

Note

Practice Task - (1) Write a working example of Core Components View Text Image ScrollView Pressable from scratch without looking at notes. (2) Modify it to handle an edge case (empty input, null value, or error state). (3) Share your solution in the Priygop community for feedback.

Quick Quiz

Common Mistake

Warning

A common mistake with Core Components View Text Image ScrollView Pressable is skipping edge case testing - empty inputs, null values, and unexpected data types. Always validate boundary conditions to write robust, production-ready react native code.

Key Takeaways

  • These five components are the vocabulary of every React Native UI.
  • Not setting `width` and `height` on network images - Image has no intrinsic dimensions from a URL; without explicit size it renders at 0×0
  • Wrapping `FlatList` in `ScrollView` - causes the entire list to render at once (virtualization is destroyed). Use `FlatList.ListHeaderComponent` instead
  • Using `TouchableOpacity` for Android button feedback - Pressable's `android_ripple` gives the native Material Design ripple effect that users expect

Topics in This Module

0/10 done