Skip to content

Commit a373125

Browse files
committed
fix(ios): re-apply scroll edge interactions when header/footer size changes
When header or footer is initially empty and content loads later, edge interactions were never re-established after the initial setupScrollable call.
1 parent 444fe55 commit a373125

3 files changed

Lines changed: 21 additions & 1 deletion

File tree

ios/TrueSheetContainerView.mm

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ - (instancetype)init {
4343

4444
@end
4545

46-
@interface TrueSheetContainerView () <TrueSheetContentViewDelegate, TrueSheetHeaderViewDelegate>
46+
@interface TrueSheetContainerView () <TrueSheetContentViewDelegate, TrueSheetHeaderViewDelegate, TrueSheetFooterViewDelegate>
4747
@end
4848

4949
@implementation TrueSheetContainerView {
@@ -176,6 +176,7 @@ - (void)mountChildComponentView:(UIView<RCTComponentViewProtocol> *)childCompone
176176
return;
177177
}
178178
_footerView = (TrueSheetFooterView *)childComponentView;
179+
_footerView.delegate = self;
179180
}
180181
}
181182

@@ -192,6 +193,7 @@ - (void)unmountChildComponentView:(UIView<RCTComponentViewProtocol> *)childCompo
192193
}
193194

194195
if ([childComponentView isKindOfClass:[TrueSheetFooterView class]]) {
196+
_footerView.delegate = nil;
195197
_footerView = nil;
196198
}
197199

@@ -222,6 +224,17 @@ - (void)contentViewScrollViewDidChange {
222224

223225
- (void)headerViewDidChangeSize:(CGSize)newSize {
224226
[self.delegate containerViewHeaderDidChangeSize:newSize];
227+
if (@available(iOS 26.0, *)) {
228+
[self setupEdgeInteractions];
229+
}
230+
}
231+
232+
#pragma mark - TrueSheetFooterViewDelegate
233+
234+
- (void)footerViewDidChangeSize:(CGSize)newSize {
235+
if (@available(iOS 26.0, *)) {
236+
[self setupEdgeInteractions];
237+
}
225238
}
226239

227240
#pragma mark - Keyboard Observer

ios/TrueSheetFooterView.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,15 @@
1717

1818
NS_ASSUME_NONNULL_BEGIN
1919

20+
@protocol TrueSheetFooterViewDelegate <NSObject>
21+
@optional
22+
- (void)footerViewDidChangeSize:(CGSize)size;
23+
@end
24+
2025
@interface TrueSheetFooterView : RCTViewComponentView <TrueSheetKeyboardObserverDelegate>
2126

2227
@property (nonatomic, weak, nullable) TrueSheetKeyboardObserver *keyboardObserver;
28+
@property (nonatomic, weak, nullable) id<TrueSheetFooterViewDelegate> delegate;
2329

2430
- (void)setupConstraintsWithHeight:(CGFloat)height;
2531

ios/TrueSheetFooterView.mm

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ - (void)updateLayoutMetrics:(const facebook::react::LayoutMetrics &)layoutMetric
9292

9393
if (height != _lastHeight) {
9494
[self setupConstraintsWithHeight:height];
95+
[self.delegate footerViewDidChangeSize:CGSizeMake(layoutMetrics.frame.size.width, height)];
9596
}
9697
}
9798

0 commit comments

Comments
 (0)