Skip to content

fix(Android, FormSheet v5): Prevent translation to be overridden by doOnStart callback - #4581

Open
t0maboro wants to merge 1 commit into
mainfrom
@t0maboro/fix-sheet-entering-with-disabled-animations
Open

fix(Android, FormSheet v5): Prevent translation to be overridden by doOnStart callback#4581
t0maboro wants to merge 1 commit into
mainfrom
@t0maboro/fix-sheet-entering-with-disabled-animations

Conversation

@t0maboro

@t0maboro t0maboro commented Sep 2, 2026

Copy link
Copy Markdown
Member

Description

With system animations disabled, the FormSheet stayed off-screen. The root cause was the doOnStart listener attached to the entering AnimatorSet. It relied on start listeners running before the child animators produce any value, which is not the case when the duration scale is 0.

// android.animation.AnimatorSet#start(boolean inReverse, boolean selfPulse)
boolean isEmptySet = isEmptySet(this);
if (!isEmptySet) {
  startAnimation();
}
notifyStartListeners(inReverse);

startAnimation pulses every child, but with a zero duration, ValueAnimator treats the animator as already finished, so the children synchronously apply their end values. After that, notifyStartListeners runs our doOnStart, which moves the sheet back to translationY = height.

The listener is also redundant. The keepOffscreenUntilEnterAnimation applies translationY in the first pre-draw of the sheet, i.e. before OnShowListener starts the animator.

Closes: https://github.com/software-mansion/react-native-screens-labs/issues/1764

Changes

  • removed the doOnStart listener that re-applied the translation

Before & after - visual documentation

Before After
before.mov
after.mov

Test plan

Disable animations in device settings, launch any FormSheet v5 example.

Checklist

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

@coderabbitai

coderabbitai Bot commented Sep 2, 2026

Copy link
Copy Markdown

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Team

Run ID: 0b705690-8e30-4665-b123-c5c71ffee42f

📥 Commits

Reviewing files that changed from the base of the PR and between 2cc07a9 and 0bc0c49.

📒 Files selected for processing (1)
  • android/src/main/java/com/swmansion/rnscreens/modals/formsheet/native/presentation/FormSheetAnimatorFactory.kt
💤 Files with no reviewable changes (1)
  • android/src/main/java/com/swmansion/rnscreens/modals/formsheet/native/presentation/FormSheetAnimatorFactory.kt

Included review availability: Your plan provides up to 8 included reviews per hour; 7 remain after this review.


📝 Walkthrough

Walkthrough

The form sheet animator removes the unused doOnStart import and the callback that set the view's initial Y translation.

Changes

Cohort / File(s) Summary
Form sheet animation
android/src/main/java/com/swmansion/rnscreens/modals/formsheet/native/presentation/FormSheetAnimatorFactory.kt
Removes the doOnStart import and the enter-animation start callback.

Estimated code review effort: 1 (Trivial) | ~2 minutes

Merge Risk: ⚪ Minimal · up to 0bc0c

This narrowly removes a redundant callback that could restore the sheet’s off-screen translation when system animations are disabled. No actionable merge-blocking risk remains beyond normal checks and review.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 0…
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly identifies the Android FormSheet v5 fix and the doOnStart callback as the cause of the translation issue.
Description check ✅ Passed The description explains the zero-duration animation issue, the removed listener, the existing replacement logic, and the test plan. It is directly related to the changeset.
Full details: Docstring Coverage

Explanation

No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 0 files.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

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.

1 participant