Skip to content

v0.2.0: correctness fixes + reanimated v4 compatibility#2

Draft
mayrang wants to merge 25 commits into
mainfrom
feat/v0.2.0-correctness-and-v4-compat
Draft

v0.2.0: correctness fixes + reanimated v4 compatibility#2
mayrang wants to merge 25 commits into
mainfrom
feat/v0.2.0-correctness-and-v4-compat

Conversation

@mayrang

@mayrang mayrang commented May 25, 2026

Copy link
Copy Markdown
Owner

Summary

Five correctness fixes in useAnimation and Reanimated v4 compatibility, while keeping the declarative API surface intact.

Correctness fixes

  • Inline animations no longer re-runs on parent re-render. The hook now holds animations in a ref; the effect depends only on trigger and animateOnMount.
  • onComplete is driven by Reanimated's UI-thread callback instead of a JS setTimeout, eliminating drift under JS load.
  • enter / exit config selection deep-merges with the base configenter: { config: { damping: 20 } } no longer clobbers baseConfig.config.stiffness.
  • mergeOverrides (used by usePresetAnimation overrides) got the same deep-merge fix.
  • pause()stop() rename. pause() is preserved as a deprecated alias with a one-time warning.

Reanimated v4 compatibility

  • Peer dep tightened to ^3.0.0 || ^4.0.0.
  • SpringConfig.energyThreshold added; restDisplacementThreshold / restSpeedThreshold marked @deprecated.
  • runOnJS funneled through src/internal/schedule.ts for a future one-line migration to react-native-worklets.
  • README now has a compatibility table, v0.1 → v0.2 migration callout, and a v4 babel setup section.

Other

  • Keyframe.delay marked @deprecated (was never honored at runtime).
  • CHANGELOG.md added (Keep a Changelog format).
  • Test infra: shared Reanimated mock at __tests__/__mocks__/reanimated.ts.

Design spec: `docs/superpowers/specs/2026-05-26-v0.2.0-design.md`
Implementation plan: `docs/superpowers/plans/2026-05-26-v0.2.0-implementation.md`

Test Plan

  • `npm test` — 27/27 passing across 4 suites
  • `npx tsc --noEmit` — clean
  • `npm run build` — `lib/` regenerates cleanly
  • Smoke-test on a real RN app with Reanimated v3
  • Smoke-test on a real RN app with Reanimated v4 (requires `react-native-worklets/plugin`)

mayrang added 25 commits May 26, 2026 00:22
Move inline mock from use-animation.test.ts into __tests__/__mocks__/reanimated.ts.
Extend mock to cover withDelay, withSequence, withRepeat, cancelAnimation with
synchronous callback invocation. Add testPathIgnorePatterns to jest.config.js to
prevent Jest from treating the mock file as a test suite.
@mayrang mayrang marked this pull request as draft May 25, 2026 17:49
@mayrang

mayrang commented May 25, 2026

Copy link
Copy Markdown
Owner Author

Bumped to 0.2.0-beta.0 and converted to draft. Smoke-test plan:

  1. npm publish --tag beta from local
  2. In a separate RN project: npm install reanimated-composer@beta
  3. Verify the inline-animations fix, onComplete callback timing, and stop() rename on both Reanimated v3 and v4
  4. If clean, bump 0.2.0-beta.00.2.0, mark PR ready, merge, then npm publish (no --tag flag for the latest tag)

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