Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/ios/Accessibility.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ export class Accessibility extends NativeAccessibility {
}

// Some versions of RN don't support this interface.
if (RN.AccessibilityInfo) {
if (RN.AccessibilityInfo && RN.AccessibilityInfo.announceForAccessibility) {
RN.AccessibilityInfo.announceForAccessibility(announcement);
}
}
Expand Down
4 changes: 3 additions & 1 deletion src/ios/AccessibilityUtil.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@ import { AccessibilityPlatformUtil } from '../common/AccessibilityUtil';

export class AccessibilityUtil extends AccessibilityPlatformUtil {
setAccessibilityFocus(component: React.Component<any, any>): void {
// NO-OP
if (Accessibility.isScreenReaderEnabled() && RN.AccessibilityInfo && RN.AccessibilityInfo.setAccessibilityFocus) {
RN.AccessibilityInfo.setAccessibilityFocus(RN.findNodeHandle(component));
}
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/native-common/Button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ export class Button extends RX.Button<{}> {
}

focus() {
// native mobile platforms doesn't have the notion of focus for buttons, so ignore.
AccessibilityUtil.setAccessibilityFocus(this);
}

blur() {
Expand Down
1 change: 1 addition & 0 deletions src/typings/react-native.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -703,6 +703,7 @@ declare module 'react-native' {
static addEventListener(type: string, handler: (event: any) => void): void;
static removeEventListener(type: string, handler: (event: any) => void): void;
static announceForAccessibility(announcement: string): void;
static setAccessibilityFocus(reactTag: number): void;
}

interface AlertButtonSpec {
Expand Down