Skip to the workspace
Pebellslearn by building
Styling  ›  Capstone Project

Accessibility

Accessibility 12 minAccessible React Native screens give every touchable a role, a label that describes its action, and its current state, with large enough touch targets and readable contrast.

react native / Accessibility

Explore each scene at your own pace.

01 · The rule

The rule

Accessibility

Some Sprout users will never see the screen. They hear it through VoiceOver on iPhone or TalkBack on Android, and they move by swiping from one element to the next. A green leaf icon with no label is announced as "button" and nothing else. A few props fix that.

The rule

Every touchable says what it is, what it does, and its state.

React Native passes these props to the platform's screen reader:

<Pressable
  onPress={markWatered}
  accessibilityRole="button"
  accessibilityLabel="Mark fern as watered"
  accessibilityHint="Resets the watering countdown"
  hitSlop={12}
>
  <Image source={require('./assets/drop.png')} style={{ width: 24, height: 24 }} />
</Pressable>

<Switch
  value={remind}
  onValueChange={setRemind}
  accessibilityLabel="Watering reminders"
/>
  • What it is: accessibilityRole. Values such as 'button', 'header', 'link', 'image', 'switch'. The screen reader announces it, and users know how to interact. (Newer code may use the shorter role prop.)
  • What it does: accessibilityLabel. The words read aloud. Essential for icons and images. Write the action, not the picture: "Mark fern as watered", not "water drop icon".
  • Extra help: accessibilityHint. A short explanation of the result, read after the label.
  • Its state: accessibilityState. For example { disabled: true }, { checked: true } or { selected: true }. Built-in components like Switch report their own state.
  • Grouping: accessible. Setting accessible={true} on a View makes its children read as one element, so a whole plant card can be announced in one go.

Two more habits matter. Make touch targets big enough: about 44 × 44 points on iOS and 48 × 48 on Android. hitSlop helps small icons. And keep enough colour contrast between text and background, since pale green on white is hard to read for many users.

Scene 1 of 5
Hover to wake the cannons. Drag to move, or use arrow keys when focused. Press Enter to fire a shot.