From 61a834e5f4e1762c8efd48013ef1e57090279478 Mon Sep 17 00:00:00 2001 From: eadron Date: Thu, 15 Jan 2026 11:04:00 -0800 Subject: [PATCH] Adjust content inset behavior for macOS Fix content inset adjustments for macOS ScrollView. --- .../ComponentViews/ScrollView/RCTEnhancedScrollView.mm | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/packages/react-native/React/Fabric/Mounting/ComponentViews/ScrollView/RCTEnhancedScrollView.mm b/packages/react-native/React/Fabric/Mounting/ComponentViews/ScrollView/RCTEnhancedScrollView.mm index a7bc9c5b442569..949daf661f41cd 100644 --- a/packages/react-native/React/Fabric/Mounting/ComponentViews/ScrollView/RCTEnhancedScrollView.mm +++ b/packages/react-native/React/Fabric/Mounting/ComponentViews/ScrollView/RCTEnhancedScrollView.mm @@ -41,6 +41,12 @@ - (instancetype)initWithFrame:(CGRect)frame // because this attribute affects a position of vertical scrollbar; we don't want this // scrollbar flip because we also flip it with whole `UIScrollView` flip. self.semanticContentAttribute = UISemanticContentAttributeForceLeftToRight; +#else // [macOS + // Similar to iOS's contentInsetAdjustmentBehavior fix + // For example: When using NSWindowStyleMaskFullSizeContentView (hidden title bar) and ScrollView as root, + // NSScrollView.automaticallyAdjustsContentInsets (default YES) adds contentInset.top to push content below the toolbar. + // However, React Native doesn't know about this native contentInset adjustments,causing some caltulation issues + self.automaticallyAdjustsContentInsets = NO; #endif // [macOS] __weak __typeof(self) weakSelf = self;