Maaz Zindani

Loading the index…

↑↓ move↵ openesc close4072 pages
Flutter and app store releases

Drawer navigator crashes with [Reanimated] Failed to create a worklet

Error[Reanimated] Failed to create a worklet

Short answer

The drawer needs react-native-gesture-handler, react-native-reanimated and react-native-worklets, and Reanimated's own Babel plugin. Failed to create a worklet means that setup is incomplete. Install the three packages, add the worklets plugin last in babel.config.js, clear the Metro cache, and rebuild the native app.

  • Applies to React Navigation 7, Reanimated 4.x, react-native-worklets, Expo SDK 5x
  • Updated
  • By Maaz Zindani, Senior Software Engineer

Fix it fast

  1. 1Find out which cause you have

    List the three packages the drawer needs, and check the Babel config for the worklets plugin.

    npm ls react-native-gesture-handler react-native-reanimated react-native-worklets
    cat babel.config.js
  2. 2Match what you see, then jump to its fix

    1. 1Failed to create a worklet, right after setup, with the packages installedThe Babel plugin is missing or not lastFix
    2. 2The Babel config is correct but the same error remainsMetro still serves code compiled before the config was fixedFix
    3. 3npm ls shows one of the three packages missing or UNMETA required drawer package is not installedFix
    4. 4Packages and Babel are correct, but the app was only reloadedThe native app was not rebuilt after installingFix
    5. 5The app is on the old architecture and uses Reanimated 4Reanimated 4 on an app that is not on the New ArchitectureFix

What does the error look like?

  • [Reanimated] Failed to create a worklet
  • Mismatch between JavaScript code version and Worklets Babel plugin version

Cause 1 of 5

The Babel plugin is missing or not last

1Check

Reanimated's troubleshooting guide says this error usually comes from an incomplete install, with the Worklets Babel plugin missing from babel.config.js as the example. Expo's starter template already has it, a bare project does not.

grep -n "worklets" babel.config.js

2Fix

Add the plugin as the last entry in the plugins list.

// babel.config.js
module.exports = {
  // keep your existing presets here
  plugins: ['react-native-worklets/plugin'], // keep this last
};

3Verify

Restart Metro with a cleared cache and open the drawer.

npm start -- --reset-cache

Confirmed by docs.swmansion.com

Did this fix it?

Cause 2 of 5

Metro still serves code compiled before the config was fixed

1Check

The guide says that when the plugin is set up properly, a stale Metro cache is the next thing to rule out.

grep -n "worklets/plugin" babel.config.js

2Fix

Reset the cache when starting Metro, then run the app again.

npm start -- --reset-cache
# Expo
npx expo start -c

3Verify

Reload the app; the drawer should render and open.

npm start -- --reset-cache

Confirmed by docs.swmansion.com

Did this fix it?

Cause 3 of 5

A required drawer package is not installed

1Check

The drawer navigator page lists react-native-gesture-handler, react-native-reanimated and react-native-worklets as required.

npm ls react-native-gesture-handler react-native-reanimated react-native-worklets

2Fix

Install all three. In Expo use expo install so versions match the SDK.

# Expo
npx expo install react-native-gesture-handler react-native-reanimated react-native-worklets
# bare
npm install react-native-gesture-handler react-native-reanimated react-native-worklets

3Verify

npm ls shows all three with no errors.

npm ls react-native-gesture-handler react-native-reanimated react-native-worklets

Confirmed by reactnavigation.org

Did this fix it?

Cause 4 of 5

The native app was not rebuilt after installing

1Check

Reanimated has native code. Expo needs prebuild to update ios and android, and iOS needs pod install.

ls ios/Pods | grep -i -E "reanimated|worklets"

2Fix

Update the native projects and build the app again.

# Expo
npx expo prebuild
# bare iOS
cd ios && pod install && cd ..

3Verify

Run the new native build and open the drawer.

ls ios/Pods | grep -i -E "reanimated|worklets"

Confirmed by docs.swmansion.com

Did this fix it?

Cause 5 of 5

Reanimated 4 on an app that is not on the New Architecture

1Check

Reanimated 4 works only with the New Architecture. Apps on the old one can use Reanimated 3, which the docs say is no longer actively maintained.

npm ls react-native-reanimated

2Fix

Move the app to the New Architecture, or install Reanimated 3 and follow its own setup page.

npm install react-native-reanimated@3

3Verify

Rebuild the native app and open the drawer.

npm ls react-native-reanimated

Confirmed by docs.swmansion.com

Did this fix it?

How do I stop it coming back?

  • Follow the Reanimated install page in order, including the cache reset and native rebuild.
  • Use expo install in Expo so package versions match the SDK.
  • Keep the Babel plugin as the last entry in the list.

Sources

How was this page made?

I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.

Which stack is behind this page?

Projects of mine built on the same technologies:

Related fixes

Next step

Want this handled for good?

I look after servers, apps and releases end to end. Tell me what keeps breaking.