Thuta Learning
React Native
ExercisesMobile DevelopmentIntermediate

Practice: Component & Styling Challenges

React NativeLesson 3140 min

What you'll walk away with

  • Explain the React and native-platform behavior of Practice: Component & Styling Challenges
  • Test accessibility, failure, and lifecycle cases
  • Write maintainable, testable, and performant React Native

Explain it simply

Practice: Component & Styling Challenges, in plain language

This practice set isn't about new concepts — it's designed around four hands-on tasks to help you re-practice the core component/styling/flexbox knowledge from the Basics chapter.

Problem → Why → Solution

The problem — why this concept matters

Not realizing flexWrap: 'wrap' needs to go on the parent View in Task 2 (the grid), so the layout doesn't come out right

A common mistake

In Task 3, forgetting to include a default prop value (color = '#3b82f6') in the destructuring, then having to pass color manually every single time it's used

Core concept — understand how it works

Evaluate Practice: Component & Styling Challenges on release devices through startup, JS/UI frame rate, memory, networking, crash recovery, permissions, signing, and store requirements—not only a debug build. Recheck New Architecture and dependency compatibility on every upgrade.

Mental model
  1. requirement
  2. reason and implement
  3. test and explain

Explain the React and native-platform behavior of Practice: Component & Styling Challenges

Core syntax or pattern

javascript
// Task 3 starter — make this Button reusable via props
function CustomButton({ label, onPress, color = '#3b82f6' }) {
  return (
    <TouchableOpacity style={[styles.button, { backgroundColor: color }]} onPress={onPress}>
      <Text style={styles.buttonText}>{label}</Text>
    </TouchableOpacity>
  );
}
// Try: <CustomButton label="Save" color="#10b981" onPress={...} />

Evaluate Practice: Component & Styling Challenges on release devices through startup, JS/UI frame rate, memory, networking, crash recovery, permissions, signing, and store requirements—not only a debug build. Recheck New Architecture and dependency compatibility on every upgrade.

Read the code step by step

  1. requirement// Task 3 starter — make this Button reusable via props

    This practice set isn't about new concepts — it's designed around four hands-on tasks to help you re-practice the core component/styling/flexbox knowledge from the Basics chapter.

  2. reason and implement<Text style={styles.buttonText}>{label}</Text>

    Evaluate Practice: Component & Styling Challenges on release devices through startup, JS/UI frame rate, memory, networking, crash recovery, permissions, signing, and store requirements—not only a debug build. Recheck New Architecture and dependency compatibility on every upgrade.

  3. test and explain// Try: <CustomButton label="Save" color="#10b981" on...

    Test an original Practice: Component & Styling Challenges example on Android and iOS with small and large screens, font scaling, dark mode, keyboard and screen reader use, slow/offline networking, denied permissions, and background/foreground transitions. Use DevTools, tests, and a release build where relevant.

Execution flow
  1. requirement
  2. reason and implement
  3. test and explain

Success

Explain the React and native-platform behavior of Practice: Component & Styling Challenges

Failure

Not realizing flexWrap: 'wrap' needs to go on the parent View in Task 2 (the grid), so the layout doesn't come out right

Let's think about it this way for a moment

This practice set isn't about new concepts — it's designed around four hands-on tasks to help you re-practice the core component/styling/flexbox knowledge from the Basics chapter.

Let's connect it to a real scenario

Four tasks: (1) Build a profile card component (avatar image, name, bio, an icon row using flexDirection: row), (2) Build a 3-column grid layout (using flexWrap: 'wrap'), (3) Build a custom button component (props: label, onPress, color — make it reusable), (4) Build a card list (FlatList) with alternating row colors (using index % 2).

Code Example

javascript
// Task 3 starter — make this Button reusable via props
function CustomButton({ label, onPress, color = '#3b82f6' }) {
  return (
    <TouchableOpacity style={[styles.button, { backgroundColor: color }]} onPress={onPress}>
      <Text style={styles.buttonText}>{label}</Text>
    </TouchableOpacity>
  );
}
// Try: <CustomButton label="Save" color="#10b981" onPress={...} />
You should see
You'll finish with runnable code for the component/screen in all four tasks.

5-Minute Try-It

Work through the four tasks yourself, in order — try to think it through before peeking at the code sample.

A Quick Word of Caution

Don't move on to the next task before finishing the current one — getting each layout/component concept solid will make the Project chapter much easier.

Real-world usage

How to apply it in a real project

Test an original Practice: Component & Styling Challenges example on Android and iOS with small and large screens, font scaling, dark mode, keyboard and screen reader use, slow/offline networking, denied permissions, and background/foreground transitions. Use DevTools, tests, and a release build where relevant.

Mini challenge

Build it yourself

Test an original Practice: Component & Styling Challenges example on Android and iOS with small and large screens, font scaling, dark mode, keyboard and screen reader use, slow/offline networking, denied permissions, and background/foreground transitions. Use DevTools, tests, and a release build where relevant.

  • Rebuild the example without copying it
  • Test a normal input and an edge case
  • Predict the compiler or output result before running it
javascript
// Task 3 starter — make this Button reusable via props
function CustomButton({ label, onPress, color = '#3b82f6' }) {
  return (
    <TouchableOpacity style={[styles.button, { backgroundColor: color }]} onPress={onPress}>
      <Text style={styles.buttonText}>{label}</Text>
    </TouchableOpacity>
  );
}
// Try: <CustomButton label="Save" color="#10b981" onPress={...} />

Expected: Explain the React and native-platform behavior of Practice: Component & Styling Challenges

Show hint

Test an original Practice: Component & Styling Challenges example on Android and iOS with small and large screens, font scaling, dark mode, keyboard and screen reader use, slow/offline networking, denied permissions, and background/foreground transitions. Use DevTools, tests, and a release build where relevant.

Quick quiz 1 / 3

What best describes the core idea of Practice: Component & Styling Challenges?

Quick quiz 2 / 3

Which mistake should you avoid first?

Quick quiz 3 / 3

How should this be applied in a real project?

What to remember

  • requirement → reason and implement → test and explain
  • Evaluate Practice: Component & Styling Challenges on release devices through startup, JS/UI frame rate, memory, networking, crash recovery, permissions, signing, and store requirements—not only a debug build. Recheck New Architecture and dependency compatibility on every upgrade.
  • Not realizing flexWrap: 'wrap' needs to go on the parent View in Task 2 (the grid), so the layout doesn't come out right
  • Test an original Practice: Component & Styling Challenges example on Android and iOS with small and large screens, font scaling, dark mode, keyboard and screen reader use, slow/offline networking, denied permissions, and background/foreground transitions. Use DevTools, tests, and a release build where relevant.

React Native Documentation — React Native

Easy traps

  • Not realizing flexWrap: 'wrap' needs to go on the parent View in Task 2 (the grid), so the layout doesn't come out right
  • In Task 3, forgetting to include a default prop value (color = '#3b82f6') in the destructuring, then having to pass color manually every single time it's used
  • Assuming one simulator's happy path proves every real-device, release-build, permission, accessibility, offline, and lifecycle path.

Hands-on Exercise

Test an original Practice: Component & Styling Challenges example on Android and iOS with small and large screens, font scaling, dark mode, keyboard and screen reader use, slow/offline networking, denied permissions, and background/foreground transitions. Use DevTools, tests, and a release build where relevant.

You'll know it worked when: You'll finish with runnable code for the component/screen in all four tasks.

Updated on

Progress is saved only in this browser on this device. It isn't synced to other devices.

Report a problem with this lessonOpens your email app with this lesson's address filled in — nothing is sent until you send it.

Practice: Component & Styling Challenges | Thuta Learning