Unable to disable new architecture in iOS

This issue has been created since 2022-09-19.

Description

I have recently enabled new architecture in iOS by running following command

RCT_NEW_ARCH_ENABLED=1 pod install

I would like to disable new architecture now, But unable to figure out a way. I couldn't find anything from official documentation as well.

Is there anyway to disable the new architecture or creating the new project is the only way?

Thank You.

Version

0.69.5

Output of npx react-native info

System:
     OS: macOS 12.5
     CPU: (8) x64 Apple M1
     Memory: 24.20 MB / 8.00 GB
     Shell: 5.8.1 - /bin/zsh
Binaries:
     Node: 14.0.0 - /usr/local/bin/node
     Yarn: Not Found
      npm: 6.14.4 - /usr/local/bin/npm
      Watchman: Not Found
 Managers:
       CocoaPods: 1.11.2 - /opt/homebrew/bin/pod
 SDKs:
       iOS SDK:
       Platforms: DriverKit 21.4, iOS 15.5, macOS 12.3, tvOS 15.4, watchOS 8.5
 Android SDK: Not Found
 IDEs:
        Android Studio: 4.2 AI-202.7660.26.42.7351085
        Xcode: 13.4.1/13F100 - /usr/bin/xcodebuild
 Languages:
        Java: 11.0.10 - /usr/bin/javac
 npmPackages:
        @react-native-community/cli: Not Found
        react: Not Found
        react-native: Not Found
        react-native-macos: Not Found
        npmGlobalPackages:
         *react-native*: Not Found

Steps to reproduce

Since it is not any error I cannot provide any reproducible steps. I am just looking for a way to disable the new architecture in iOS.

Snack, code example, screenshot, or link to a repository

I do not have any code snippet since I am not facing any errors.

cortinico wrote this answer on 2022-09-20

I would like to disable new architecture now, But unable to figure out a way. I couldn't find anything from official documentation as well.
Is there anyway to disable the new architecture or creating the new project is the only way?

If you run RCT_NEW_ARCH_ENABLED=0 pod install you'll be effectively disabling the New Architecture.

Yandamuri wrote this answer on 2022-09-21

I would like to disable new architecture now, But unable to figure out a way. I couldn't find anything from official documentation as well.
Is there anyway to disable the new architecture or creating the new project is the only way?

If you run RCT_NEW_ARCH_ENABLED=0 pod install you'll be effectively disabling the New Architecture.

@cortinico This solution doesn't seem like working.

Let me explain what's happening in my app,

I ran RCT_NEW_ARCH_ENABLED=1 pod install and pod installation was successful. When I ran app from Xcode faced the following error,

 `react/renderer/components/view/ViewEventEmitter.h' file not found 

This error is coming from following file,

 ios/Pods/Headers/Private/React-Codegen/react/renderer/components/rncore/EventEmitters.h 

it's looking for a file which supposed to be in the following location,

 ios/Pods/Headers/Private/React-Codegen/react/renderer/components/view/ViewEventEmitter.h

But in fact, This file doesn't exist in the above path.

RCT_NEW_ARCH_ENABLED=1 pod install command resulted in creating a folder called react(this folder contains the path of file where error is occurring) react/renderer/components/view/ViewEventEmitter.h) which was not there before enabling the new architecture.

Though I ran RCT_NEW_ARCH_ENABLED=0 pod install, still react folder is there, So does error.

What should I do now to get rid of this error?

cipolleschi wrote this answer on 2022-09-21

Hi @Yandamuri, thanks for opening the issue and I'm sorry you are incurring into it.

Could you try to:

  1. navigate to the ios folder of your project
  2. remove the build folder
  3. run pod install
    And see if it fixes the issue?

It looks like that your build folder kept some dirty files from the previous build.
Let me know if it works!

Yandamuri wrote this answer on 2022-09-21

@cipolleschi This is great. Thank you so much. Issue got resolved.

I am just asking out of curiosity, Do you have any idea about why the ViewEventEmitter.h isn't there(Which explained in my above comment) when I ran RCT_NEW_ARCH_ENABLED=1 pod install?

cipolleschi wrote this answer on 2022-09-21

When running RCT_NEW_ARCH_ENABLED=1 pod install, we are also running a bit of Codegen to generate some files in the React-Codegen local pod. In the old architecture, we run a similar Codegen (actually the same code) but from a different entry points and with slightly different parameters.

I have not explored in depth why this error occur. My guess is that the two Codegen processes generate file in slightly different way. Furthermore, Cocoapods could have some cache heuristic which fails to pick up the differences and it could be that it doesn't update the dependencies correctly.

Yandamuri wrote this answer on 2022-09-22

@cipolleschi

Surprisingly The mentioned error gone now, In Fact, the new react folder(ios/Pods/Headers/Private/React-Codegen/react) hasn't been created now. But When I ran RCT_NEW_ARCH_ENABLED=1 pod install faced following error,

 error: Could not determine react-native-codegen location. Try running 'yarn install' or 'npm install' in your project root.

Then I installed react-native-codegen and then ran RCT_NEW_ARCH_ENABLED=1 pod install. Then pod installation was successful.

Is react-native-codegen mandatory to enable new architecture?

cipolleschi wrote this answer on 2022-09-22

react-native-codegen is indeed required by the New Architecture. It is a package within React Native, therefore, when you install React Native, it will pull also that package automatically.

From the error message, it seems like React Native did not install itself correctly. Rather than explicitly install react-native-codegen package, could you please try to just run yarn install and see if the error disappear?

Yandamuri wrote this answer on 2022-09-23

@cipolleschi Yes you are right. After npm install issue got resolved.

Thank you for your support.

More Details About Repo
Owner Name facebook
Repo Name react-native
Full Name facebook/react-native
Language JavaScript
Created Date 2015-01-09
Updated Date 2022-10-07
Star Count 105180
Watcher Count 3671
Fork Count 22481
Issue Count 2230

YOU MAY BE INTERESTED

Issue Title Created Date Comment Count Updated Date
Blog tutorial fails when using `feat/sdk-ibc-upgrade` branch 2 2022-08-04 2022-08-21
Invalid API key for system 5 2021-01-07 2022-10-02
Emulate the Teletype module (phase 1) 14 2017-12-06 2022-05-05
Preset glyphs are not saved correctly 1 2017-12-05 2022-07-16
Use separate processes to run firmware 0 2017-12-09 2022-10-01
Performance analysis 0 2017-12-05 2022-09-11
Baselines compared ... 2 2021-05-19 2022-08-01
Confusion regarding unsupervised labels. 4 2021-05-13 2022-08-10
Where to get the 1/2 and 1/16 split for the datasets? 1 2021-05-22 2022-07-31
Why iters are fixed for semi experiment? (like 1157) 1 2021-05-24 2022-08-20
Unhandled Rejection (TypeError): Cannot read properties of null (reading 'toNumber') 0 2022-05-12 2022-08-06
SIM7000G lilygo to AWS IOT CORE MQTT 4 2021-11-09 2022-10-02
SIM7000G : unexpected "### Unexpected module reset!" 4 2021-11-07 2022-08-27
Any plans for checking the files array or npmrc 5 2018-09-22 2022-09-24
Breaking change between v0.61.x and v0.75. 10 2021-08-06 2022-08-21
Error after last update 2 2022-02-01 2022-08-26
Add support for "changes" package 1 2020-10-18 2022-09-24
Как узнать, что акция включена в котировальные списки? 1 2022-05-24 2022-09-20
Change the color of the handbrake icon 1 2022-02-05 2022-09-28
[BUG] TimeoutSec=300 might not be adequate and can lead to database corruption 3 2022-06-02 2022-09-05
Report an error on the file -- listcomp_speed.py 0 2021-05-03 2022-09-28
input type="date" fails validation when using locale specific methods from localizations/ 5 2020-11-18 2022-09-28
Input with no name is validated 2 2020-11-18 2022-09-17
[QUESTION] Memory consumption seems high 3 2022-02-03 2022-08-06
Clean up stale issues 2 2021-02-25 2022-10-03
Ghosting Issue 2 2022-01-04 2022-01-13
update not working with python 3.8 1 2021-06-16 2022-08-29
Get rid of setting `CUDA_VISIBLE_DEVICES` as an environment variable to `Nanny` 17 2022-07-21 2022-10-05
rowwise not applicable 1 2021-04-12 2022-08-08
ReactSortable options not updating on rerender 3 2020-09-28 2022-09-10
encoding issues 0 2022-01-07 2022-01-09
v4 is missing doc on Dispatcher 0 2021-05-08 2022-09-12
Decoding `java.time.Instant` is not correct when temporal is `LocalDateTime` 10 2022-06-02 2022-09-15
pandas.to_excel doesn't work 2 2022-08-27 2022-09-24
Avoid installing Nginx when it's already installed 3 2021-11-30 2022-09-13
How to add dynamic values 5 2018-04-10 2022-08-04
Jcenter is deprecated 1 2021-06-19 2022-01-15
Dropdown appears behind RecyclerView items 0 2021-04-03 2022-01-25
Uploading an image, removing it, then uploading a different one shows the first uploaded one 0 2021-05-23 2022-09-26
AwesomeHD.me to AwesomeHD.club 0 2021-01-30 2022-09-07
Loki Query error disk quota exceeded 1 2022-01-18 2022-08-30
Add support for `AutoForgetDelegate` in all of the Loki rings. 1 2022-01-18 2022-08-16
MacOS Build #7591: Tracker icon blinking 5 2022-02-01 2022-09-17
Unstable on Windows 3 2021-05-15 2022-01-16
Breaking change due to go 1.18 0 2022-04-15 2022-09-30
R session termination and crash when RAM gets filled on Rmarkdown chunk 1 2022-09-12 2022-09-21
$users.update('me', form) not working 3 2020-11-19 2022-10-06
Moonlight freeze on NVIDIA Shield 2019 13 2022-02-03 2022-09-30
[Question] override an non-mandatory field to be mandatory 5 2021-07-21 2022-09-26
Update VS Code grammars to match on sub-kernel languages 0 2021-09-10 2022-09-16