Skip to content

ReanimatedError: Cannot read property 'LEFT' of undefined from SwipeDirection enum after upgrade #3665

@christianbach

Description

@christianbach

Description

When upgrading react-native-gesture-handler from 2.25.0 to 2.28.0 on React Native 0.80, our app crashes with the following error:

ReanimatedError: Cannot read property 'LEFT' of undefined, js engine: reanimated. Cannot read LEFT of undefined

The error points to the TypeScript enum:

export enum SwipeDirection {
  LEFT = 'left',
  RIGHT = 'right',
}

This enum usage is standard and works fine elsewhere in our codebase. After upgrading, it fails specifically in this context, referencing the SwipeDirection enum. Enums work as expected elsewhere.

The only thing that I can think of is that we use unstable_enablePackageExports and unstable_conditionNames in our metro.config

resolver: {
    assetExts: assetExts.filter(ext => ext !== 'svg'),
    sourceExts: [...sourceExts, 'svg', 'mjs', 'cjs'],
    // disable watchman for now, its just too slow and unstable
    useWatchman: false,
    // This needs to be here for react-strict-dom to work
    unstable_enablePackageExports: true,
    unstable_conditionNames: ['react-native', 'require', 'default'],
  },

Steps to reproduce

  1. Upgrade react-native-gesture-handler from 2.25.0 to 2.28.0
  2. Use react-native-gesture-handler/ReanimatedSwipeable

A link to a Gist, an Expo Snack or a link to a repository based on this template that reproduces the bug.

none

Gesture Handler version

2.28.0 (upgraded from 2.25.0)

React Native version

0.80

Platforms

iOS

JavaScript runtime

Hermes

Workflow

React Native (without Expo)

Architecture

Old Architecture (Paper)

Build type

Debug mode

Device

iOS simulator

Device model

No response

Acknowledgements

Yes

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions