Skip to content

[Bug]: Crash in reanimated(v4) fabric example project #2513

@Farteen

Description

@Farteen

Version

v5

Reanimated Version

v3

Gesture Handler Version

v2

Platforms

iOS

What happened?

I want to express my sincere gratitude to the maintainers and contributors of this project.

Context:
There's a crash, when I clicked the reanimated fabric example repo bottomsheet, the app crashed with the error information below.

Image

Reproduction steps

  1. Run react-native-reanimated project fabric example on iOS device or simulator (both of them crashed)
  2. Click the bottomsheet on the list
  3. App crashed

Possible solution:
Per the error information, I update the code as below, and the crash gone away. Should I raise a PR for this?

    if (typeof ref.current.unstable_getBoundingClientRect === 'function') {
      // @ts-ignore https://github.com/facebook/react/commit/53b1f69ba
      const layout = ref.current.unstable_getBoundingClientRect();
      handler(layout);
      return;
    }

    // Fallback to the stable API when available
    // @ts-ignore once it `unstable_getBoundingClientRect` gets stable 🤞.
    if (typeof ref.current.getBoundingClientRect === 'function') {
      // @ts-ignore once it `unstable_getBoundingClientRect` gets stable.
      const layout = ref.current.getBoundingClientRect();
      handler(layout);
    }

Reproduction sample

https://snack.expo.dev/@farteen/b7f71e

Relevant log output

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions