React Native Firebase启动器和React Navigation

时间:2019-06-16 17:52:28

标签: react-native cocoapods react-navigation react-native-firebase

我想使用react native firebase starter template并添加react navigation

我已经启动了 react-native-firebase-starter 项目并正在运行,并将其链接到firebase。但是现在,当我按照步骤添加 react-navigation 时,我遇到了react-native link react-native-gesture-handler的问题。

我猜是因为该项目使用可可豆荚,并且此命令向Podfile添加了一行,所以我应该cd ios并运行pod install

然后的问题是我得到一个错误: [!] React has been deprecated ,并且该项目无法构建。

有人成功使用了这个入门项目并向其中添加了 react-navigation 吗?

请告诉我我做错了什么或怎么做才能对其进行排序。

1 个答案:

答案 0 :(得分:1)

我知道了。

您需要将这些行添加到Podfile中的应用程序目标中...

pod 'React', :path => '../node_modules/react-native'
pod 'yoga', :path => '../node_modules/react-native/ReactCommon/yoga'

然后在Podfile的最底部,您需要添加以下内容...

post_install do |installer|
  installer.pods_project.targets.each do |target|
    targets_to_ignore = %w(React yoga)
    if targets_to_ignore.include? target.name
      target.remove_from_project
    end
  end
end

这已将React&Yoga从Pods项目中删除,因为它已包含在主项目中。