File tree Expand file tree Collapse file tree 4 files changed +6
-3
lines changed Expand file tree Collapse file tree 4 files changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -62,7 +62,7 @@ export class Accessibility extends NativeAccessibility {
62
62
}
63
63
64
64
// Some versions of RN don't support this interface.
65
- if ( RN . AccessibilityInfo ) {
65
+ if ( RN . AccessibilityInfo && RN . AccessibilityInfo . announceForAccessibility ) {
66
66
RN . AccessibilityInfo . announceForAccessibility ( announcement ) ;
67
67
}
68
68
}
Original file line number Diff line number Diff line change @@ -15,7 +15,9 @@ import { AccessibilityPlatformUtil } from '../common/AccessibilityUtil';
15
15
16
16
export class AccessibilityUtil extends AccessibilityPlatformUtil {
17
17
setAccessibilityFocus ( component : React . Component < any , any > ) : void {
18
- // NO-OP
18
+ if ( Accessibility . isScreenReaderEnabled ( ) && RN . AccessibilityInfo && RN . AccessibilityInfo . setAccessibilityFocus ) {
19
+ RN . AccessibilityInfo . setAccessibilityFocus ( RN . findNodeHandle ( component ) ) ;
20
+ }
19
21
}
20
22
}
21
23
Original file line number Diff line number Diff line change @@ -196,7 +196,7 @@ export class Button extends RX.Button<{}> {
196
196
}
197
197
198
198
focus ( ) {
199
- // native mobile platforms doesn't have the notion of focus for buttons, so ignore.
199
+ AccessibilityUtil . setAccessibilityFocus ( this ) ;
200
200
}
201
201
202
202
blur ( ) {
Original file line number Diff line number Diff line change @@ -703,6 +703,7 @@ declare module 'react-native' {
703
703
static addEventListener ( type : string , handler : ( event : any ) => void ) : void ;
704
704
static removeEventListener ( type : string , handler : ( event : any ) => void ) : void ;
705
705
static announceForAccessibility ( announcement : string ) : void ;
706
+ static setAccessibilityFocus ( reactTag : number ) : void ;
706
707
}
707
708
708
709
interface AlertButtonSpec {
You can’t perform that action at this time.
0 commit comments