Skip to content

accessibilityLabel for Picker not read by VoiceOver #310

@mitchdowney

Description

@mitchdowney

@react-native-picker/picker 1.16.5
iOS 14

I can't get the accessibilityLabel to be read by VoiceOver on an iOS device with a simple Picker example. Instead it is reading the currently selected PickerItem for the focused Picker. Am I doing something wrong? Or does the accessibilityLabel prop on the Picker not get read by VoiceOver?

In the example below I would like the word "hours" read before

In the render:

<Picker
  accessibilityLabel={translate('hours')}
  enabled={!isActive}
  onValueChange={(itemValue) => {
    handleUpdateSleepTimer(itemValue, currentMinute, currentSecond)
  }}
  selectedValue={currentHour}>
  {hourItems}
</Picker>

How the hourItems is defined:

const generatePickerNumberItems = (total: number, key: string) => {
  const arr = [] as any
  for (let i = 0; i < total; i++) {
    arr.push(<Picker.Item key={i + key} label={i.toString()} value={i} />)
  }

  return arr
}

const hourItems = generatePickerNumberItems(24, 'hourItems')

It also seems that I cannot change the accessibilityLabel or accessibilityHint for the PickerItems, so I have no way of announcing to the user this Picker value represents the selected number of hours.

IMG_5013

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions