@lodev09/react-native-true-sheet 3.11.0-beta.12 → 3.11.0-beta.13
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.
|
@@ -72,10 +72,27 @@ using namespace facebook::react;
|
|
|
72
72
|
_headerView = nil;
|
|
73
73
|
_footerView = nil;
|
|
74
74
|
_scrollableSet = NO;
|
|
75
|
+
self.isAccessibilityElement = NO;
|
|
75
76
|
}
|
|
76
77
|
return self;
|
|
77
78
|
}
|
|
78
79
|
|
|
80
|
+
#pragma mark - Accessibility
|
|
81
|
+
|
|
82
|
+
- (NSArray *)accessibilityElements {
|
|
83
|
+
NSMutableArray *elements = [NSMutableArray array];
|
|
84
|
+
if (_headerView) {
|
|
85
|
+
[elements addObject:_headerView];
|
|
86
|
+
}
|
|
87
|
+
if (_contentView) {
|
|
88
|
+
[elements addObject:_contentView];
|
|
89
|
+
}
|
|
90
|
+
if (_footerView) {
|
|
91
|
+
[elements addObject:_footerView];
|
|
92
|
+
}
|
|
93
|
+
return elements;
|
|
94
|
+
}
|
|
95
|
+
|
|
79
96
|
#pragma mark - Layout
|
|
80
97
|
|
|
81
98
|
- (void)layoutSubviews {
|
|
@@ -37,6 +37,7 @@ using namespace facebook::react;
|
|
|
37
37
|
_props = defaultProps;
|
|
38
38
|
|
|
39
39
|
self.backgroundColor = [UIColor clearColor];
|
|
40
|
+
self.isAccessibilityElement = NO;
|
|
40
41
|
|
|
41
42
|
_lastHeight = 0;
|
|
42
43
|
_pendingHeight = 0;
|
|
@@ -47,6 +48,24 @@ using namespace facebook::react;
|
|
|
47
48
|
return self;
|
|
48
49
|
}
|
|
49
50
|
|
|
51
|
+
#pragma mark - Accessibility
|
|
52
|
+
|
|
53
|
+
- (NSArray *)accessibilityElements {
|
|
54
|
+
NSMutableArray *elements = [NSMutableArray array];
|
|
55
|
+
[self collectAccessibilityElementsFromView:self into:elements];
|
|
56
|
+
return elements;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
- (void)collectAccessibilityElementsFromView:(UIView *)view into:(NSMutableArray *)elements {
|
|
60
|
+
for (UIView *subview in view.subviews) {
|
|
61
|
+
if (subview.isAccessibilityElement || subview.accessibilityLabel || subview.accessibilityIdentifier) {
|
|
62
|
+
[elements addObject:subview];
|
|
63
|
+
} else {
|
|
64
|
+
[self collectAccessibilityElementsFromView:subview into:elements];
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
|
|
50
69
|
#pragma mark - Layout
|
|
51
70
|
|
|
52
71
|
- (void)setupConstraintsWithHeight:(CGFloat)height {
|
package/ios/TrueSheetView.mm
CHANGED
|
@@ -373,6 +373,9 @@ using namespace facebook::react;
|
|
|
373
373
|
[_controller.view addSubview:_containerView];
|
|
374
374
|
[LayoutUtil pinView:_containerView toParentView:_controller.view edges:UIRectEdgeAll];
|
|
375
375
|
[_controller.view bringSubviewToFront:_containerView];
|
|
376
|
+
_containerView.accessibilityViewIsModal = YES;
|
|
377
|
+
_controller.accessibilityContentView = _containerView;
|
|
378
|
+
[_controller setupAccessibilityContainer];
|
|
376
379
|
|
|
377
380
|
CGFloat contentHeight = [_containerView contentHeight];
|
|
378
381
|
if (contentHeight > 0) {
|
|
@@ -75,9 +75,11 @@ NS_ASSUME_NONNULL_BEGIN
|
|
|
75
75
|
@property (nonatomic, assign) BOOL isPresented;
|
|
76
76
|
@property (nonatomic, assign) NSInteger activeDetentIndex;
|
|
77
77
|
@property (nonatomic, readonly) BOOL isTopmostPresentedController;
|
|
78
|
+
@property (nonatomic, weak, nullable) UIView *accessibilityContentView;
|
|
78
79
|
|
|
79
80
|
@property (nonatomic, readonly) CGFloat screenHeight;
|
|
80
81
|
|
|
82
|
+
- (void)setupAccessibilityContainer;
|
|
81
83
|
- (void)applyActiveDetent;
|
|
82
84
|
- (void)setupActiveDetentWithIndex:(NSInteger)index;
|
|
83
85
|
- (void)resizeToDetentIndex:(NSInteger)index;
|
|
@@ -34,6 +34,8 @@ static BOOL TrueSheetPositionStateEquals(TrueSheetPositionState a, TrueSheetPosi
|
|
|
34
34
|
|
|
35
35
|
@interface TrueSheetViewController ()
|
|
36
36
|
|
|
37
|
+
- (void)setAccessibilityContentElement:(UIView *)contentView;
|
|
38
|
+
|
|
37
39
|
@end
|
|
38
40
|
|
|
39
41
|
@implementation TrueSheetViewController {
|
|
@@ -207,6 +209,7 @@ static BOOL TrueSheetPositionStateEquals(TrueSheetPositionState a, TrueSheetPosi
|
|
|
207
209
|
if ([presenter isKindOfClass:[TrueSheetViewController class]]) {
|
|
208
210
|
_parentSheetController = (TrueSheetViewController *)presenter;
|
|
209
211
|
[_parentSheetController.delegate viewControllerWillBlur];
|
|
212
|
+
[_parentSheetController setAccessibilityContentElement:self.accessibilityContentView ?: self.view];
|
|
210
213
|
}
|
|
211
214
|
|
|
212
215
|
dispatch_async(dispatch_get_main_queue(), ^{
|
|
@@ -241,10 +244,33 @@ static BOOL TrueSheetPositionStateEquals(TrueSheetPositionState a, TrueSheetPosi
|
|
|
241
244
|
});
|
|
242
245
|
|
|
243
246
|
[self setupGestureRecognizer];
|
|
247
|
+
[self setupAccessibilityContainer];
|
|
244
248
|
_isPresented = YES;
|
|
245
249
|
}
|
|
246
250
|
}
|
|
247
251
|
|
|
252
|
+
- (void)setupAccessibilityContainer {
|
|
253
|
+
UIView *contentView = self.accessibilityContentView;
|
|
254
|
+
if (!contentView) {
|
|
255
|
+
return;
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
[self setAccessibilityContentElement:contentView];
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
- (void)setAccessibilityContentElement:(UIView *)contentView {
|
|
262
|
+
self.view.isAccessibilityElement = NO;
|
|
263
|
+
self.view.accessibilityViewIsModal = YES;
|
|
264
|
+
self.view.accessibilityElements = @[ contentView ];
|
|
265
|
+
|
|
266
|
+
UIView *presentedView = self.presentationController.presentedView;
|
|
267
|
+
if (presentedView) {
|
|
268
|
+
presentedView.isAccessibilityElement = NO;
|
|
269
|
+
presentedView.accessibilityViewIsModal = YES;
|
|
270
|
+
presentedView.accessibilityElements = @[ contentView ];
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
|
|
248
274
|
- (void)emitWillDismissEvents {
|
|
249
275
|
if (self.isBeingDismissed && !_isWillDismissEmitted) {
|
|
250
276
|
_isWillDismissEmitted = YES;
|
|
@@ -264,6 +290,7 @@ static BOOL TrueSheetPositionStateEquals(TrueSheetPositionState a, TrueSheetPosi
|
|
|
264
290
|
_anchorView = nil;
|
|
265
291
|
|
|
266
292
|
[_parentSheetController.delegate viewControllerDidFocus];
|
|
293
|
+
[_parentSheetController setupAccessibilityContainer];
|
|
267
294
|
_parentSheetController = nil;
|
|
268
295
|
|
|
269
296
|
[self.delegate viewControllerDidBlur];
|
package/package.json
CHANGED