为什么 Flow/Nuclide 在我的 React-Native 组件中向我显示警告 "not covered by Flow"?
Why is Flow/Nuclide showing me a warning "not covered by Flow" in my React-Native component?
我开始使用流并有一个简单的组件:
// @flow
import React, { Component } from 'react';
import {
Text,
ScrollView
} from 'react-native';
const Conversations = (props: { messages: string }) => (
<ScrollView>
<Text>{props.messages}</Text>
</ScrollView>
);
export default Conversations;
在 Nuclide 中,我看到了这个警告 "Warning, type coverage, not covered by Flow"。它指向第 9 行,我在这里使用 <ScrollView>
.
这是为什么/这是什么意思/我该如何解决?
您已开启类型覆盖功能(见截图)。您可以单击状态栏中的百分比来打开和关闭它。它让您知道 Flow 有哪些表达式的类型,哪些没有类型(这意味着您可以对它们做任何事情并且 Flow 不会警告您)。
React Native 团队还没有将 Flowtype 添加到核心组件中。
来自官方的 React Native 路线图:
Flowtyping the core components. Owners: yungsters, alex_frantic. ETA: January
Making the most common components come with Flow types, for a
better typechecking experience. This should also make it easier to
reduce breaking changes. Flow already comes with React Native, so this
is a logical step to further improve the experience.
https://github.com/facebook/react-native/wiki/Roadmap/ebdbdc699bc083b98ac7b067465218fd70d30b66
我开始使用流并有一个简单的组件:
// @flow
import React, { Component } from 'react';
import {
Text,
ScrollView
} from 'react-native';
const Conversations = (props: { messages: string }) => (
<ScrollView>
<Text>{props.messages}</Text>
</ScrollView>
);
export default Conversations;
在 Nuclide 中,我看到了这个警告 "Warning, type coverage, not covered by Flow"。它指向第 9 行,我在这里使用 <ScrollView>
.
这是为什么/这是什么意思/我该如何解决?
您已开启类型覆盖功能(见截图)。您可以单击状态栏中的百分比来打开和关闭它。它让您知道 Flow 有哪些表达式的类型,哪些没有类型(这意味着您可以对它们做任何事情并且 Flow 不会警告您)。
React Native 团队还没有将 Flowtype 添加到核心组件中。
来自官方的 React Native 路线图:
Flowtyping the core components. Owners: yungsters, alex_frantic. ETA: January
Making the most common components come with Flow types, for a better typechecking experience. This should also make it easier to reduce breaking changes. Flow already comes with React Native, so this is a logical step to further improve the experience.
https://github.com/facebook/react-native/wiki/Roadmap/ebdbdc699bc083b98ac7b067465218fd70d30b66