Skip to content

Full support for react-native-reanimated 4 and worklets#2660

Open
PedroAugustoRamalhoDuarte wants to merge 7 commits into
gorhom:masterfrom
PedroAugustoRamalhoDuarte:feat/reanimated-4-support
Open

Full support for react-native-reanimated 4 and worklets#2660
PedroAugustoRamalhoDuarte wants to merge 7 commits into
gorhom:masterfrom
PedroAugustoRamalhoDuarte:feat/reanimated-4-support

Conversation

@PedroAugustoRamalhoDuarte
Copy link
Copy Markdown

Overview

Adds complete support for React Native Reanimated 4. This is a critical change for the ecosystem, especially
for Expo 54+ and Expo Go users, which now ship with Reanimated 4 and workouts by default.

What Changed

Core API Migration

  • Replaced runOnJS() → scheduleOnRN()
  • Replaced runOnUI() → scheduleOnUI()
  • Removed Animated.addWhitelistedUIProps() (now automatic in Reanimated 4)
  • Removed .runOnJS(false) from Gesture Handlers (worklets are automatically optimized)

Following this migration guide: https://docs.swmansion.com/react-native-reanimated/docs/guides/migration-from-3.x

New Peer Dependency

  • react-native-worklets

Babel Configuration

  • Plugin changed from react-native-reanimated/plugin → react-native-worklets/plugin

Documentation

  • Updated README with Reanimated 4 installation instructions

Tests

Tested with my app:

  • react-native-reanimated: 4.1.7
  • expo: 54.0.34
  • react-native-worklets: 0.5.1
  • react-native-gesture-handler: 2.28.0

Probably you want to make a new v6 with reanimated 4, let me know if you need some changes in this PR

This commit updates the library to fully support React Native Reanimated v4,
migrating from deprecated APIs to the new react-native-worklets package.

Changes:
- Updated babel.config.js to use 'react-native-worklets/plugin' instead of 'react-native-reanimated/plugin'
- Added 'react-native-worklets' as a peerDependency (>=0.7.0)
- Migrated all 'runOnJS' calls to 'scheduleOnRN' from react-native-worklets
- Migrated all 'runOnUI' calls to 'scheduleOnUI' from react-native-worklets
- Removed deprecated 'addWhitelistedUIProps' call (now handled by default in Reanimated 4)
- Updated README.md with Reanimated 4 support information and New Architecture requirement

Breaking changes for users:
- Reanimated 4 requires New Architecture (no support for Legacy Architecture)
- 'react-native-worklets' package must be installed when using Reanimated 4

Closes gorhom#2223
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.

2 participants