Feature Request: Animate header bar button items transitions (setRightBarButtonItems:animated:) #3819
aledebla03
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Summary
When dynamically showing/hiding header bar button items (e.g. via the
hiddenprop from expo-router'sStack.Toolbar.Button), the transition is instant with no animation. This is becauseRNSScreenStackHeaderConfigassignsnavitem.rightBarButtonItemsandnavitem.leftBarButtonItemsdirectly, rather than using UIKit's animated setter.Current behavior
In
RNSScreenStackHeaderConfig.mm(lines 809–812):Direct property assignment does not trigger any UIKit animation when items are added or removed.
Expected behavior
Use UIKit's animated setter, which is already available:
The
animatedparameter is already available in the method signature ofupdateViewController:withConfig:animated:— it just needs to be forwarded.This would make bar button items fade in/out smoothly when dynamically shown or hidden, consistent with native UIKit behavior.
Precedent in the codebase
Interestingly, expo-router already does this correctly for bottom toolbar items in
RouterToolbarHostView.swift:The bottom toolbar animates item changes, but the header toolbar does not — this inconsistency suggests it was an oversight rather than a deliberate choice.
Use case
Common pattern: a header button that appears/disappears based on state (e.g. a "Today" button that hides when the current week is selected). With expo-router's
Stack.Toolbar.Button hidden={condition}, the item pops in/out instantly instead of fading smoothly.This is especially noticeable with iOS 26 Liquid Glass headers where native animations are expected.
Environment
Beta Was this translation helpful? Give feedback.
All reactions