software-mansion / software-mansion/react-native-screens

IOS - use_framework! not working when combining with react-native-reanimated v3

Open
#1,963 12 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

platform:ios repro-provided
Dominant language
TypeScript
Stars
3.7k
Forks
713
Avg merge
2d 23h
Merged PRs (30d)
71

Description

Description

We're trying to update into latest version of react-native + reanimated + react-native-screens, so far not so good we're able to track down which is the package that keep throwing the errors with some specific condition.

Our app is vanilla app and using old architecture.

Here is the error that it's throwing on Xcode after try to build the project:

Undefined symbols for architecture arm64:
  "_OBJC_CLASS_$_RCTImageLoader", referenced from:
      objc-class-ref in RNSScreenStackHeaderConfig.o
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

I believe this is the combination of the use_framework + react-native-reanimated + react-native-screens

Steps to reproduce

Here is the simplify Podfile

# Resolve react_native_pods.rb with node to allow for hoisting
require Pod::Executable.execute_command('node', ['-p',
  'require.resolve(
    "react-native/scripts/react_native_pods.rb",
    {paths: [process.argv[1]]},
  )', __dir__]).strip

platform :ios, min_ios_version_supported
prepare_react_native_project!

# If you are using a `react-native-flipper` your iOS build will fail when `NO_FLIPPER=1` is set.
# because `react-native-flipper` depends on (FlipperKit,...) that will be excluded
#
# To fix this you can also exclude `react-native-flipper` using a `react-native.config.js`
# ```js
# module.exports = {
#   dependencies: {
#     ...(process.env.NO_FLIPPER ? { 'react-native-flipper': { platforms: { ios: null } } } : {}),
# ```
flipper_config = ENV['NO_FLIPPER'] == "1" ? FlipperConfiguration.disabled : FlipperConfiguration.enabled

linkage = ENV['USE_FRAMEWORKS']
if linkage != nil
  Pod::UI.puts "Configuring Pod with #{linkage}ally linked Frameworks".green
  use_frameworks! :linkage => linkage.to_sym
end

target 'TestProject' do
  use_frameworks!

  config = use_native_modules!

  # Flags change depending on the env values.
  flags = get_default_flags()

  use_react_native!(
    :path => config[:reactNativePath],
    # Hermes is now enabled by default. Disable by setting this flag to false.
    :hermes_enabled => flags[:hermes_enabled],
    :fabric_enabled => flags[:fabric_enabled],
    # Enables Flipper.
    #
    # Note that if you have use_frameworks! enabled, Flipper will not work and
    # you should disable the next line.
    :flipper_configuration => FlipperConfiguration.disabled,
    # An absolute path to your application root.
    :app_path => "#{Pod::Config.instance.installation_root}/.."
  )

  target 'TestProjectTests' do
    inherit! :complete
    # Pods for testing
  end

  post_install do |installer|
    # https://github.com/facebook/react-native/blob/main/packages/react-native/scripts/react_native_pods.rb#L197-L202
    react_native_post_install(
      installer,
      config[:reactNativePath],
      :mac_catalyst_enabled => false
    )
    __apply_Xcode_12_5_M1_post_install_workaround(installer)
  end
end

This is how the package.json look like

    "react": "18.2.0",
    "react-native": "0.72.6",
    "@freakycoder/react-native-bounceable": "0.2.2",
    "@klarna/react-native-vector-drawable": "0.4.0",
    "@react-native-clipboard/clipboard": "1.11.2",
    "@react-native-community/datetimepicker": "7.6.1",
    "@react-native-community/netinfo": "9.4.1",
    "@react-navigation/native": "6.1.9",
    "@react-navigation/native-stack": "6.9.17",
    "react-native-reanimated": "3.5.4",
    "react-native-screens": "3.27.0",
    "patch-package": "6.4.7",
    "react-async": "10.0.1",
    "simple-evaluate": "1.4.5",
    "styled-components": "5.2.1",
    "typescript": "5.1.3",
    "brandi": "5.0.0"
Snack or a link to a repository

https://github.com/huyvuskedulo/TestProject

Screens version

3.27.0

React Native version

0.72.6

Platforms

iOS

JavaScript runtime

None

Workflow

None

Architecture

None

Build type

None

Device

None

Device model

No response

Acknowledgements

Yes

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the simplified Podfile and package.json, then reproduce the failure using the linked TestProject repository. Inspect the Xcode arm64 linker output around RCTImageLoader and RNSScreenStackHeaderConfig, and compare the React Native, Reanimated, and Screens versions. Done means the use_framework! configuration has a confirmed cause and the iOS project builds successfully under the reported setup.

Written by the indexing model from the issue text.

Assessment

Tech stack
ios, react-native, ruby, typescript
Domain
build-system, mobile
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.