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

Missing React-RCTImage dependency

Open stianjensen opened this issue 5 months ago • 1 comments

Description

When upgrading to react-native 0.73, I needed to upgrade react-native-screen to the latest version in order to make it build properly on Android. Then I ran into an issue on iOS where React-RCTImage disappeared from the list of dependencies of RNScreens in Podfile.lock.

It looks like it stems from this commit, which first shipped with v3.26.0: https://github.com/software-mansion/react-native-screens/commit/c3d1ae81fdd1214b572ac9c063a50deedf7db316

React-RCTImage is only added to the list of dependencies if you're running in a react-native environment without install_modules_dependencies.

The error I was getting was:

ld: Undefined symbols:
  _OBJC_CLASS_$_RCTImageLoader, referenced from:
       in RNSScreenStackHeaderConfig.o
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Patching the podspec locally to add back React-RCTImage (at least when running with new_arch_enabled == false, the only config I've tested so far), resolves the issue for me. Has it gotten lost in this case accidentally?

I can see from the PRs to the example repo here as well that the dep got lost when updating the version of react-native-screens used in the example repositories: https://github.com/software-mansion/react-native-screens/pull/1979

For context, I am running with use_frameworks! in my Podfile, but have seen no issues with that and react-native-screens until now.

Would it be possible to keep the dependency and thereby continue supporting this workflow?

Steps to reproduce

Install with use_frameworks! in your podfile, and then try to run on iOS.

Snack or a link to a repository

https://github.com/stianjensen/react-native-screens-test/tree/main

Screens version

3.29.0

React Native version

0.73.0

Platforms

iOS

JavaScript runtime

Hermes

Workflow

React Native (without Expo)

Architecture

Paper (Old Architecture)

Build type

Debug mode

Device

iOS simulator

Device model

No response

Acknowledgements

Yes

stianjensen avatar Feb 28 '24 15:02 stianjensen

Yeah, this is rather unintended. Thanks for letting us know.

Most likely we will bring back react-image to our dependency list, as we directly consume it.

kkafar avatar Feb 29 '24 09:02 kkafar

@stianjensen can you check if applying https://github.com/software-mansion/react-native-screens/pull/2089 fixes the issue?

WoLewicki avatar Apr 03 '24 10:04 WoLewicki

@stianjensen can you check if applying https://github.com/software-mansion/react-native-screens/pull/2089 fixes the issue?

Yes, looks like that solves it!


For completeness, it only worked for me when I applied it on v3.27.0 – on the latest version v3.30.1 I then ran into another linker error, but that probably warrants its own issue (I haven't tested the versions between 3.27 and 3.30.1 yet).

ld: Undefined symbols:
  facebook::jsi::HostObject::~HostObject(), referenced from:
      RNScreens::RNScreensTurboModule::RNScreensTurboModule(std::__1::function<std::__1::array<int, 2ul> (int)>, std::__1::function<void (int, double)>, std::__1::function<void (int, bool)>, std::__1::function<void (int)>) in RNScreensTurboModule.o
...

stianjensen avatar Apr 03 '24 16:04 stianjensen

@stianjensen That's great, thanks for confirming this resolves your issue! The PR with fix has been already merged (commit: https://github.com/software-mansion/react-native-screens/commit/02154a9e94916018814e1b8cda5ed0f9963dc1e8) and will land in the next release of Screens 🎉

Also, if the error with undefined symbol still happens to you, could you create separate issue with it? 🙏 Cheers

tboba avatar Apr 23 '24 10:04 tboba

@stianjensen

Try adding the following code to the RNScreens.podspec file in v3.27.0.

if ENV["USE_HERMES"] == nil || ENV["USE_HERMES"] == "1"
    s.dependency "hermes-engine"
else
    s.dependency "React-jsi"
end

itlijunjie avatar Apr 28 '24 06:04 itlijunjie