Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(iOS): modal view flickering #1870

Merged
merged 15 commits into from
Nov 15, 2023
Prev Previous commit
Disable setting size on UIManager when presenting formSheet
kkafar committed Nov 15, 2023

Unverified

This commit is not signed, but one or more authors requires that any commit attributed to them is signed.
commit e12114b1fb0f3b08673cc5bc6c4be6744e4c726b
46 changes: 24 additions & 22 deletions ios/RNSScreen.mm
Original file line number Diff line number Diff line change
@@ -144,25 +144,27 @@ - (void)updateBounds
}
}
#else
// CAAnimation *sizeAnimation = [self.layer animationForKey:@"bounds.size"];
// if (sizeAnimation && self.layer.presentationLayer.bounds.size.height > self.bounds.size.height) {
// if (sizeAnimation && self.layer.presentationLayer.frame.size.height > self.bounds.size.height) {
// if (sizeAnimation) {
// CABasicAnimation *callbackOnlyAnimation = [CABasicAnimation new];
// callbackOnlyAnimation.duration = sizeAnimation.duration;
// callbackOnlyAnimation.beginTime = sizeAnimation.beginTime;
// callbackOnlyAnimation.delegate = self;
// NSLog(@"Adding animation");
// [self.layer addAnimation:callbackOnlyAnimation forKey:@"rns_sheet_animation"];
// CGRect bounds = self.layer.presentationLayer.bounds;
// NSLog(@"Sending (%f, %f) size to UIM (ANIM)", bounds.size.width, bounds.size.height);
//
// [_bridge.uiManager setSize:self.layer.presentationLayer.bounds.size forView:self];
// } else {
// NSLog(@"Sending (%f, %f) size to UIM", self.bounds.size.width, self.bounds.size.height);
// [_bridge.uiManager setSize:self.bounds.size forView:self];
// }
[_bridge.uiManager setSize:self.bounds.size forView:self];
if (self->_stackPresentation == RNSScreenStackPresentationFormSheet) {
return;
} else {
[_bridge.uiManager setSize:self.bounds.size forView:self];
}
// CAAnimation *sizeAnimation = [self.layer animationForKey:@"bounds.size"];
//// if (sizeAnimation && self.layer.presentationLayer.bounds.size.height > self.bounds.size.height) {
//// if (sizeAnimation && self.layer.presentationLayer.frame.size.height > self.bounds.size.height) {
// if (sizeAnimation) {
// CABasicAnimation *callbackOnlyAnimation = [CABasicAnimation new];
// callbackOnlyAnimation.duration = sizeAnimation.duration;
// callbackOnlyAnimation.beginTime = sizeAnimation.beginTime;
// callbackOnlyAnimation.delegate = self;
//// NSLog(@"Adding animation");
//// [self.layer addAnimation:callbackOnlyAnimation forKey:@"rns_sheet_animation"];
//// CGRect bounds = self.layer.presentationLayer.bounds;
//// NSLog(@"Sending (%f, %f) size to UIM (ANIM)", bounds.size.width, bounds.size.height);
// } else {
// NSLog(@"Sending (%f, %f) size to UIM", self.bounds.size.width, self.bounds.size.height);
//// [_bridge.uiManager setSize:self.bounds.size forView:self];
// }
#endif
}

@@ -172,9 +174,9 @@ - (void)animationDidStart:(CAAnimation *)animation

- (void)animationDidStop:(CAAnimation *)animation finished:(BOOL)finished
{
// if (finished) {
[self updateBounds];
// }
if (finished) {
[self updateBounds];
}
}

- (void)setStackPresentation:(RNSScreenStackPresentation)stackPresentation