Skip to content

chore: bottom tabs hiding animation#12249

Merged
MounirDhahri merged 5 commits intomainfrom
chore/bottom-tabs-hiding-animation
Jun 18, 2025
Merged

chore: bottom tabs hiding animation#12249
MounirDhahri merged 5 commits intomainfrom
chore/bottom-tabs-hiding-animation

Conversation

@MounirDhahri
Copy link
Copy Markdown
Member

@MounirDhahri MounirDhahri commented Jun 11, 2025

Description

This PR allows us to animate the appearance of the bottom tab. This is unfortunately something that react-navigation doesn't support yet, it however is a behaviour that is available in most apps and is quick to implement on the native side.

This helps us making transition between screens smoother and makes our experiene closer to a native experience.

Before

screen-20250611-125808.mp4


After

Android iOS
screen-20250618-150023.mp4
ScreenRecording_06-18-2025.15-00-34_1.MP4

PR Checklist

  • I have tested my changes on the following platforms:
    • Android.
    • iOS.
  • I hid my changes behind a feature flag, or they don't need one.
  • I have included screenshots or videos at least on Android, or I have not changed the UI.
  • I have added tests, or my changes don't require any.
  • I added an app state migration, or my changes do not require one.
  • I have documented any follow-up work that this PR will require, or it does not require any.
  • I have added a changelog entry below, or my changes do not require one.

To the reviewers 👀

  • I would like at least one of the reviewers to run this PR on the simulator or device.
Changelog updates

Changelog updates

Cross-platform user-facing changes

  • animate bottom tabs appearance/disappearance - mounir

iOS user-facing changes

Android user-facing changes

Dev changes

Need help with something? Have a look at our docs, or get in touch with us.

@MounirDhahri MounirDhahri self-assigned this Jun 11, 2025
@ArtsyOpenSource
Copy link
Copy Markdown
Contributor

ArtsyOpenSource commented Jun 11, 2025

This PR contains the following changes:

  • Cross-platform user-facing changes (animate bottom tabs appearance/disappearance - mounir - MounirDhahri)

Generated by 🚫 dangerJS against 6d6f238

@MounirDhahri MounirDhahri force-pushed the chore/bottom-tabs-hiding-animation branch from 8b38dc3 to 1bc80e8 Compare June 18, 2025 13:09
Comment on lines +40 to +42
# reset changes made to app.json
git checkout app.json
git checkout dist/.gitkeep
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These are pretty annoying because they often slip from me and get pushed. I see no harm in reverting their value after creating a beta. What do you think?
Screenshot 2025-06-18 at 14 41 56

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

makes sense

@MounirDhahri MounirDhahri force-pushed the chore/bottom-tabs-hiding-animation branch from 1bc80e8 to 8420870 Compare June 18, 2025 13:11
Comment on lines +115 to +116
duration: TAB_BAR_ANIMATION_DURATION,
easing: Easing.inOut(Easing.ease),
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I played a lot with these value and I think this looks good. I am open to opinions as well once you try this on device

@MounirDhahri MounirDhahri requested a review from Copilot June 18, 2025 13:21
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Adds native-like show/hide animations for the bottom tab bar by extending React Navigation’s capabilities and wiring up animated padding in screen wrappers.

  • Introduce tabBarVisible and tabBarVisibilityAnimationConfig to the bottom tabs navigator
  • Define a shared TAB_BAR_ANIMATION_DURATION and use Easing for consistent timing
  • Replace static padding in ScreenWrapper with a Reanimated-driven animated view
  • Reset app.json and dist/.gitkeep after Expo updates deployments
  • Patch React Navigation bottom-tabs package to respect the new tabBarVisible option

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
src/app/Navigation/AuthenticatedRoutes/Tabs.tsx Adds animation props (tabBarVisible, tabBarVisibilityAnimationConfig) and exports animation duration constant
src/app/Navigation/AuthenticatedRoutes/StackNavigator.tsx Switches wrapper from Flex to Animated.View with withTiming for padding adjustments
scripts/deploys/expo-updates/deploy-to-expo-updates Resets local changes to app.json and dist/.gitkeep after deployment
patches/@react-navigation+bottom-tabs+7.3.3.patch Extends bottom-tabs internals to read and act on the new tabBarVisible flag
Comments suppressed due to low confidence (2)

src/app/Navigation/AuthenticatedRoutes/Tabs.tsx:111

  • No tests cover the new tab bar visibility animation logic. Please add unit or integration tests that verify the hidesBottomTabs option triggers the expected show/hide behavior.
          tabBarVisibilityAnimationConfig: {

src/app/Navigation/AuthenticatedRoutes/Tabs.tsx:110

  • [nitpick] The prop name tabBarVisible is inverted (true means hidden). Consider renaming the flag or inverting the assignment to make its meaning clearer for future maintenance.
          tabBarVisible: hidesBottomTabs,

style={{
paddingBottom: hidesBottomTabs ? 0 : tabBarHeight,
flex: 1,
paddingBottom: withTiming(hidesBottomTabs ? 0 : tabBarHeight, {
Copy link

Copilot AI Jun 18, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Directly using withTiming inside the style prop may not animate as intended. Consider using a shared value (useSharedValue) and useAnimatedStyle to drive paddingBottom animations in Reanimated v2.

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this isn't a valid concern here but it's a good idea to use useAnimatedStyle

Comment on lines +40 to +42
# reset changes made to app.json
git checkout app.json
git checkout dist/.gitkeep
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

makes sense

style={{
paddingBottom: hidesBottomTabs ? 0 : tabBarHeight,
}}
<Animated.View
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

question: if I remember correctly a while ago we decided to go with Moti instead of reanimated for this kind of transitions - did you try with Moti and it didn't work?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that's a good point - I will update

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmm something didn't go well with that, let me try it separately to fix main

gkartalis
gkartalis previously approved these changes Jun 18, 2025
Copy link
Copy Markdown
Member

@gkartalis gkartalis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looking great! Thanks! Left a question around reanimated vs moti but other than that thanks for making this smoother!

Comment thread HACKS.md

Expo updates was not returning the reason an update failed to be available on iOS making debugging difficult.

## patch-package for react-navigation/bottom-tabs
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🙏

MrSltun
MrSltun previously approved these changes Jun 18, 2025
@MounirDhahri MounirDhahri dismissed stale reviews from MrSltun and gkartalis via c220c4a June 18, 2025 16:35
@MounirDhahri MounirDhahri merged commit 3336a30 into main Jun 18, 2025
0 of 4 checks passed
@MounirDhahri MounirDhahri deleted the chore/bottom-tabs-hiding-animation branch June 18, 2025 16:36
@MounirDhahri MounirDhahri mentioned this pull request Jun 20, 2025
10 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants