fix(ios): default contentInsetAdjustmentBehavior to scrollableAxes on iOS 26+#57300
fix(ios): default contentInsetAdjustmentBehavior to scrollableAxes on iOS 26+#57300IsaacIsrael wants to merge 3 commits into
Conversation
… iOS 26+ On iOS 26+, Apple introduced the liquid glass design language with translucent system chrome (tab bars, toolbars). Scroll views need contentInsetAdjustmentBehavior set to scrollableAxes to automatically adjust content insets for this translucent chrome. This change upgrades the default from "never" to "scrollableAxes" on iOS 26+ when UIDesignRequiresCompatibility is not YES, affecting: - RCTEnhancedScrollView initWithFrame: - RCTScrollViewComponentView updateProps: (upgrades JS default "never") - RCTScrollViewComponentView prepareForRecycle Apps that explicitly set contentInsetAdjustmentBehavior to "automatic", "always", or "scrollableAxes" from JS are unaffected. Apps with UIDesignRequiresCompatibility=YES retain the current "never" default. Fixes react#57299 Co-authored-by: Cursor <cursoragent@cursor.com>
| auto contentInsetAdjustmentBehavior = newScrollViewProps.contentInsetAdjustmentBehavior; | ||
| if (@available(iOS 26, *)) { | ||
| NSNumber *compat = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"UIDesignRequiresCompatibility"]; | ||
| if (!compat.boolValue && contentInsetAdjustmentBehavior == ContentInsetAdjustmentBehavior::Never) { |
There was a problem hiding this comment.
On iOS 26 without UIDesignRequiresCompatibility, this upgrades Never to ScrollableAxes whenever the value is Never. The prop arrives as Never both for the RN default and when a developer explicitly sets contentInsetAdjustmentBehavior="never", so this overrides an explicit "never" too.
The effect is that there is no per-view way to keep never on iOS 26 now, just the app-wide UIDesignRequiresCompatibility opt-out.
Is overriding an explicit "never" intended? If someone wants no inset adjustment on a specific scroll view on iOS 26, how would they express it? The prop does not seem to carry whether the value was explicit, so maybe there is no clean per-view fix. Wanted to check the intent.
There was a problem hiding this comment.
Good point, you're right. contentInsetAdjustmentBehavior is a plain enum that defaults to Never, and the parser maps an explicit "never" to that same Never, so by the time it reaches updateProps, there's no way to tell "developer set never" from "developer set nothing". So yeah, the current patch overrides an explicit never too, which isn't what we want.
I'll change the approach: make contentInsetAdjustmentBehavior a std::optional<ContentInsetAdjustmentBehavior> (nullopt = not set by the developer). The iOS 26 scrollableAxes default then only kicks in when it's nullopt, and an explicit "never" is preserved per view. maintainVisibleContentPosition in the same props struct is already optional, so this keeps the pattern consistent.
Let me push that and I'll re-request your review.
…ve explicit never Addresses review feedback: the prop was a non-optional enum defaulting to Never, so an explicit JS "never" was indistinguishable from the default and got upgraded to scrollableAxes on iOS 26 too. Make contentInsetAdjustmentBehavior a std::optional<ContentInsetAdjustmentBehavior> (nullopt = not set from JS). The iOS 26 liquid-glass default (scrollableAxes, unless UIDesignRequiresCompatibility) is applied only when the prop is unset, via a shared RCTDefaultContentInsetAdjustmentBehavior() helper used in initWithFrame:, updateProps:, and prepareForRecycle. An explicit value from JS - including "never" - is always honored, restoring a per-view opt-out. Co-authored-by: Cursor <cursoragent@cursor.com>
…havior Co-authored-by: Cursor <cursoragent@cursor.com>
|
@fabriziocucci has imported this pull request. If you are a Meta employee, you can view this in D109568371. |
|
Sorry @IsaacIsrael, I might have steered you in the wrong direction with the comment above. I bootstrapped a small repro on an iOS 26.2 simulator to check the common case: a full height With
It does not regress every layout. If the The thing I keep coming back to: any app that wants this can already set So my vote would be to keep I'll double-check this internally. |
|
Hey @fabriziocucci, thanks for the feedback. No worries at all, I understand the issue, and your suggestion makes perfect sense. But if we use The only real benefit I see from this PR is the convenience of not having to set |

Summary
On iOS 26+, Apple introduced the liquid glass design language with translucent system chrome (tab bars, toolbars, navigation bars). For scroll views to properly adjust their content to account for this translucent chrome,
contentInsetAdjustmentBehaviorshould default toUIScrollViewContentInsetAdjustmentScrollableAxesinstead ofUIScrollViewContentInsetAdjustmentNever.This PR upgrades the default on iOS 26+ when
UIDesignRequiresCompatibilityis notYESin Info.plist, in three places:RCTEnhancedScrollView.mminitWithFrame:— defaults toscrollableAxesinstead ofneverRCTScrollViewComponentView.mmupdateProps:— upgrades incoming JS defaultnevertoscrollableAxesRCTScrollViewComponentView.mmprepareForRecycle— resets toscrollableAxesinstead ofneverBehavior Matrix
never(unchanged)YESnever(unchanged)NOor absentscrollableAxes(new)Apps that explicitly set
contentInsetAdjustmentBehaviorto"automatic","always", or"scrollableAxes"from JS are unaffected.Changelog:
[IOS] [FIXED] - Default
contentInsetAdjustmentBehaviortoscrollableAxeson iOS 26+ for liquid glass translucent chrome supportTest Plan:
UIDesignRequiresCompatibilityfrom Info.plist (or set toNO)FlatListinside a screen with a translucent bottom tab bar (drawBehind: true)neverdefault)UIDesignRequiresCompatibility = YESkeepsneverdefault on iOS 26+Fixes #57299