React Native Firebase 启动器和 React Navigation

React Native Firebase starter and React Navigation

我想使用 react native firebase starter template and add react navigation

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

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

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

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

请告诉我我哪里做错了或如何解决。

我想通了。

您需要将这些行添加到 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

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