react-native-reanimated: Crash with expo custom build (49.x or 50.x, or 51.x) when newArchEnabled set to true on iOS and with expo-dev-client installed

Description

When reloading (using r) and sometimes when starting the app, the app crash (on iOS, not Android) as soon as react-native-reanimated is installed, even if not used inside app, with the newArchEnabled.

As soon as your remove react-native-reanimted and expo prebuild --clean and yarn ios the app will no longer crash on boot or reload.

Just an fyi, you no longer need to add ‘react-native-reanimated/plugin’ in your babel.config.js with expo 50 as per their latest blog post.

Steps to reproduce

  1. yarn create expo-app --template tabs@beta
  2. yarn expo install --fix
  3. yarn expo install expo-build-properties
  4. add to app.json
      [
        "expo-build-properties",
        {
          "ios": {
            "newArchEnabled": true
          },
          "android": {
            "newArchEnabled": true
          }
        }
      ]
  1. yarn expo install expo-dev-client
  2. Change “react-native-safe-area-context”: “4.8.1”,
  3. Change “react-native-screens”: “3.29.0”,
  4. Add this to package.json
  "expo": {
    "install": {
      "exclude": [
        "react-native-safe-area-context",
        "react-native-screens"
      ]
    }
  }
  1. Change this inside package.json
    "android": "expo run:android",
    "ios": "expo run:ios",
  1. yarn expo install react-native-reanimated
  2. yarn ios

Snack or a link to a repository

https://github.com/sync/new-arch-crash

Reanimated version

3.6.1

React Native version

0.73.0

Platforms

iOS

JavaScript runtime

Hermes

Workflow

Expo Dev Client

Architecture

Fabric (New Architecture)

Build type

Debug app & dev bundle

Device

iOS simulator

Device model

iPhone 15 Pro

Acknowledgements

Yes

About this issue

  • Original URL
  • State: closed
  • Created 7 months ago
  • Reactions: 4
  • Comments: 28 (11 by maintainers)

Commits related to this issue

Most upvoted comments

I have a similar problem without expo and newArch. The problem occurs when the application is reloading

react-native: 0.73.2
react-native-reanimated: ^3.6.1

Screenshot 2024-01-19 at 11 10 55

@tjzel tested with latest version of expo 51 beta with yarn create expo-app --template default@beta and I am experiencing the same issues on boot or hot reload with the new architecture enabled, see repro here: https://github.com/sync/pastlife

Version of reanimated: => Found "react-native-reanimated@3.9.0-rc.1"

 (NOBRIDGE) ERROR  Error: [Reanimated] Native part of Reanimated doesn't seem to be initialized.

cc @brentvatne

Update: Since React Native is going to come with bridge-less mode by default in 0.74 release, the code that causes this issue is very likely to undergo major changes. Therefore, until we adapt Reanimated to bridge-less mode, we will wait with this issue to see if it’s resolved then.

updated sample reproduction repo with latest expo and reanimated 3.7.0, crashes like before, haven’t had a chance to have a deeper look so far

@sync It seems to be a different issue, probably on the Expo side this time – we’ll investigate this.

Yeah, the problem is the DevMenu bridge, which gets initialized along with the main app. I just tested an using self.bridge fixes the issue

@sync - i tried this on a new project with sdk 51 beta and it works well for me on android, but had the same issue as you on ios: https://github.com/brentvatne/mittaz. @gabrieldonadel will investigate!

I reproduced with react-native 0.73.2 without expo and new architecture enabled

Hi @sync, thanks for submitting this issue! I investigated it and it turns out there’s some problem with how React Native’s bridge is handled by/with Expo. I forwarded the issue to them.