Skip to content

Commit bf92612

Browse files
authored
fix(ios): blur flicker when dismissing sheet with backgroundBlur (#633)
* fix(ios): blur flicker when dismissing sheet with backgroundBlur Hide UIVisualEffectView at the end of dismiss transition to prevent flicker/flash at the bottom edge of the sheet. Fixes #614 * docs: add changelog entry for #633
1 parent 218581d commit bf92612

2 files changed

Lines changed: 9 additions & 0 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
### 🐛 Bug fixes
1212

13+
- **iOS**: Fixed blur flicker/flash at the bottom when dismissing sheet with `backgroundBlur` enabled. ([#633](https://github.com/lodev09/react-native-true-sheet/pull/633) by [@lodev09](https://github.com/lodev09))
1314
- **Android**: Fixed `NoSuchMethodError` crash on Android < 11 (API 30) when presenting a sheet with grabber accessibility. ([#606](https://github.com/lodev09/react-native-true-sheet/pull/606) by [@Mohamed-kassim](https://github.com/Mohamed-kassim))
1415
- **iOS**: Fixed keyboard scroll positioning when sheet auto-expands from a smaller detent. ([#592](https://github.com/lodev09/react-native-true-sheet/pull/592) by [@lodev09](https://github.com/lodev09))
1516
- **Android**: Fixed dead state after rapid present/dismiss cycles. ([#593](https://github.com/lodev09/react-native-true-sheet/pull/593) by [@lodev09](https://github.com/lodev09))

ios/TrueSheetViewController.mm

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,8 @@ - (void)viewDidLoad {
200200
- (void)viewWillAppear:(BOOL)animated {
201201
[super viewWillAppear:animated];
202202

203+
_blurView.alpha = 1;
204+
203205
if (!_isPresented) {
204206
UIViewController *presenter = self.presentingViewController;
205207
if ([presenter isKindOfClass:[TrueSheetViewController class]]) {
@@ -475,6 +477,12 @@ - (void)handleTransitionTracker {
475477
if (self.currentPosition >= self.screenHeight) {
476478
CGFloat position = fmax(_lastEmittedPositionState.position, layerPosition);
477479

480+
// Hide blur at the end of dismiss to prevent UIVisualEffectView
481+
// from causing a flicker/flash at the bottom edge of the sheet.
482+
if (self.screenHeight - position < 1) {
483+
_blurView.alpha = 0;
484+
}
485+
478486
[self emitWillDismissEvents];
479487
[self emitChangePositionDelegateWithPosition:position realtime:YES debug:@"transition out"];
480488

0 commit comments

Comments
 (0)