Atom/Nuclide是否为react-native组件提供自动导入

Dan*_*ith 13 atom-editor react-native nuclide-editor

有没有办法让Atom为我添加到react-native文件的组件生成import语句?

在NavigatorAtom/Nuclide编辑器中编辑react-native代码时添加标准的react-native组件(如a )时,我发现需要手动编写import语句.这是预期的吗?

在传统的本机IDE世界(Android Studio,XCode)中,IDE会自动生成import语句.这有原子包装吗?

例:

import React, { Component } from 'react'
import { AppRegistry } from 'react-native'

class TestProject extends Component {
  render() {
    return (
      <Navigator
      ...
Run Code Online (Sandbox Code Playgroud)

在上面,第2行应该成为:

import { AppRegistry, Navigator } from 'react-native'
Run Code Online (Sandbox Code Playgroud)

Key*_*lor 6

对于 React-Native 应用程序开发,Atom 仅用作编辑器。Atom 尚未提供您所询问的功能。希望我们将来能得到包含此功能的更新。

但在那之前,请尝试一下Visual Studio Code,您需要在其中安装React-Native Tools的扩展。

带有 React-Native Tools 扩展的 VSCode 提供了此功能,其中导入语句是自动生成的。我们还在开发时获得可用类和方法的建议,从开发人员的角度来看,这非常有用。我们还可以直接从 VSCode 调试和运行项目,无需控制台或本机 IDE(如 Android Studio 或 Xcode)。