@@ -22,6 +22,7 @@ @implementation TrueSheetFooterView {
2222 CGFloat _lastHeight;
2323 BOOL _didInitialLayout;
2424 NSLayoutConstraint *_bottomConstraint;
25+ CGFloat _currentKeyboardOffset;
2526}
2627
2728+ (ComponentDescriptorProvider)componentDescriptorProvider {
@@ -39,6 +40,7 @@ - (instancetype)initWithFrame:(CGRect)frame {
3940 _lastHeight = 0 ;
4041 _didInitialLayout = NO ;
4142 _bottomConstraint = nil ;
43+ _currentKeyboardOffset = 0 ;
4244 }
4345 return self;
4446}
@@ -59,8 +61,8 @@ - (void)setupConstraintsWithHeight:(CGFloat)height {
5961 [self .leadingAnchor constraintEqualToAnchor: parentView.leadingAnchor].active = YES ;
6062 [self .trailingAnchor constraintEqualToAnchor: parentView.trailingAnchor].active = YES ;
6163
62- // Store bottom constraint for keyboard adjustment
63- _bottomConstraint = [self .bottomAnchor constraintEqualToAnchor: parentView.bottomAnchor];
64+ // Store bottom constraint for keyboard adjustment, preserving current keyboard offset
65+ _bottomConstraint = [self .bottomAnchor constraintEqualToAnchor: parentView.bottomAnchor constant: -_currentKeyboardOffset ];
6466 _bottomConstraint.active = YES ;
6567
6668 // Apply height constraint
@@ -109,6 +111,7 @@ - (void)prepareForRecycle {
109111 _lastHeight = 0 ;
110112 _didInitialLayout = NO ;
111113 _bottomConstraint = nil ;
114+ _currentKeyboardOffset = 0 ;
112115}
113116
114117#pragma mark - Keyboard Handling
@@ -163,6 +166,9 @@ - (void)keyboardWillChangeFrame:(NSNotification *)notification {
163166 // Cap to ensure we don't go negative
164167 CGFloat bottomOffset = MAX (0 , keyboardHeight);
165168
169+ // Store the current keyboard offset so it persists through constraint recreation
170+ _currentKeyboardOffset = bottomOffset;
171+
166172 [UIView animateWithDuration: duration
167173 delay: 0
168174 options: curve | UIViewAnimationOptionBeginFromCurrentState
0 commit comments