mirror of
https://github.com/zhigang1992/react-navigation.git
synced 2026-04-28 20:35:19 +08:00
fix: add accessibilityState property (#8548)
React Native 0.62 removes the deprecated `accessibilityStates` property and replaces it with an `accessibilityState` object instead. This PR adds the new property where needed, but leaves the old one in place for backwards compatibility. Without the change, the selected tab in BottomTabNavigator isn't announced properly in VoiceOver.
This commit is contained in:
@@ -258,6 +258,7 @@ export default function BottomTabBarItem({
|
||||
testID,
|
||||
accessibilityLabel,
|
||||
accessibilityRole: 'button',
|
||||
accessibilityState: { selected: focused },
|
||||
accessibilityStates: focused ? ['selected'] : [],
|
||||
style: [
|
||||
styles.tab,
|
||||
|
||||
@@ -156,6 +156,7 @@ export default function DrawerItem(props: Props) {
|
||||
accessibilityTraits={focused ? ['button', 'selected'] : 'button'}
|
||||
accessibilityComponentType="button"
|
||||
accessibilityRole="button"
|
||||
accessibilityState={{ selected: focused }}
|
||||
accessibilityStates={focused ? ['selected'] : []}
|
||||
to={to}
|
||||
>
|
||||
|
||||
Reference in New Issue
Block a user