Support Page Animations / Transitions on Android #209
Replies: 4 comments
-
Hey, Thanks for opening the issue.
I'm not sure if this is true. Android views animate when using "stack" navigation, but tabs don't have any animation defined. For example, in the Clock app in Android 14, they just immediately change. Can you point me to some Material design guidelines that describe this or show a native Android app that does this (without custom logic)? I'm not saying no to adding animations but it would be good to check what's the actual native behaviour. Also its worth noting that BottomNavigationView is responsible only for rendering the bottom bar, it doesn't encapsulate and manage views as SwiftUI's tab view does. |
Beta Was this translation helpful? Give feedback.
-
Hi, thanks for asking for clarification. I'm new to Open Source and software development in general, so it really helps to be asked these questions.
In Navigation bar page > Guidelines > Behavior, the docs state:
Unfortunately, the link they provided is broken lol, but its supposed to link to Top Level header under Transitions Patterns page, which states:
That is what is described by the M3 docs.
You can prove this transition animations are default behavior for
Tested on Android Studio version With these reasons in mind, I believe that navigating between bottom tabs should play page animations by default.
You're right. I'm not sure what's the best way of handling this. From what I understand, NavigationBarView has the setupWithNavController method, which wraps around NavigationUI's setupWithNavController. It seems like NavigationUI is responsible for handling navigating as well as animation transition logic, which can be seen in But since it is What are your thoughts? |
Beta Was this translation helpful? Give feedback.
-
Thanks for providing additional details! Indeed when you create a new app from This should be a fairly simple change where we do a small fade animation when the view changes. |
Beta Was this translation helpful? Give feedback.
-
I'm moving this to discussions because all feature requests will now be under the "Ideas 💡" tab in GitHub discussions. |
Beta Was this translation helpful? Give feedback.
-
Problem
By default,
BottomNavigationView
should animate when navigating. The default animations can be found here, and their default durations here.This GitHub issue showed me how to configure the page animation of
BottomNavigationView
. Configuringres/animator/
in a Native Android app works, but not withreact-native-bottom-tabs
. Presumably, this is becausereact-native-screens
handles navigation and their animations.Proposed Solution
The way
react-native-screens
handles stack animation on navigation can be found here. It's technically native, but they are hand-rolling their own navigation, which is why there are some inconsistencies from native default. Nonetheless, if we want to go the full native approach like SwiftUI UIView (@react-navigation/bottom-tabs
uses RN Animated for page animations), I think this is the place to start.Currently, I'm not sure how
react-native-bottom-tabs
can tap intoreact-native-screen
's animations. A look into howreact-navigation
implements Native Stack might be helpful. Though it seems like the API is unstable at the moment.Beta Was this translation helpful? Give feedback.
All reactions