2

I am developing an app with React Native and trying to migrate from React Navigation 5 to 6. For this I have followed the steps that come in the Upgrading from 5.x guide.

The versions of React and React Native are these:

"react": "17.0.2",
"react-native": "0.67.2",

I have installed these packages:

"@react-navigation/bottom-tabs": "^6.2.0",
"@react-navigation/native": "^6.0.8",
"@react-navigation/stack": "^6.1.1",
"react-native-safe-area-context": "^3.4.1",
"react-native-screens": "^3.12.0",
"react-native-tab-view": "^3.1.1",

After upgrading the packages I ran pod install command in ios folder.

If I run npx react-native run-ios --simulator="iPhone 13" command or I run on a device using Xcode, I get this error:

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

It looks like libRNScreens.a is from the react-native-screens package.

Do you know how to solve this problem?

3 Answers 3

2

The easiest way to solve the problem in my case has been to downgrade react-native-screens library to version 3.11.1. Now it runs without problems.

Sign up to request clarification or add additional context in comments.

Comments

1

It might be related to using use_frameworks! in Podfile. Try adding the following step to your Podfile:

pre_install do |installer|
    installer.pod_targets.each do |pod|
      if pod.name.eql?('RNScreens')
        def pod.build_type
          Pod::BuildType.static_library
        end
      end
    end
  end

Details Here

3 Comments

I tried adding this code in different places in the Podfile, but I get the same error. After Podfile changes should I run something before running the app?
yes, run pod install command. project->ios->pod install
I tried downgrading react-native-screens package to 3.11.1 and it runs without problems. I think I will go in this way, thank you for your help.
0

solution is very simple

remove this

Xcode -> Build Settings -> Search Paths -> Library Search Paths -> "$(TOOLCHAINDIR)/usr/lib/swift-5.0/$(PLATFORMNAME)"

2 Comments

I have Debug and Release parameters with the same value: iphoneos/usr/lib/swift "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/switf/iphoneos" "". Should I remove both properties?
@Jon yes, that's right

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.