Skip to content

Commit

Permalink
[Merge 117] Scrolling between the initial and expand states is jumpy
Browse files Browse the repository at this point in the history
Issue for the payments bottom sheet was caused by recalculating the
initial height every time -viewIsAppearing is called.

Keeping track of the value and reusing it fixed this issue.

(cherry picked from commit 69ca772)

Bug: 1469913
Change-Id: I64941cc7dc80473c3dd8414e0aa091be5f50037b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4771062
Reviewed-by: Tommy Martino <tmartino@chromium.org>
Commit-Queue: Veronique Nguyen <veronguyen@google.com>
Code-Coverage: findit-for-me@appspot.gserviceaccount.com <findit-for-me@appspot.gserviceaccount.com>
Cr-Original-Commit-Position: refs/heads/main@{#1182618}
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4780552
Cr-Commit-Position: refs/branch-heads/5938@{chromium#152}
Cr-Branched-From: 2b50cb4-refs/heads/main@{#1181205}
  • Loading branch information
Veronique Nguyen authored and Chromium LUCI CQ committed Aug 15, 2023
1 parent e31abc5 commit cd5a093
Showing 1 changed file with 11 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,9 @@ @interface PaymentsSuggestionBottomSheetViewController () <
// YES if the expanded bottom sheet size takes the whole screen.
@property(nonatomic, assign) BOOL expandSizeTooLarge;

// Keep track of the minimized state height.
@property(nonatomic, assign) absl::optional<CGFloat> minimizedStateHeight;

@end

@implementation PaymentsSuggestionBottomSheetViewController
Expand Down Expand Up @@ -140,6 +143,7 @@ - (void)traitCollectionDidChange:(UITraitCollection*)previousTraitCollection {

if (self.traitCollection.preferredContentSizeCategory !=
previousTraitCollection.preferredContentSizeCategory) {
self.minimizedStateHeight = absl::nullopt;
[self updateHeight];
}
}
Expand All @@ -159,6 +163,13 @@ - (void)viewDidDisappear:(BOOL)animated {
[self.handler viewDidDisappear:animated];
}

- (CGFloat)initialHeight {
if (!self.minimizedStateHeight.has_value()) {
self.minimizedStateHeight = [super initialHeight];
}
return self.minimizedStateHeight.value();
}

#pragma mark - PaymentsSuggestionBottomSheetConsumer

- (void)setCreditCardData:
Expand Down

0 comments on commit cd5a093

Please sign in to comment.