react-native-a11y-order 1.0.0-rc → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +9 -2
- package/android/src/main/java/com/a11yorder/core/A11yManagedFocusView.java +29 -0
- package/android/src/main/java/com/a11yorder/core/A11yViewOrder.java +1 -1
- package/android/src/main/java/com/a11yorder/modules/A11yAnnounceModule.java +20 -7
- package/android/src/main/java/com/a11yorder/views/A11yIndexView/A11yIndexViewManager.java +0 -6
- package/android/src/oldarch/A11yAnnounceModuleSpec.java +8 -1
- package/android/src/oldarch/A11yIndexViewManagerSpec.java +0 -1
- package/ios/helpers/RNAOSpeechAttributes.h +35 -0
- package/ios/helpers/RNAOSpeechAttributes.mm +64 -0
- package/ios/modules/RNAOA11yAnnounceModule.h +13 -9
- package/ios/modules/RNAOA11yAnnounceModule.mm +220 -14
- package/ios/services/RNAOA11yAnnounceService/RNAOA11yAnnounceService.h +11 -1
- package/ios/services/RNAOA11yAnnounceService/RNAOA11yAnnounceService.mm +55 -51
- package/ios/views/RNAOA11yIndexView/RNAOA11yIndexView.mm +0 -4
- package/ios/views/RNAOA11yIndexView/RNAOA11yIndexViewManager.mm +5 -5
- package/ios/views/RNAOA11yPaneTitleView/RNAOA11yPaneTitleView.mm +12 -2
- package/ios/views/base/{RNAOA11yAutoFocusView.h → RNAOA11yManagedFocusView.h} +5 -7
- package/ios/views/base/{RNAOA11yAutoFocusView.mm → RNAOA11yManagedFocusView.mm} +2 -19
- package/ios/views/base/RNAOA11yViewOrder.h +3 -3
- package/lib/commonjs/components/A11yCard/A11yCard.ios.js +8 -1
- package/lib/commonjs/components/A11yCard/A11yCard.ios.js.map +1 -1
- package/lib/commonjs/components/A11yIndex/A11yIndex.js +3 -2
- package/lib/commonjs/components/A11yIndex/A11yIndex.js.map +1 -1
- package/lib/commonjs/index.js +22 -4
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/index.web.js +4 -4
- package/lib/commonjs/modules/A11yAnnounceModule.android.js +37 -3
- package/lib/commonjs/modules/A11yAnnounceModule.android.js.map +1 -1
- package/lib/commonjs/modules/A11yAnnounceModule.js +66 -8
- package/lib/commonjs/modules/A11yAnnounceModule.js.map +1 -1
- package/lib/commonjs/nativeSpecs/A11yIndexNativeComponent.ts +0 -1
- package/lib/commonjs/nativeSpecs/NativeA11yAnnounceModule.js +2 -0
- package/lib/commonjs/nativeSpecs/NativeA11yAnnounceModule.js.map +1 -1
- package/lib/module/components/A11yCard/A11yCard.ios.js +8 -1
- package/lib/module/components/A11yCard/A11yCard.ios.js.map +1 -1
- package/lib/module/components/A11yIndex/A11yIndex.js +3 -2
- package/lib/module/components/A11yIndex/A11yIndex.js.map +1 -1
- package/lib/module/index.js +1 -1
- package/lib/module/index.js.map +1 -1
- package/lib/module/index.web.js +1 -1
- package/lib/module/index.web.js.map +1 -1
- package/lib/module/modules/A11yAnnounceModule.android.js +32 -2
- package/lib/module/modules/A11yAnnounceModule.android.js.map +1 -1
- package/lib/module/modules/A11yAnnounceModule.js +62 -7
- package/lib/module/modules/A11yAnnounceModule.js.map +1 -1
- package/lib/module/nativeSpecs/A11yIndexNativeComponent.ts +0 -1
- package/lib/module/nativeSpecs/NativeA11yAnnounceModule.js +4 -0
- package/lib/module/nativeSpecs/NativeA11yAnnounceModule.js.map +1 -1
- package/lib/typescript/src/components/A11yCard/A11yCard.ios.d.ts.map +1 -1
- package/lib/typescript/src/components/A11yIndex/A11yIndex.d.ts +0 -1
- package/lib/typescript/src/components/A11yIndex/A11yIndex.d.ts.map +1 -1
- package/lib/typescript/src/components/A11yIndex/A11yIndex.types.d.ts +0 -4
- package/lib/typescript/src/components/A11yIndex/A11yIndex.types.d.ts.map +1 -1
- package/lib/typescript/src/components/A11yIndex/A11yIndex.web.d.ts +0 -1
- package/lib/typescript/src/components/A11yIndex/A11yIndex.web.d.ts.map +1 -1
- package/lib/typescript/src/components/A11yView/A11yView.d.ts +0 -1
- package/lib/typescript/src/components/A11yView/A11yView.d.ts.map +1 -1
- package/lib/typescript/src/index.d.ts +2 -3
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/index.web.d.ts +1 -2
- package/lib/typescript/src/index.web.d.ts.map +1 -1
- package/lib/typescript/src/modules/A11yAnnounceModule.android.d.ts +25 -2
- package/lib/typescript/src/modules/A11yAnnounceModule.android.d.ts.map +1 -1
- package/lib/typescript/src/modules/A11yAnnounceModule.d.ts +112 -4
- package/lib/typescript/src/modules/A11yAnnounceModule.d.ts.map +1 -1
- package/lib/typescript/src/nativeSpecs/A11yIndexNativeComponent.d.ts +0 -1
- package/lib/typescript/src/nativeSpecs/A11yIndexNativeComponent.d.ts.map +1 -1
- package/lib/typescript/src/nativeSpecs/NativeA11yAnnounceModule.d.ts +21 -1
- package/lib/typescript/src/nativeSpecs/NativeA11yAnnounceModule.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/components/A11yCard/A11yCard.ios.tsx +8 -1
- package/src/components/A11yIndex/A11yIndex.tsx +5 -4
- package/src/components/A11yIndex/A11yIndex.types.ts +0 -5
- package/src/index.ts +12 -1
- package/src/index.web.ts +1 -1
- package/src/modules/A11yAnnounceModule.android.ts +18 -2
- package/src/modules/A11yAnnounceModule.ts +153 -9
- package/src/nativeSpecs/A11yIndexNativeComponent.ts +0 -1
- package/src/nativeSpecs/NativeA11yAnnounceModule.ts +31 -1
- package/android/src/main/java/com/a11yorder/core/A11yAutoFocusView.java +0 -61
|
@@ -13,99 +13,103 @@
|
|
|
13
13
|
#import "RNAOA11yAnnounceHelper.h"
|
|
14
14
|
|
|
15
15
|
@interface RNAOA11yAnnounceService ()
|
|
16
|
-
|
|
17
|
-
//@property (nonatomic, copy) void (^debounceBlock)(void);
|
|
18
|
-
|
|
19
16
|
@property (nonatomic, assign) BOOL isVoiceOverNulled;
|
|
20
17
|
@property (nonatomic, assign) BOOL isAnnounceLocked;
|
|
21
|
-
|
|
22
18
|
@property (nonatomic, strong) RNAODebouncer *announceDebouncer;
|
|
23
19
|
@property (nonatomic, strong) RNAODebouncer *lockReleaseDebouncer;
|
|
24
|
-
|
|
25
20
|
@property (nonatomic, strong) RNAOA11yAnnounceQueue *announceQueue;
|
|
26
|
-
@property (
|
|
27
|
-
|
|
21
|
+
@property (nonatomic, strong) RNAOFocusChangeListener *voiceOverFocusListener;
|
|
22
|
+
// One callback per announce:onFired: call (FIFO). Fired when the batch posts.
|
|
23
|
+
// Dropped without calling on cancelAll — module resolves those promises as 'cancelled'.
|
|
24
|
+
@property (nonatomic, strong) NSMutableArray<dispatch_block_t> *onFiredCallbacks;
|
|
28
25
|
@property (nonatomic, assign, readonly) BOOL canAnnounce;
|
|
29
|
-
|
|
30
26
|
@end
|
|
31
27
|
|
|
32
28
|
@implementation RNAOA11yAnnounceService
|
|
33
29
|
|
|
34
30
|
#pragma mark - Singleton
|
|
31
|
+
|
|
35
32
|
+ (instancetype)shared {
|
|
36
|
-
static RNAOA11yAnnounceService *
|
|
33
|
+
static RNAOA11yAnnounceService *instance = nil;
|
|
37
34
|
static dispatch_once_t onceToken;
|
|
38
|
-
dispatch_once(&onceToken, ^{
|
|
39
|
-
|
|
40
|
-
});
|
|
41
|
-
return sharedInstance;
|
|
35
|
+
dispatch_once(&onceToken, ^{ instance = [self new]; });
|
|
36
|
+
return instance;
|
|
42
37
|
}
|
|
43
38
|
|
|
44
39
|
- (instancetype)init {
|
|
45
|
-
if (self) {
|
|
46
|
-
_isVoiceOverNulled
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
self.voiceOverFocusListener = [[RNAOFocusChangeListener alloc] initWithDelegate: self];
|
|
54
|
-
[self.voiceOverFocusListener startListening];
|
|
40
|
+
if (self = [super init]) {
|
|
41
|
+
_isVoiceOverNulled = YES;
|
|
42
|
+
_announceDebouncer = [[RNAODebouncer alloc] initWithInterval:0.3];
|
|
43
|
+
_lockReleaseDebouncer = [[RNAODebouncer alloc] initWithInterval:1.0];
|
|
44
|
+
_announceQueue = [RNAOA11yAnnounceQueue new];
|
|
45
|
+
_onFiredCallbacks = [NSMutableArray new];
|
|
46
|
+
_voiceOverFocusListener = [[RNAOFocusChangeListener alloc] initWithDelegate:self];
|
|
47
|
+
[_voiceOverFocusListener startListening];
|
|
55
48
|
}
|
|
56
49
|
return self;
|
|
57
50
|
}
|
|
58
51
|
|
|
59
|
-
- (void)dealloc {
|
|
60
|
-
[self.voiceOverFocusListener stopListening];
|
|
61
|
-
}
|
|
52
|
+
- (void)dealloc { [_voiceOverFocusListener stopListening]; }
|
|
62
53
|
|
|
63
54
|
- (BOOL)canAnnounce {
|
|
64
55
|
return !self.announceQueue.isEmpty && !self.isAnnounceLocked && !self.isVoiceOverNulled;
|
|
65
56
|
}
|
|
66
57
|
|
|
58
|
+
#pragma mark - Focus delegate
|
|
59
|
+
|
|
67
60
|
- (void)voiceOverFocusChanged:(id)focusedElement {
|
|
68
61
|
self.isVoiceOverNulled = (focusedElement == nil);
|
|
69
|
-
|
|
70
|
-
[self delayedAnnounce];
|
|
62
|
+
[self _scheduleAnnounce];
|
|
71
63
|
}
|
|
72
64
|
|
|
65
|
+
#pragma mark - Lock
|
|
66
|
+
|
|
73
67
|
- (void)temporarilyLockAnnounce {
|
|
74
|
-
|
|
75
|
-
[self.lockReleaseDebouncer debounceAction:^{
|
|
76
|
-
self.isAnnounceLocked = NO;
|
|
77
|
-
[self delayedAnnounce];
|
|
78
|
-
}];
|
|
68
|
+
[self temporarilyLockAnnounce:1.0];
|
|
79
69
|
}
|
|
80
70
|
|
|
81
71
|
- (void)temporarilyLockAnnounce:(NSTimeInterval)interval {
|
|
82
|
-
|
|
83
|
-
|
|
72
|
+
self.isAnnounceLocked = YES;
|
|
73
|
+
// Interval must be set before debounceAction: — it is read at call time.
|
|
74
|
+
self.lockReleaseDebouncer.debounceInterval = interval;
|
|
75
|
+
__weak RNAOA11yAnnounceService *weakSelf = self;
|
|
76
|
+
[self.lockReleaseDebouncer debounceAction:^{
|
|
77
|
+
weakSelf.isAnnounceLocked = NO;
|
|
78
|
+
[weakSelf _scheduleAnnounce];
|
|
79
|
+
}];
|
|
84
80
|
}
|
|
85
81
|
|
|
86
|
-
|
|
87
82
|
#pragma mark - Announce
|
|
83
|
+
|
|
88
84
|
- (void)announce:(NSString *)announcement {
|
|
89
|
-
[self
|
|
90
|
-
|
|
91
|
-
[self delayedAnnounce];
|
|
85
|
+
[self announce:announcement onFired:nil];
|
|
92
86
|
}
|
|
93
87
|
|
|
94
|
-
- (void)
|
|
95
|
-
|
|
88
|
+
- (void)announce:(NSString *)announcement onFired:(nullable dispatch_block_t)onFired {
|
|
89
|
+
[self.announceQueue add:announcement];
|
|
90
|
+
if (onFired) [self.onFiredCallbacks addObject:onFired];
|
|
91
|
+
[self _scheduleAnnounce];
|
|
92
|
+
}
|
|
96
93
|
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
94
|
+
- (void)cancelAll {
|
|
95
|
+
[self.announceQueue clear];
|
|
96
|
+
[self.onFiredCallbacks removeAllObjects];
|
|
100
97
|
}
|
|
101
98
|
|
|
102
|
-
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
99
|
+
#pragma mark - Private
|
|
100
|
+
|
|
101
|
+
- (void)_scheduleAnnounce {
|
|
102
|
+
if (!self.canAnnounce) return;
|
|
103
|
+
__weak RNAOA11yAnnounceService *weakSelf = self;
|
|
104
|
+
[self.announceDebouncer debounceAction:^{ [weakSelf _announceNow]; }];
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
- (void)_announceNow {
|
|
108
|
+
if (!self.canAnnounce) return;
|
|
109
|
+
[RNAOA11yAnnounceHelper announceWithList:self.announceQueue.list];
|
|
110
|
+
[self.announceQueue clear];
|
|
111
|
+
for (dispatch_block_t cb in self.onFiredCallbacks.copy) { cb(); }
|
|
112
|
+
[self.onFiredCallbacks removeAllObjects];
|
|
109
113
|
}
|
|
110
114
|
|
|
111
115
|
@end
|
|
@@ -49,10 +49,6 @@ using namespace facebook::react;
|
|
|
49
49
|
[self setOrderFocusType: @(newViewProps.orderFocusType)];
|
|
50
50
|
}
|
|
51
51
|
|
|
52
|
-
if (self.autoFocus != newViewProps.autoFocus) {
|
|
53
|
-
[self setAutoFocus: newViewProps.autoFocus];
|
|
54
|
-
}
|
|
55
|
-
|
|
56
52
|
if (self.groupChildrenMode != newViewProps.shouldGroupAccessibilityChildren) {
|
|
57
53
|
self.groupChildrenMode = newViewProps.shouldGroupAccessibilityChildren;
|
|
58
54
|
}
|
|
@@ -49,16 +49,16 @@ RCT_EXPORT_METHOD(focus:(nonnull NSNumber *)reactTag)
|
|
|
49
49
|
}];
|
|
50
50
|
}
|
|
51
51
|
|
|
52
|
-
RCT_CUSTOM_VIEW_PROPERTY(
|
|
52
|
+
RCT_CUSTOM_VIEW_PROPERTY(descendantFocusChangedEnabled, BOOL, RNAOA11yIndexView)
|
|
53
53
|
{
|
|
54
54
|
BOOL value = json ? [RCTConvert BOOL:json] : NO;
|
|
55
|
-
[view
|
|
55
|
+
[view setDescendantFocusChangedEnabled: value];
|
|
56
56
|
}
|
|
57
57
|
|
|
58
|
-
RCT_CUSTOM_VIEW_PROPERTY(
|
|
58
|
+
RCT_CUSTOM_VIEW_PROPERTY(shouldGroupAccessibilityChildren, int, RNAOA11yIndexView)
|
|
59
59
|
{
|
|
60
|
-
|
|
61
|
-
|
|
60
|
+
int value = json ? [RCTConvert int:json] : -1;
|
|
61
|
+
[view setGroupChildrenMode: value];
|
|
62
62
|
}
|
|
63
63
|
|
|
64
64
|
RCT_CUSTOM_VIEW_PROPERTY(containerType, NSInteger, UIView)
|
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
#import "RNAOA11yPaneTitleView.h"
|
|
13
13
|
#import "UIViewController+RNAOA11yOrder.h"
|
|
14
14
|
#import "RNAOA11yAnnounceService.h"
|
|
15
|
+
#import "RNAOSpeechAttributes.h"
|
|
15
16
|
|
|
16
17
|
#ifdef RCT_NEW_ARCH_ENABLED
|
|
17
18
|
|
|
@@ -99,10 +100,10 @@ Class<RCTComponentViewProtocol> A11yPaneTitleCls(void)
|
|
|
99
100
|
|
|
100
101
|
if(self.window && !_announced) {
|
|
101
102
|
_announced = YES;
|
|
102
|
-
[
|
|
103
|
+
[self _announce:_title];
|
|
103
104
|
}
|
|
104
105
|
if(!self.window && _announced && _detachMessage) {
|
|
105
|
-
[
|
|
106
|
+
[self _announce:_detachMessage];
|
|
106
107
|
}
|
|
107
108
|
|
|
108
109
|
if (self.window) {
|
|
@@ -113,5 +114,14 @@ Class<RCTComponentViewProtocol> A11yPaneTitleCls(void)
|
|
|
113
114
|
}
|
|
114
115
|
}
|
|
115
116
|
|
|
117
|
+
- (void)_announce:(NSString *)message {
|
|
118
|
+
if (@available(iOS 17.0, *)) {
|
|
119
|
+
NSAttributedString *attrStr = [RNAOSpeechAttributes attributedStringFor:message
|
|
120
|
+
options:@{ @"priority": @"high", @"queue": @NO }];
|
|
121
|
+
UIAccessibilityPostNotification(UIAccessibilityAnnouncementNotification, attrStr);
|
|
122
|
+
} else {
|
|
123
|
+
[[RNAOA11yAnnounceService shared] announce:message];
|
|
124
|
+
}
|
|
125
|
+
}
|
|
116
126
|
|
|
117
127
|
@end
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
#ifndef
|
|
2
|
-
#define
|
|
1
|
+
#ifndef RNAOA11yManagedFocusView_h
|
|
2
|
+
#define RNAOA11yManagedFocusView_h
|
|
3
3
|
|
|
4
4
|
#import "RNAOA11yGroupChildrenView.h"
|
|
5
5
|
#import "RNAOA11yFocusService.h"
|
|
@@ -8,8 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
NS_ASSUME_NONNULL_BEGIN
|
|
10
10
|
|
|
11
|
-
@interface
|
|
12
|
-
@property BOOL autoFocus;
|
|
11
|
+
@interface RNAOA11yManagedFocusView : RNAOA11yGroupChildrenView<RNAOA11yFocusServiceSubscriber>
|
|
13
12
|
@property BOOL descendantFocusChangedEnabled;
|
|
14
13
|
@end
|
|
15
14
|
|
|
@@ -17,8 +16,7 @@ NS_ASSUME_NONNULL_END
|
|
|
17
16
|
|
|
18
17
|
#else
|
|
19
18
|
|
|
20
|
-
@interface
|
|
21
|
-
@property BOOL autoFocus;
|
|
19
|
+
@interface RNAOA11yManagedFocusView : RNAOA11yGroupChildrenView<RNAOA11yFocusServiceSubscriber>
|
|
22
20
|
@property BOOL descendantFocusChangedEnabled;
|
|
23
21
|
@property (nonatomic, copy) RCTDirectEventBlock onScreenReaderDescendantFocusChanged;
|
|
24
22
|
@property (nonatomic, copy) RCTDirectEventBlock onScreenReaderFocusChange;
|
|
@@ -27,4 +25,4 @@ NS_ASSUME_NONNULL_END
|
|
|
27
25
|
|
|
28
26
|
#endif
|
|
29
27
|
|
|
30
|
-
#endif /*
|
|
28
|
+
#endif /* RNAOA11yManagedFocusView_h */
|
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
#import "
|
|
1
|
+
#import "RNAOA11yManagedFocusView.h"
|
|
2
2
|
#import "RNAOViewItemDelegate.h"
|
|
3
3
|
|
|
4
4
|
#ifdef RCT_NEW_ARCH_ENABLED
|
|
5
5
|
#import "RNAOFabricEventHelper.h"
|
|
6
6
|
#endif
|
|
7
7
|
|
|
8
|
-
@implementation
|
|
9
|
-
BOOL _needsAutoFocus;
|
|
8
|
+
@implementation RNAOA11yManagedFocusView {
|
|
10
9
|
BOOL _descendantFocusChangedEnabled;
|
|
11
10
|
RNAOViewItemDelegate* _viewDelegate;
|
|
12
11
|
}
|
|
@@ -15,7 +14,6 @@
|
|
|
15
14
|
|
|
16
15
|
- (instancetype)initWithFrame:(CGRect)frame {
|
|
17
16
|
if (self = [super initWithFrame:frame]) {
|
|
18
|
-
_needsAutoFocus = YES;
|
|
19
17
|
_descendantFocusChangedEnabled = NO;
|
|
20
18
|
_viewDelegate = [[RNAOViewItemDelegate alloc] initWithView: self];
|
|
21
19
|
}
|
|
@@ -24,8 +22,6 @@
|
|
|
24
22
|
|
|
25
23
|
- (void)prepareForRecycle {
|
|
26
24
|
[super prepareForRecycle];
|
|
27
|
-
_needsAutoFocus = YES;
|
|
28
|
-
_autoFocus = NO;
|
|
29
25
|
[_viewDelegate prepareForRecycle];
|
|
30
26
|
}
|
|
31
27
|
|
|
@@ -38,7 +34,6 @@
|
|
|
38
34
|
|
|
39
35
|
- (instancetype)initWithFrame:(CGRect)frame {
|
|
40
36
|
if (self = [super initWithFrame:frame]) {
|
|
41
|
-
_needsAutoFocus = YES;
|
|
42
37
|
_viewDelegate = [[RNAOViewItemDelegate alloc] initWithView: self];
|
|
43
38
|
}
|
|
44
39
|
return self;
|
|
@@ -76,18 +71,6 @@
|
|
|
76
71
|
[self focusView];
|
|
77
72
|
}
|
|
78
73
|
|
|
79
|
-
- (void)didMoveToWindow {
|
|
80
|
-
[super didMoveToWindow];
|
|
81
|
-
if (self.window) {
|
|
82
|
-
if (_needsAutoFocus && _autoFocus) {
|
|
83
|
-
_needsAutoFocus = NO;
|
|
84
|
-
dispatch_async(dispatch_get_main_queue(), ^{
|
|
85
|
-
[self focusView];
|
|
86
|
-
});
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
|
|
91
74
|
- (void)didMoveToSuperview {
|
|
92
75
|
[super didMoveToSuperview];
|
|
93
76
|
if (_descendantFocusChangedEnabled && self.superview) {
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
#ifndef RNAOA11yViewOrder_h
|
|
2
2
|
#define RNAOA11yViewOrder_h
|
|
3
3
|
|
|
4
|
-
#import "
|
|
4
|
+
#import "RNAOA11yManagedFocusView.h"
|
|
5
5
|
|
|
6
6
|
#ifdef RCT_NEW_ARCH_ENABLED
|
|
7
7
|
|
|
8
8
|
NS_ASSUME_NONNULL_BEGIN
|
|
9
9
|
|
|
10
|
-
@interface RNAOA11yViewOrder :
|
|
10
|
+
@interface RNAOA11yViewOrder : RNAOA11yManagedFocusView
|
|
11
11
|
|
|
12
12
|
- (void)setPosition:(NSNumber*)position;
|
|
13
13
|
- (void)setOrderKey:(NSString *)orderKey;
|
|
@@ -23,7 +23,7 @@ NS_ASSUME_NONNULL_END
|
|
|
23
23
|
|
|
24
24
|
#else
|
|
25
25
|
|
|
26
|
-
@interface RNAOA11yViewOrder :
|
|
26
|
+
@interface RNAOA11yViewOrder : RNAOA11yManagedFocusView
|
|
27
27
|
|
|
28
28
|
- (void)setPosition:(NSNumber*)position;
|
|
29
29
|
- (void)setOrderKey:(NSString *)orderKey;
|
|
@@ -27,6 +27,7 @@ const A11yCard = ({
|
|
|
27
27
|
...accessibility,
|
|
28
28
|
accessible: true,
|
|
29
29
|
pointerEvents: "none",
|
|
30
|
+
collapsable: false,
|
|
30
31
|
onAccessibilityTap: onPress,
|
|
31
32
|
style: styles.overlay
|
|
32
33
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Pressable, {
|
|
@@ -44,6 +45,12 @@ const styles = _reactNative.StyleSheet.create({
|
|
|
44
45
|
container: {
|
|
45
46
|
position: 'relative'
|
|
46
47
|
},
|
|
47
|
-
overlay:
|
|
48
|
+
overlay: {
|
|
49
|
+
position: 'absolute',
|
|
50
|
+
top: 0,
|
|
51
|
+
left: 0,
|
|
52
|
+
right: 0,
|
|
53
|
+
bottom: 0
|
|
54
|
+
}
|
|
48
55
|
});
|
|
49
56
|
//# sourceMappingURL=A11yCard.ios.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_react","_interopRequireDefault","require","_reactNative","_A11yCardNativeComponent","_jsxRuntime","e","__esModule","default","A11yCard","containerProps","style","testID","onPress","accessibility","pressableProps","children","jsxs","styles","container","jsx","View","accessibilityRole","accessible","pointerEvents","onAccessibilityTap","overlay","Pressable","exports","StyleSheet","create","position","
|
|
1
|
+
{"version":3,"names":["_react","_interopRequireDefault","require","_reactNative","_A11yCardNativeComponent","_jsxRuntime","e","__esModule","default","A11yCard","containerProps","style","testID","onPress","accessibility","pressableProps","children","jsxs","styles","container","jsx","View","accessibilityRole","accessible","pointerEvents","collapsable","onAccessibilityTap","overlay","Pressable","exports","StyleSheet","create","position","top","left","right","bottom"],"sourceRoot":"../../../../src","sources":["components/A11yCard/A11yCard.ios.tsx"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AACA,IAAAE,wBAAA,GAAAH,sBAAA,CAAAC,OAAA;AAA6D,IAAAG,WAAA,GAAAH,OAAA;AAAA,SAAAD,uBAAAK,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAKtD,MAAMG,QAAQ,GAAGA,CAAC;EACvBC,cAAc;EACdC,KAAK;EACLC,MAAM;EACNC,OAAO;EACPC,aAAa;EACbC,cAAc;EACdC;AACa,CAAC,KAAK;EACnB,oBACE,IAAAX,WAAA,CAAAY,IAAA,EAACb,wBAAA,CAAAI,OAAI;IAAA,GAAKE,cAAc;IAAEC,KAAK,EAAE,CAACO,MAAM,CAACC,SAAS,EAAET,cAAc,EAAEC,KAAK,CAAE;IAAAK,QAAA,gBACzE,IAAAX,WAAA,CAAAe,GAAA,EAACjB,YAAA,CAAAkB,IAAI;MACHT,MAAM,EAAE,GAAGA,MAAM,UAAW;MAC5BU,iBAAiB,EAAC,QAAQ;MAAA,GACtBR,aAAa;MACjBS,UAAU;MACVC,aAAa,EAAC,MAAM;MACpBC,WAAW,EAAE,KAAM;MACnBC,kBAAkB,EAAEb,OAAQ;MAC5BF,KAAK,EAAEO,MAAM,CAACS;IAAQ,CACvB,CAAC,eACF,IAAAtB,WAAA,CAAAe,GAAA,EAACjB,YAAA,CAAAyB,SAAS;MAAA,GACJb,cAAc;MAClBQ,UAAU,EAAE,KAAM;MAClBV,OAAO,EAAEA,OAAQ;MACjBD,MAAM,EAAEA,MAAO;MACfD,KAAK,EAAEA,KAAM;MAAAK,QAAA,EAEZA;IAAQ,CACA,CAAC;EAAA,CACR,CAAC;AAEX,CAAC;AAACa,OAAA,CAAApB,QAAA,GAAAA,QAAA;AAEF,MAAMS,MAAM,GAAGY,uBAAU,CAACC,MAAM,CAAC;EAC/BZ,SAAS,EAAE;IAAEa,QAAQ,EAAE;EAAW,CAAC;EACnCL,OAAO,EAAE;IACPK,QAAQ,EAAE,UAAU;IACpBC,GAAG,EAAE,CAAC;IACNC,IAAI,EAAE,CAAC;IACPC,KAAK,EAAE,CAAC;IACRC,MAAM,EAAE;EACV;AACF,CAAC,CAAC","ignoreList":[]}
|
|
@@ -62,11 +62,12 @@ function useOrderProps(index, orderType, importantForAccessibilityProp) {
|
|
|
62
62
|
throw new Error('<A11y.Index> element should be used inside of <A11y.Order> container');
|
|
63
63
|
}
|
|
64
64
|
const resolvedOrderType = orderType ?? 'default';
|
|
65
|
-
const
|
|
65
|
+
const isDefaultOrderType = resolvedOrderType === 'default';
|
|
66
|
+
const importantForAccessibility = hasOrderInfo && isDefaultOrderType ? 'yes' : importantForAccessibilityProp;
|
|
66
67
|
return {
|
|
67
68
|
orderKey,
|
|
68
69
|
orderFocusType: hasOrderInfo ? _A11yIndex.A11yOrderTypeEnum[resolvedOrderType] : undefined,
|
|
69
|
-
importantForAccessibility
|
|
70
|
+
importantForAccessibility
|
|
70
71
|
};
|
|
71
72
|
}
|
|
72
73
|
const A11yIndex = exports.A11yIndex = /*#__PURE__*/_react.default.memo(/*#__PURE__*/_react.default.forwardRef(({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_react","_interopRequireWildcard","require","_A11ySequenceOrderContext","_A11yIndexNativeComponent","_A11yIndex","_jsxRuntime","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","useScreenReaderProps","onScreenReaderFocused","onScreenReaderSubViewFocusChange","onScreenReaderSubViewFocused","onScreenReaderSubViewBlurred","onScreenReaderDescendantFocusChanged","hasHandler","Boolean","onScreenReaderFocusChange","React","useCallback","event","isFocused","nativeEvent","undefined","descendantFocusChangedEnabled","useFocusRef","ref","localRef","useRef","useImperativeHandle","native","current","Proxy","_target","prop","Commands","focus","useOrderProps","index","orderType","importantForAccessibilityProp","orderKey","useContext","A11ySequenceOrderContext","hasOrderInfo","Error","resolvedOrderType","
|
|
1
|
+
{"version":3,"names":["_react","_interopRequireWildcard","require","_A11ySequenceOrderContext","_A11yIndexNativeComponent","_A11yIndex","_jsxRuntime","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","useScreenReaderProps","onScreenReaderFocused","onScreenReaderSubViewFocusChange","onScreenReaderSubViewFocused","onScreenReaderSubViewBlurred","onScreenReaderDescendantFocusChanged","hasHandler","Boolean","onScreenReaderFocusChange","React","useCallback","event","isFocused","nativeEvent","undefined","descendantFocusChangedEnabled","useFocusRef","ref","localRef","useRef","useImperativeHandle","native","current","Proxy","_target","prop","Commands","focus","useOrderProps","index","orderType","importantForAccessibilityProp","orderKey","useContext","A11ySequenceOrderContext","hasOrderInfo","Error","resolvedOrderType","isDefaultOrderType","importantForAccessibility","orderFocusType","A11yOrderTypeEnum","A11yIndex","exports","memo","forwardRef","children","a11yUIContainer","shouldGroupAccessibilityChildren","props","viewProps","containerTypeValue","A11yContainerTypeEnum","shouldGroupChildrenValue","screenReaderNativeProps","jsx","containerType","orderIndex"],"sourceRoot":"../../../../src","sources":["components/A11yIndex/A11yIndex.tsx"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AAEA,IAAAC,yBAAA,GAAAD,OAAA;AACA,IAAAE,yBAAA,GAAAH,uBAAA,CAAAC,OAAA;AAGA,IAAAG,UAAA,GAAAH,OAAA;AAM2B,IAAAI,WAAA,GAAAJ,OAAA;AAAA,SAAAD,wBAAAM,CAAA,EAAAC,CA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AA,CAAA2E,GAAA,EAAC7E,yBAAA,CAAAa,OAAa;IACZ0B,GAAG,EAAEC,QAA2B;IAAA,GAC5BgC,SAAS;IACbM,aAAa,EAAEL,kBAAmB;IAClCH,gCAAgC,EAAEK,wBAAyB;IAC3Dd,yBAAyB,EAAEA,yBAA0B;IACrDC,cAAc,EAAEA,cAAe;IAC/BiB,UAAU,EAAE5B,KAAM;IAClBG,QAAQ,EAAEA,QAAS;IAAA,GACfsB,uBAAuB;IAAAR,QAAA,EAE1BA;EAAQ,CACI,CAAC;AAEpB,CACF,CACF,CAAC","ignoreList":[]}
|
package/lib/commonjs/index.js
CHANGED
|
@@ -4,16 +4,34 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.A11y = void 0;
|
|
7
|
-
Object.defineProperty(exports, "
|
|
7
|
+
Object.defineProperty(exports, "A11yOrderTypeEnum", {
|
|
8
8
|
enumerable: true,
|
|
9
9
|
get: function () {
|
|
10
|
-
return
|
|
10
|
+
return _A11yIndex2.A11yOrderTypeEnum;
|
|
11
11
|
}
|
|
12
12
|
});
|
|
13
|
-
Object.defineProperty(exports, "
|
|
13
|
+
Object.defineProperty(exports, "ScreenReader", {
|
|
14
14
|
enumerable: true,
|
|
15
15
|
get: function () {
|
|
16
|
-
return
|
|
16
|
+
return _A11yAnnounceModule.ScreenReader;
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
Object.defineProperty(exports, "announce", {
|
|
20
|
+
enumerable: true,
|
|
21
|
+
get: function () {
|
|
22
|
+
return _A11yAnnounceModule.announce;
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
Object.defineProperty(exports, "cancel", {
|
|
26
|
+
enumerable: true,
|
|
27
|
+
get: function () {
|
|
28
|
+
return _A11yAnnounceModule.cancel;
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
Object.defineProperty(exports, "cancelAll", {
|
|
32
|
+
enumerable: true,
|
|
33
|
+
get: function () {
|
|
34
|
+
return _A11yAnnounceModule.cancelAll;
|
|
17
35
|
}
|
|
18
36
|
});
|
|
19
37
|
var _A11yIndex = require("./components/A11yIndex/A11yIndex");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_A11yIndex","require","_A11yOrder","_A11yPaneTitle","_A11yView","_A11yFocusFrame","_A11yFocusTrap","_A11yCard","_A11yIndex2","_A11yAnnounceModule","A11y","exports","Order","A11yOrder","Index","A11yIndex","View","A11yView","PaneTitle","A11yPaneTitle","ScreenChange","A11yScreenChange","FocusFrame","A11yFocusFrame","FocusTrap","A11yFocusTrap","Card","A11yCard"],"sourceRoot":"../../src","sources":["index.ts"],"mappings":"
|
|
1
|
+
{"version":3,"names":["_A11yIndex","require","_A11yOrder","_A11yPaneTitle","_A11yView","_A11yFocusFrame","_A11yFocusTrap","_A11yCard","_A11yIndex2","_A11yAnnounceModule","A11y","exports","Order","A11yOrder","Index","A11yIndex","View","A11yView","PaneTitle","A11yPaneTitle","ScreenChange","A11yScreenChange","FocusFrame","A11yFocusFrame","FocusTrap","A11yFocusTrap","Card","A11yCard"],"sourceRoot":"../../src","sources":["index.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,UAAA,GAAAC,OAAA;AACA,IAAAC,UAAA,GAAAD,OAAA;AACA,IAAAE,cAAA,GAAAF,OAAA;AAIA,IAAAG,SAAA,GAAAH,OAAA;AACA,IAAAI,eAAA,GAAAJ,OAAA;AACA,IAAAK,cAAA,GAAAL,OAAA;AACA,IAAAM,SAAA,GAAAN,OAAA;AAWA,IAAAO,WAAA,GAAAP,OAAA;AA4BA,IAAAQ,mBAAA,GAAAR,OAAA;AArCA;;AAwBA;;AAEO,MAAMS,IAAI,GAAAC,OAAA,CAAAD,IAAA,GAAG;EAClBE,KAAK,EAAEC,oBAAS;EAChBC,KAAK,EAAEC,oBAAS;EAChBC,IAAI,EAAEC,kBAAQ;EACdC,SAAS,EAAEC,4BAAa;EACxBC,YAAY,EAAEC,+BAAgB;EAC9BC,UAAU,EAAEC,8BAAc;EAC1BC,SAAS,EAAEC,4BAAa;EACxBC,IAAI,EAAEC;AACR,CAAC","ignoreList":[]}
|
|
@@ -4,16 +4,16 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.A11y = void 0;
|
|
7
|
-
Object.defineProperty(exports, "
|
|
7
|
+
Object.defineProperty(exports, "A11yOrderTypeEnum", {
|
|
8
8
|
enumerable: true,
|
|
9
9
|
get: function () {
|
|
10
|
-
return
|
|
10
|
+
return _A11yIndex2.A11yOrderTypeEnum;
|
|
11
11
|
}
|
|
12
12
|
});
|
|
13
|
-
Object.defineProperty(exports, "
|
|
13
|
+
Object.defineProperty(exports, "ScreenReader", {
|
|
14
14
|
enumerable: true,
|
|
15
15
|
get: function () {
|
|
16
|
-
return
|
|
16
|
+
return _A11yAnnounceModule.ScreenReader;
|
|
17
17
|
}
|
|
18
18
|
});
|
|
19
19
|
var _A11yIndex = require("./components/A11yIndex/A11yIndex");
|
|
@@ -3,9 +3,43 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.
|
|
6
|
+
exports.cancelAll = exports.cancel = exports.announce = exports.ScreenReader = void 0;
|
|
7
7
|
var _reactNative = require("react-native");
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
// Android stub — bypasses the native bridge, uses the built-in API directly.
|
|
9
|
+
|
|
10
|
+
const ScreenReader = exports.ScreenReader = {
|
|
11
|
+
announce: message => {
|
|
12
|
+
_reactNative.AccessibilityInfo.announceForAccessibility(message);
|
|
13
|
+
return Promise.resolve({
|
|
14
|
+
id: '',
|
|
15
|
+
status: 'fired'
|
|
16
|
+
});
|
|
17
|
+
},
|
|
18
|
+
cancel: () => Promise.resolve({
|
|
19
|
+
id: '',
|
|
20
|
+
status: 'cancelled'
|
|
21
|
+
}),
|
|
22
|
+
cancelAll: () => Promise.resolve({
|
|
23
|
+
id: '',
|
|
24
|
+
status: 'cancelled'
|
|
25
|
+
})
|
|
26
|
+
};
|
|
27
|
+
const announce = message => {
|
|
28
|
+
_reactNative.AccessibilityInfo.announceForAccessibility(message);
|
|
29
|
+
return Promise.resolve({
|
|
30
|
+
id: '',
|
|
31
|
+
status: 'fired'
|
|
32
|
+
});
|
|
10
33
|
};
|
|
34
|
+
exports.announce = announce;
|
|
35
|
+
const cancel = () => Promise.resolve({
|
|
36
|
+
id: '',
|
|
37
|
+
status: 'cancelled'
|
|
38
|
+
});
|
|
39
|
+
exports.cancel = cancel;
|
|
40
|
+
const cancelAll = () => Promise.resolve({
|
|
41
|
+
id: '',
|
|
42
|
+
status: 'cancelled'
|
|
43
|
+
});
|
|
44
|
+
exports.cancelAll = cancelAll;
|
|
11
45
|
//# sourceMappingURL=A11yAnnounceModule.android.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_reactNative","require","
|
|
1
|
+
{"version":3,"names":["_reactNative","require","ScreenReader","exports","announce","message","AccessibilityInfo","announceForAccessibility","Promise","resolve","id","status","cancel","cancelAll"],"sourceRoot":"../../../src","sources":["modules/A11yAnnounceModule.android.ts"],"mappings":";;;;;;AACA,IAAAA,YAAA,GAAAC,OAAA;AADA;;AAGO,MAAMC,YAAY,GAAAC,OAAA,CAAAD,YAAA,GAAG;EAC1BE,QAAQ,EAAGC,OAAe,IAAK;IAC7BC,8BAAiB,CAACC,wBAAwB,CAACF,OAAO,CAAC;IACnD,OAAOG,OAAO,CAACC,OAAO,CAAC;MAAEC,EAAE,EAAE,EAAE;MAAEC,MAAM,EAAE;IAAiB,CAAC,CAAC;EAC9D,CAAC;EACDC,MAAM,EAAEA,CAAA,KAAMJ,OAAO,CAACC,OAAO,CAAC;IAAEC,EAAE,EAAE,EAAE;IAAEC,MAAM,EAAE;EAAqB,CAAC,CAAC;EACvEE,SAAS,EAAEA,CAAA,KAAML,OAAO,CAACC,OAAO,CAAC;IAAEC,EAAE,EAAE,EAAE;IAAEC,MAAM,EAAE;EAAqB,CAAC;AAC3E,CAAC;AAEM,MAAMP,QAAQ,GAAIC,OAAe,IAAK;EAC3CC,8BAAiB,CAACC,wBAAwB,CAACF,OAAO,CAAC;EACnD,OAAOG,OAAO,CAACC,OAAO,CAAC;IAAEC,EAAE,EAAE,EAAE;IAAEC,MAAM,EAAE;EAAiB,CAAC,CAAC;AAC9D,CAAC;AAACR,OAAA,CAAAC,QAAA,GAAAA,QAAA;AAEK,MAAMQ,MAAM,GAAGA,CAAA,KACpBJ,OAAO,CAACC,OAAO,CAAC;EAAEC,EAAE,EAAE,EAAE;EAAEC,MAAM,EAAE;AAAqB,CAAC,CAAC;AAACR,OAAA,CAAAS,MAAA,GAAAA,MAAA;AACrD,MAAMC,SAAS,GAAGA,CAAA,KACvBL,OAAO,CAACC,OAAO,CAAC;EAAEC,EAAE,EAAE,EAAE;EAAEC,MAAM,EAAE;AAAqB,CAAC,CAAC;AAACR,OAAA,CAAAU,SAAA,GAAAA,SAAA","ignoreList":[]}
|
|
@@ -3,26 +3,84 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.
|
|
6
|
+
exports.ScreenReader = void 0;
|
|
7
7
|
exports.announce = announce;
|
|
8
|
+
exports.cancel = cancel;
|
|
9
|
+
exports.cancelAll = cancelAll;
|
|
8
10
|
var _reactNative = require("react-native");
|
|
9
|
-
|
|
11
|
+
var _NativeA11yAnnounceModule = _interopRequireDefault(require("../nativeSpecs/NativeA11yAnnounceModule"));
|
|
12
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
13
|
+
const LINKING_ERROR = `The package 'react-native-a11y-order' doesn't seem to be linked. Make sure: \n\n${_reactNative.Platform.select({
|
|
10
14
|
ios: "- You have run 'pod install'\n",
|
|
11
15
|
default: ''
|
|
12
16
|
})}- You rebuilt the app after installing the package\n` + `- You are not using Expo Go\n`;
|
|
13
17
|
|
|
14
18
|
// @ts-expect-error
|
|
15
19
|
const isTurboModuleEnabled = global.__turboModuleProxy != null;
|
|
16
|
-
const
|
|
17
|
-
const
|
|
20
|
+
const A11yAnnounceNative = isTurboModuleEnabled ? _NativeA11yAnnounceModule.default : _reactNative.NativeModules.A11yAnnounceModule;
|
|
21
|
+
const A11yAnnounceProxy = A11yAnnounceNative ?? new Proxy({}, {
|
|
18
22
|
get() {
|
|
19
23
|
throw new Error(LINKING_ERROR);
|
|
20
24
|
}
|
|
21
25
|
});
|
|
22
|
-
|
|
23
|
-
|
|
26
|
+
|
|
27
|
+
// ─── Types ────────────────────────────────────────────────────────────────────
|
|
28
|
+
|
|
29
|
+
// ─── Core API ─────────────────────────────────────────────────────────────────
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Posts a screen reader announcement.
|
|
33
|
+
*
|
|
34
|
+
* **calm mode** (`calm: true`): navigation-aware — waits for transitions to
|
|
35
|
+
* settle and for VoiceOver/TalkBack to have a focused element. Promise
|
|
36
|
+
* resolves when the announcement is **actually fired** (not just enqueued).
|
|
37
|
+
*
|
|
38
|
+
* **direct mode** (`calm: false`, default): posts immediately with speech
|
|
39
|
+
* attributes. On iOS, Promise resolves when VoiceOver confirms speech finished
|
|
40
|
+
* (`status: 'spoken'`) or was interrupted (`status: 'fired'`).
|
|
41
|
+
* On Android, always resolves immediately with `status: 'fired'`.
|
|
42
|
+
*/
|
|
43
|
+
function announce(message, options) {
|
|
44
|
+
const {
|
|
45
|
+
speech,
|
|
46
|
+
...rest
|
|
47
|
+
} = options ?? {};
|
|
48
|
+
return A11yAnnounceProxy.announce(message, {
|
|
49
|
+
...rest,
|
|
50
|
+
...speech
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Cancels the announcement with the given `id`.
|
|
56
|
+
* In calm mode, removes it from the service queue if not yet fired.
|
|
57
|
+
* In direct mode, interrupts the active announcement if it matches.
|
|
58
|
+
*/
|
|
59
|
+
function cancel(id) {
|
|
60
|
+
return A11yAnnounceProxy.cancel(id);
|
|
24
61
|
}
|
|
25
|
-
|
|
26
|
-
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* Cancels all pending and active announcements.
|
|
65
|
+
* Calm-mode promises resolve with `status: 'cancelled'`.
|
|
66
|
+
*/
|
|
67
|
+
function cancelAll() {
|
|
68
|
+
return A11yAnnounceProxy.cancelAll();
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
// ─── Namespace export (backward-compatible) ───────────────────────────────────
|
|
72
|
+
|
|
73
|
+
const ScreenReader = exports.ScreenReader = {
|
|
74
|
+
/**
|
|
75
|
+
* Posts a navigation-aware announcement (calm mode).
|
|
76
|
+
* Waits for transitions to finish before speaking.
|
|
77
|
+
* Promise resolves when the announcement is actually fired.
|
|
78
|
+
*/
|
|
79
|
+
announce: (message, options) => announce(message, {
|
|
80
|
+
calm: true,
|
|
81
|
+
...options
|
|
82
|
+
}),
|
|
83
|
+
cancel,
|
|
84
|
+
cancelAll
|
|
27
85
|
};
|
|
28
86
|
//# sourceMappingURL=A11yAnnounceModule.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_reactNative","require","LINKING_ERROR","Platform","select","ios","
|
|
1
|
+
{"version":3,"names":["_reactNative","require","_NativeA11yAnnounceModule","_interopRequireDefault","e","__esModule","default","LINKING_ERROR","Platform","select","ios","isTurboModuleEnabled","global","__turboModuleProxy","A11yAnnounceNative","NativeA11yAnnounceModule","NativeModules","A11yAnnounceModule","A11yAnnounceProxy","Proxy","get","Error","announce","message","options","speech","rest","cancel","id","cancelAll","ScreenReader","exports","calm"],"sourceRoot":"../../../src","sources":["modules/A11yAnnounceModule.ts"],"mappings":";;;;;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AACA,IAAAC,yBAAA,GAAAC,sBAAA,CAAAF,OAAA;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