File tree Expand file tree Collapse file tree 3 files changed +15
-3
lines changed
Libraries/Components/AccessibilityInfo Expand file tree Collapse file tree 3 files changed +15
-3
lines changed Original file line number Diff line number Diff line change @@ -188,7 +188,9 @@ const AccessibilityInfo = {
188188 * See http://facebook.github.io/react-native/docs/accessibilityinfo.html#announceforaccessibility
189189 */
190190 announceForAccessibility : function ( announcement : string ) : void {
191- warning ( false , 'AccessibilityInfo is not supported on this platform.' ) ;
191+ if ( NativeAccessibilityManager ) {
192+ NativeAccessibilityManager . announceForAccessibility ( announcement ) ;
193+ }
192194 } ,
193195} ;
194196
Original file line number Diff line number Diff line change @@ -53,7 +53,18 @@ - (void)dealloc
5353 [[NSWorkspace sharedWorkspace ] removeObserver: self
5454 forKeyPath: @" voiceOverEnabled"
5555 context: AccessibilityVoiceOverChangeContext];
56- [[[NSWorkspace sharedWorkspace ] notificationCenter ] removeObserver: self ];
56+ [[[NSWorkspace sharedWorkspace ] notificationCenter ] removeObserver: self ];
57+ }
58+
59+ RCT_EXPORT_METHOD (announceForAccessibility:(NSString *)announcement)
60+ {
61+ NSAccessibilityPostNotificationWithUserInfo (
62+ NSApp ,
63+ NSAccessibilityAnnouncementRequestedNotification ,
64+ @{NSAccessibilityAnnouncementKey : announcement,
65+ NSAccessibilityPriorityKey : @(NSAccessibilityPriorityHigh)
66+ }
67+ );
5768}
5869
5970RCT_EXPORT_METHOD (getCurrentInvertColorsState:(RCTResponseSenderBlock)callback
Original file line number Diff line number Diff line change @@ -342,4 +342,3 @@ - (RCTAccessibilityManager *)accessibilityManager
342342}
343343
344344@end
345-
You can’t perform that action at this time.
0 commit comments