Search code examples
react-nativeflowtypenuclide-editor

Why is Flow/Nuclide showing me a warning "not covered by Flow" in my React-Native component?


I'm starting to use flow and have a simple 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;

In Nuclide, I see this warning "Warning, type coverage, not covered by Flow". It's pointing at line 9, where I use <ScrollView>.

enter image description here

Why is that / What does it mean / How can I fix it ?


Solution

  • The React Native team simply hasn't added Flowtypes to the core components yet.

    From the official react native roadmap :

    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