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?

Jon
  • 891
  • 13
  • 32

3 Answers3

0

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

Nooruddin Lakhani
  • 7,507
  • 2
  • 19
  • 39
  • 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? – Jon Feb 24 '22 at 07:34
  • yes, run pod install command. `project->ios->pod install` – Nooruddin Lakhani Feb 24 '22 at 07:38
  • 1
    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. – Jon Feb 24 '22 at 07:54
0

solution is very simple

remove this

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

hong developer
  • 13,291
  • 4
  • 38
  • 68
  • 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 Feb 24 '22 at 07:21
  • @Jon yes, that's right – hong developer Feb 24 '22 at 08:28
0

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.

Jon
  • 891
  • 13
  • 32