@lodev09/react-native-true-sheet 3.11.0-beta.14 → 3.11.0-beta.15
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.
|
@@ -308,14 +308,25 @@ static char TrueSheetAccessibilityWindowPreviousElementsKey;
|
|
|
308
308
|
}
|
|
309
309
|
|
|
310
310
|
- (void)setAccessibilityContentElement:(UIView *)contentView {
|
|
311
|
-
NSArray *contentElements = contentView.accessibilityElements;
|
|
312
|
-
NSArray *accessibilityElements = contentElements.count > 0 ? contentElements : @[ contentView ];
|
|
313
311
|
BOOL hasAccessibilityFooterElements = [contentView isKindOfClass:[TrueSheetContainerView class]] &&
|
|
314
312
|
[(TrueSheetContainerView *)contentView hasAccessibilityFooterElements];
|
|
315
313
|
// Footer controls exposed as separate accessibility elements can be skipped
|
|
316
314
|
// by XCTest when the presented sheet is a hard modal accessibility boundary.
|
|
317
315
|
BOOL isAccessibilityModal = _dimmed && !hasAccessibilityFooterElements;
|
|
318
316
|
|
|
317
|
+
// At a hard modal boundary XCTest skips nested elements, so flatten the
|
|
318
|
+
// container's children into the array. Otherwise expose the container itself:
|
|
319
|
+
// its accessibilityElements getter recomputes live, so a footer/content subtree
|
|
320
|
+
// that remounts (e.g. swapping a footer button on a state change) stays
|
|
321
|
+
// discoverable instead of leaving this snapshot pointing at destroyed views.
|
|
322
|
+
NSArray *accessibilityElements;
|
|
323
|
+
if (isAccessibilityModal) {
|
|
324
|
+
NSArray *contentElements = contentView.accessibilityElements;
|
|
325
|
+
accessibilityElements = contentElements.count > 0 ? contentElements : @[ contentView ];
|
|
326
|
+
} else {
|
|
327
|
+
accessibilityElements = @[ contentView ];
|
|
328
|
+
}
|
|
329
|
+
|
|
319
330
|
self.view.isAccessibilityElement = NO;
|
|
320
331
|
self.view.accessibilityViewIsModal = YES;
|
|
321
332
|
self.view.accessibilityElements = accessibilityElements;
|
|
@@ -349,6 +360,37 @@ static char TrueSheetAccessibilityWindowPreviousElementsKey;
|
|
|
349
360
|
[self restoreWindowAccessibilityElements];
|
|
350
361
|
}
|
|
351
362
|
|
|
363
|
+
#pragma mark - Presentation
|
|
364
|
+
|
|
365
|
+
- (void)presentViewController:(UIViewController *)viewControllerToPresent
|
|
366
|
+
animated:(BOOL)flag
|
|
367
|
+
completion:(void (^)(void))completion {
|
|
368
|
+
// A non-sheet controller (e.g. an action sheet, alert, or image picker) is about
|
|
369
|
+
// to present over us. Clear our window accessibility override so UIKit's default
|
|
370
|
+
// traversal surfaces it for XCTest and assistive technologies; we reclaim the
|
|
371
|
+
// override when it dismisses. Nested sheets claim their own override.
|
|
372
|
+
if (![viewControllerToPresent isKindOfClass:[TrueSheetViewController class]]) {
|
|
373
|
+
self.view.window.accessibilityElements = nil;
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
[super presentViewController:viewControllerToPresent animated:flag completion:completion];
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
- (void)dismissViewControllerAnimated:(BOOL)flag completion:(void (^)(void))completion {
|
|
380
|
+
[super dismissViewControllerAnimated:flag
|
|
381
|
+
completion:^{
|
|
382
|
+
if (completion) {
|
|
383
|
+
completion();
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
// Reclaim the window accessibility override once nothing
|
|
387
|
+
// else is presented over us.
|
|
388
|
+
if (self.isPresented && self.presentedViewController == nil) {
|
|
389
|
+
[self setupAccessibilityContainer];
|
|
390
|
+
}
|
|
391
|
+
}];
|
|
392
|
+
}
|
|
393
|
+
|
|
352
394
|
- (void)emitWillDismissEvents {
|
|
353
395
|
if (self.isBeingDismissed && !_isWillDismissEmitted) {
|
|
354
396
|
_isWillDismissEmitted = YES;
|
package/package.json
CHANGED