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 10 of 10
Practice & Quiz - React Native Foundations
Test your understanding of the New Architecture, Expo vs CLI, core components, StyleSheet, and Flexbox with a practical profile card exercise and 5 quiz questions.
Practical Exercise - Responsive Profile Card
import React from 'react';
import {
View, Text, Image, StyleSheet, Pressable,
useWindowDimensions, Platform,
} from 'react-native';
interface ProfileCardProps {
name: string;
role: string;
avatarUri: string;
onFollow: () => void;
}
export function ProfileCard({ name, role, avatarUri, onFollow }: ProfileCardProps) {
const { width } = useWindowDimensions();
const isTablet = width >= 768;
return (
<View style={[styles.card, isTablet && styles.cardTablet]}>
<Image
source={{ uri: avatarUri }}
style={styles.avatar}
accessibilityLabel={`${name}'s avatar`}
/>
<View style={styles.info}>
<Text style={styles.name}>{name}</Text>
<Text style={styles.role}>{role}</Text>
<Text style={styles.platform}>
Running on: {Platform.OS === 'ios' ? '🍎 iOS' : '🤖 Android'}
</Text>
</View>
<Pressable
style={({ pressed }) => [styles.btn, pressed && styles.btnPressed]}
onPress={onFollow}
accessibilityRole="button"
accessibilityLabel={`Follow ${name}`}
>
<Text style={styles.btnText}>Follow</Text>
</Pressable>
</View>
);
}
// StyleSheet.create - validates at startup, flattens objects, ~15% faster than inline
const styles = StyleSheet.create({
card: {
flexDirection: 'row', // main axis = horizontal
alignItems: 'center', // cross axis = center
gap: 12,
padding: 16,
backgroundColor: '#fff',
borderRadius: 12,
// iOS shadow
shadowColor: '#000',
shadowOffset: { width: 0, height: 2 },
shadowOpacity: 0.1,
shadowRadius: 4,
// Android shadow
elevation: 3,
margin: 16,
},
cardTablet: { padding: 24, gap: 20 },
avatar: { width: 56, height: 56, borderRadius: 28 },
info: { flex: 1 }, // flex: 1 fills remaining space
name: { fontSize: 16, fontWeight: '600', color: '#1a1a1a' },
role: { fontSize: 13, color: '#666', marginTop: 2 },
platform: { fontSize: 11, color: '#999', marginTop: 4 },
btn: { paddingHorizontal: 16, paddingVertical: 8, backgroundColor: '#229c6b', borderRadius: 20 },
btnPressed: { opacity: 0.75 },
btnText: { color: '#fff', fontWeight: '600', fontSize: 13 },
});Module Quiz
What problem does React Native's New Architecture (JSI + Fabric) solve over the Old Bridge?
Tip
Tip
Practice Practice Quiz React Native Foundations in small, isolated examples before integrating into larger projects. Breaking concepts into small experiments builds genuine understanding faster than reading alone.
Module 1 Knowledge Check: Architecture, core components, and mobile styling
Practice Task
Note
Practice Task - (1) Write a working example of Practice Quiz React Native Foundations 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.
Common Mistake
Warning
A common mistake with Practice Quiz React Native Foundations 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.
Finished this lesson?