react-native-reanimated icon indicating copy to clipboard operation
react-native-reanimated copied to clipboard

iOS: Podfile install with new arch enabled not working

Open unamed000 opened this issue 1 year ago • 4 comments

Description

When running a RN app with new arch disabled with latest reanimated, we're not able to build the application.

We have to patch the Podspec as the following

diff --git a/node_modules/react-native-reanimated/RNReanimated.podspec b/node_modules/react-native-reanimated/RNReanimated.podspec
index 5d596d4..601a698 100644
--- a/node_modules/react-native-reanimated/RNReanimated.podspec
+++ b/node_modules/react-native-reanimated/RNReanimated.podspec
@@ -59,7 +59,7 @@ def self.install_modules_dependencies_legacy(s)
   end
   s.dependency 'React-callinvoker'
   if $config[:react_native_minor_version] >= 72 && !$new_arch_enabled
-    s.dependency 'React-RCTAppDelegate'
+    s.dependency 'React-jsc'
   end
 end
 
@@ -107,7 +107,7 @@ Pod::Spec.new do |s|
   }
   s.requires_arc = true
   s.dependency "ReactCommon/turbomodule/core"
-  if defined?(install_modules_dependencies()) != nil
+  if $new_arch_enabled
     install_modules_dependencies(s)
   else
     install_modules_dependencies_legacy(s)

Steps to reproduce

  1. Make a RN app with latest reanimated 3.7.1
  2. Disable new_arch
  3. Run pod install
  4. Try to build the app

Snack or a link to a repository

N/A

Reanimated version

3.7.1

React Native version

0.73.4

Platforms

iOS

JavaScript runtime

None

Workflow

React Native

Architecture

Paper (Old Architecture)

Build type

Debug app & dev bundle

Device

iOS simulator

Device model

No response

Acknowledgements

Yes

unamed000 avatar Feb 21 '24 07:02 unamed000

Hey! 👋

The issue doesn't seem to contain a minimal reproduction.

Could you provide a snack or a link to a GitHub repository under your username that reproduces the problem?

github-actions[bot] avatar Feb 21 '24 07:02 github-actions[bot]

Hey @unamed000, thanks for reporting this issue.

we're not able to build the application

Why not? Do you get any build errors?

with new arch disabled

Do you mean "New Architecture disabled" or "Hermes disabled"? I'm asking because in the patch you have provided you declare a dependency on React-jsc and JSC is JS engine alternative to Hermes.

tomekzaw avatar Feb 21 '24 09:02 tomekzaw

Hey @tomekzaw

Thanks for the reply.

It's both new architecture and hermes disabled also, we can't use hermes due to some of missing features on hermes engine, that's why we have to use JSC.

The reason for this is pretty close to JSC problem. It does seem like even when $new_arc_disabled, it will try to call install_modules_dependencies, which does not install JSC package and trying to use hermes, that's just my guess though

unamed000 avatar Feb 22 '24 03:02 unamed000

@unamed000 Can you please specify how exactly do you enable new architecture – in particular, do you set environmental variable RCT_NEW_ARCH_ENABLED=1 when running pod install?

Also, how exactly do you disable Hermes – by adding :hermes_enabled => false in use_react_native! in Podfile or by setting USE_HERMES=0 environmental variable?

I was able to successfully build RN 0.73.4 app with Reanimated 3.7.1 with New Architecture enabled and Hermes disabled without any patches with the following steps:

npx react-native@latest init MyApp --version 0.73.4
cd MyApp
yarn add [email protected]
code babel.config.js  # add `plugins: ['react-native-reanimated/plugin']`
code App.tsx  # overwrite with https://raw.githubusercontent.com/software-mansion/react-native-reanimated/main/app/src/examples/AboutExample.tsx or https://raw.githubusercontent.com/software-mansion/react-native-reanimated/main/app/src/examples/BokehExample.tsx
cd ios
code Podfile  # add `:hermes_enabled => false` in `use_react_native!`
RCT_NEW_ARCH_ENABLED=1 pod install
cd ..
xed ios  # build the project in Xcode
yarn start --reset-cache

Disclaimer: Even though Reanimated technically should work on New Architecture with JSC, we don't perform any tests on this configuration prior to a release so we cannot guarantee it will always be this way. Usually, it just works, but in the future we might need to break compatibility with JSC and support only Hermes. We are aware of some of the limitations of Hermes from the perspective of app developer and we hope that they will get resolved soon so we can move forward.

tomekzaw avatar Mar 02 '24 18:03 tomekzaw