|
1 | 1 | import {useIsFocused} from '@react-navigation/native'; |
2 | 2 | import type {ForwardedRef} from 'react'; |
3 | 3 | import React, {useCallback, useMemo, useState} from 'react'; |
4 | | -import type {GestureResponderEvent, LayoutChangeEvent, StyleProp, TextStyle, ViewStyle} from 'react-native'; |
| 4 | +import type {AccessibilityState, GestureResponderEvent, LayoutChangeEvent, StyleProp, TextStyle, ViewStyle} from 'react-native'; |
5 | 5 | import {StyleSheet, View} from 'react-native'; |
6 | 6 | import ActivityIndicator from '@components/ActivityIndicator'; |
7 | 7 | import Icon from '@components/Icon'; |
@@ -149,6 +149,9 @@ type ButtonProps = Partial<ChildrenProps> & |
149 | 149 | /** Accessibility label for the component */ |
150 | 150 | accessibilityLabel?: string; |
151 | 151 |
|
| 152 | + /** Accessibility state to pass to the pressable */ |
| 153 | + accessibilityState?: AccessibilityState; |
| 154 | + |
152 | 155 | /** The text for the button label */ |
153 | 156 | text?: string; |
154 | 157 |
|
@@ -291,6 +294,7 @@ function Button({ |
291 | 294 | secondLineText = '', |
292 | 295 | shouldBlendOpacity = false, |
293 | 296 | shouldStayNormalOnDisable = false, |
| 297 | + accessibilityState, |
294 | 298 | sentryLabel, |
295 | 299 | ref, |
296 | 300 | ...rest |
@@ -527,6 +531,7 @@ function Button({ |
527 | 531 | id={id} |
528 | 532 | testID={testID} |
529 | 533 | accessibilityLabel={accessibilityLabel} |
| 534 | + accessibilityState={accessibilityState} |
530 | 535 | role={getButtonRole(isNested)} |
531 | 536 | hoverDimmingValue={1} |
532 | 537 | onHoverIn={!isDisabled || !shouldStayNormalOnDisable ? () => setIsHovered(true) : undefined} |
|
0 commit comments