Nuclide 开发 React Native 配置篇

652 查看

React Native 开发平台搭建完全可以参考官方的guide:React Native Getting Started

这里就过程中可能遇到的问题做一下整理:

  • 使用Homebrew前尽量先更新:

    brew update
    brew upgrade
  • Run react-native init xxproject 时会等待一段时间,有时甚至一天,这段时间是在clone the whole react repository;

  • 通常我们需要如下命令行run project:

    react-native run-ios
    react-native run-android

    如果你target是iOS,可以通过Nuclide 取代命令行:

    • Atom 主要通过 Atom Package Manager 来管理所有的tool。通过快捷键command+shift+p 打开Command Palette, 搜索nuclide toolbar, 显示如下,选中Nuclide Buid: Toggle Toolbar Visibility

    • 此时我们会toolbar是灰的,提示No results found, 这是因为虽然 react-native init 已经init了 buck的config 文件,但是并没有有效的build target。可以在.buckconfig文件加入如下代码:

      [alias]
      run_app_ios = //ios:AwesomeRNApp

      具体语法请参考: Buck build target syntax


open command palette

no target found