iOS Polish — Dark Mode, Dynamic Type & Accessibility
Lesson opener
In one line: Dark mode with useColorScheme.
Why it matters: This shows up at work when you need to dark mode with useColorScheme.
Before this lesson: The game (iOS polish)
Before you start
| Resource | Link |
|---|---|
| Previous | The game (iOS polish) |
| Next | App Store publish |
| Time | ~40 minutes |
What you will learn
- Dark mode with
useColorScheme - Dynamic Type — respect user font size
- Accessibility labels for VoiceOver
Section 1 — Dark mode (automatic)
import { useColorScheme, Text, View, StyleSheet } from 'react-native';
export default function ThemedHome() {
const scheme = useColorScheme();
const dark = scheme === 'dark';
return (
<View style={[styles.root, dark && styles.rootDark]}>
<Text style={[styles.title, dark && styles.titleDark]}>
Number Guessing Game
</Text>
</View>
);
}
const styles = StyleSheet.create({
root: { flex: 1, backgroundColor: '#F2F2F7' },
rootDark: { backgroundColor: '#000000' },
title: { color: '#000', fontSize: 22, fontWeight: 'bold' },
titleDark: { color: '#fff' },
});Test: iOS Simulator → Features → Toggle Appearance.
Section 2 — Dynamic Type
Allow text to scale with system settings:
<Text style={styles.title} maxFontSizeMultiplier={1.3}>
Number Guessing Game
</Text>Avoid fixed-height boxes that clip enlarged text.
Section 3 — Accessibility labels
<Button
title="Start game"
accessibilityLabel="Start new guessing game"
accessibilityHint="Opens the game screen"
onPress={() => navigation.navigate('Game')}
/>
<TextInput
accessibilityLabel="Your guess"
accessibilityHint="Enter a number from 1 to 100"
// ...other props
/>Why: VoiceOver users hear meaningful names — App Store accessibility reviews notice missing labels.
Section 4 — Gap audit — iOS track
| Critical gap | Lesson |
|---|---|
| Safe areas | ios2 |
| Privacy policy | ios6 |
| Lifecycle / persist score | ios4 + android4 |
| Keyboard | android5 KeyboardAvoidingView |
| Back gesture | ios2 + React Navigation |
Checklist
- [ ] Dark mode tested
- [ ] accessibilityLabel on primary buttons and input
- [ ] Game playable with larger text size
Teacher walkthrough: accessibility as ship criteria
All figures illustrative.
Step 1 — Labels. Every interactive control has an accessibility label a VoiceOver user can understand.
Step 2 — Contrast and dynamic type. Text remains readable; layout does not clip at larger sizes.
Step 3 — Motion. Respect reduce-motion where you added non-essential animation.
Step 4 — Manual pass. VoiceOver swipe through primary flow once on simulator/device.
Failure example: icon-only buttons unusable
Symptom: VoiceOver says only "button"; users cannot identify controls.
Diagnosis: No accessibilityLabel; contrast failed on brand colour.
Correction: Labels + roles; fix contrast; retest VoiceOver path.
Validation: Primary flow completable with VoiceOver only (lab standard).
Guided practice
An icon button toggles sound. What accessibility label should it expose when sound is off?
Complete solution: State-aware label such as "Unmute sound"; button trait; announce state change if possible.
Independent practice
Acceptance criteria:
- Labels on all primary controls in one screen.
- Contrast check noted (tool or manual).
- VoiceOver (or documented) pass on happy path.
- One motion or type-size issue fixed or waived with reason.
Common mistakes
- Treating accessibility as post-reject cleanup.
- Color-only status indicators.
- Blocking zoom / ignoring Dynamic Type.
What's next
App Store publish — $99/year and stricter review.