Skip to content

feat (Android): setTransitionDuration on Android#3698

Open
FilPag wants to merge 3 commits intosoftware-mansion:mainfrom
FilPag:main
Open

feat (Android): setTransitionDuration on Android#3698
FilPag wants to merge 3 commits intosoftware-mansion:mainfrom
FilPag:main

Conversation

@FilPag
Copy link
Copy Markdown

@FilPag FilPag commented Feb 26, 2026

Description

Closes #3694

On iOS, native-stack supports the animationDuration prop, allowing us to make transitions faster. However, on Android, this prop is ignored because the animations are hardcoded in native XML files within react-native-screens. This makes the App feel "laggy" or "unnecessarily heavy" compared to the iOS version or other high-performance native Android apps.

This PR exposes a property to control the transition duration for Android, allowing developers to set a shorter duration (e.g., 200ms instead of the default) to achieve a "snappier" feel.

Changes

  • Implemented transitionDuration prop on Android by wiring ScreenViewManager to Screen.kt and overriding onCreateAnimation in ScreenStackFragment to apply the custom duration
  • Changed sentinel default from 500 to -1 (unset) across Codegen specs and Paper delegate
  • Added duration picker to the Animations example screen
  • Updated public types to reflect Android support for transitionDuration

Before & after - visual documentation

Screen.Recording.2026-02-26.at.15.26.07.mov

Test plan

Added duration picker to the Animations example screen. Navigate to Animations example screen in FabricExample. Test the duration selector

Checklist

  • Included code example that can be used to test this change.
  • Updated / created local changelog entries in relevant test files.
  • For visual changes, included screenshots / GIFs / recordings documenting the change.
  • For API changes, updated relevant public types.
  • Ensured that CI passes

@FilPag FilPag changed the title feat: setTransitionDuration on Android feat (Android): setTransitionDuration on Android Feb 26, 2026
@FilPag
Copy link
Copy Markdown
Author

FilPag commented Mar 6, 2026

@kkafar Could you please request reviewers on my behalf. I'm unable to do so :)

@kkafar
Copy link
Copy Markdown
Member

kkafar commented Mar 7, 2026

Thanks for the tag here.

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 Android support for configuring native-stack transition duration by plumbing the transitionDuration prop into the Android screen implementation and providing an example UI to tweak durations at runtime.

Changes:

  • Switches the transitionDuration sentinel default to -1 (unset) in Fabric codegen specs and the Paper delegate.
  • Wires transitionDuration through ScreenViewManagerScreen and applies it during fragment animation creation.
  • Extends the Animations example screen with a transition duration picker (via React Navigation animationDuration).

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
src/fabric/ScreenNativeComponent.ts Updates codegen default for transitionDuration to -1 (unset).
src/fabric/ModalScreenNativeComponent.ts Updates codegen default for transitionDuration to -1 (unset).
apps/src/screens/Animations.tsx Adds UI controls to vary transition duration in the example app.
android/src/paper/java/com/facebook/react/viewmanagers/RNSScreenManagerDelegate.java Updates Paper delegate default for transitionDuration to -1.
android/src/main/java/com/swmansion/rnscreens/ScreenViewManager.kt Implements transitionDuration prop setter for Android screens.
android/src/main/java/com/swmansion/rnscreens/ScreenStackFragment.kt Overrides onCreateAnimation to apply custom duration when set.
android/src/main/java/com/swmansion/rnscreens/Screen.kt Adds transitionDuration field to the Android Screen view.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

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

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


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature Request: Allow customizing Android transition duration/interpolator in Native Stack

3 participants