VS Code在此本地反应代码中用红色标记了一些行

时间:2019-01-21 03:17:15

标签: react-native visual-studio-code expo

我刚刚下载了此存储库:

https://github.com/callstack/react-native-paper

并使用VS Code打开以下文件:

https://github.com/callstack/react-native-paper/blob/master/example/src/RootNavigator.js

其中包含以下代码:

/* @flow */

import * as React from 'react';
import { createStackNavigator } from 'react-navigation';
import { Appbar } from 'react-native-paper';
import ExampleList, { examples } from './screens/ExampleList';

const routes = Object.keys(examples)
  .map(id => ({ id, item: examples[id] }))
  .reduce((acc, { id, item }) => {
    const Comp = item;
    const Screen = props => <Comp {...props} />;

    Screen.navigationOptions = props => ({
      header: (
        <Appbar.Header>
          <Appbar.BackAction onPress={() => props.navigation.goBack()} />
          <Appbar.Content title={(Comp: any).title} />
        </Appbar.Header>
      ),
      /* $FlowFixMe */
      ...(typeof Comp.navigationOptions === 'function'
        ? Comp.navigationOptions(props)
        : Comp.navigationOptions),
    });

    return {
      ...acc,
      [id]: { screen: Screen },
    };
  }, {});

export default createStackNavigator(
  {
    home: { screen: ExampleList },
    ...routes,
  },
  {
    navigationOptions: ({ navigation }) => ({
      header: (
        <Appbar.Header>
          <Appbar.Action icon="menu" onPress={() => navigation.openDrawer()} />
          <Appbar.Content title="Examples" />
        </Appbar.Header>
      ),
    }),
  }
);

我的问题是,由于某种原因,VS Code用红色标记周围的线条:

export default createStackNavigator(...)

如下图所示:

enter image description here

另一方面,在VS Code的状态栏中,我得到:0 Errors, 0 Warnings用于该文件。

关于这里发生的事情有什么想法吗?

谢谢。

0 个答案:

没有答案