Module 2: Core Components & Styling

Master React Native core components and styling techniques for beautiful mobile interfaces.

Back to Course|4 hours|Beginner

Core Components & Styling

Master React Native core components and styling techniques for beautiful mobile interfaces.

Progress: 0/4 topics completed0%

Select Topics Overview

View, Text, Image Components

Deep dive into the core React Native components: View, Text, and Image, understanding their properties and use cases

Content by: Ronak Macwan

React Native Developer

Connect

View Component Deep Dive

The View component is the most fundamental building block in React Native. It's a container that supports layout with flexbox, styling, touch handling, and accessibility controls. It maps to UIView on iOS and View on Android.

Text Component Properties

  • numberOfLines - Limit the number of lines
  • ellipsizeMode - How to truncate text
  • selectable - Whether text can be selected
  • onPress - Handle text press events
  • style - Text styling properties

Image Component Features

  • source - Image source (local, network, or base64)
  • resizeMode - How to resize the image
  • onLoad - Callback when image loads
  • onError - Callback when image fails to load
  • blurRadius - Apply blur effect to image

Component Nesting Example

Code Example
import React from 'react';
import { View, Text, Image, StyleSheet } from 'react-native';

const CardComponent = () => {
  return (
    <View style={styles.card}>
      <Image 
        source={{ uri: 'https://example.com/avatar.jpg' }}
        style={styles.avatar}
        resizeMode="cover"
      />
      <View style={styles.content}>
        <Text style={styles.title}>John Doe</Text>
        <Text style={styles.subtitle} numberOfLines={2}>
          Software Developer with 5 years of experience
        </Text>
      </View>
    </View>
  );
};

const styles = StyleSheet.create({
  card: {
    flexDirection: 'row',
    padding: 16,
    backgroundColor: '#fff',
    borderRadius: 8,
    margin: 8,
    shadowColor: '#000',
    shadowOffset: { width: 0, height: 2 },
    shadowOpacity: 0.1,
    shadowRadius: 4,
    elevation: 3,
  },
  avatar: {
    width: 60,
    height: 60,
    borderRadius: 30,
  },
  content: {
    flex: 1,
    marginLeft: 12,
  },
  title: {
    fontSize: 18,
    fontWeight: 'bold',
    color: '#333',
  },
  subtitle: {
    fontSize: 14,
    color: '#666',
    marginTop: 4,
  },
});

export default CardComponent;
Swipe to see more code

🎯 Practice Exercise

Test your understanding of this topic:

Ready for the Next Module?

Continue your learning journey and master the next set of concepts.

Continue to Module 3