Skip to content
This repository has been archived by the owner on Feb 15, 2019. It is now read-only.

Flow errors #87

Open
kpyorala opened this issue Sep 14, 2016 · 7 comments
Open

Flow errors #87

kpyorala opened this issue Sep 14, 2016 · 7 comments

Comments

@kpyorala
Copy link

I have Flow version 0.32.0 and ex-navigation version 1.5.26. When I run flow in my project root I got this:

node_modules/@exponent/ex-navigation/src/ExNavigationAlertBar.js:153
153:     this._textContainerRef.measure((l, t, w, height) => {
         ^ call of method `measure`. Function cannot be called on
153:     this._textContainerRef.measure((l, t, w, height) => {
         ^ property `measure` of unknown type

node_modules/@exponent/ex-navigation/src/ExNavigationStack.js:435
435:         <AlertBarComponent
             ^ React element `AlertBarComponent`
435:         <AlertBarComponent
             ^ React element `AlertBarComponent`. Expected React component instead of
431:     const AlertBarComponent = this.props.alertBarComponent || this.context.alertBarComponent || ExNavigationAlertBar;
                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ mixed

node_modules/@exponent/ex-navigation/src/ExNavigationStack.js:435
435:         <AlertBarComponent
             ^ React element `AlertBarComponent`
435:         <AlertBarComponent
             ^ React element `AlertBarComponent`. Expected React component instead of
431:     const AlertBarComponent = this.props.alertBarComponent || this.context.alertBarComponent || ExNavigationAlertBar;
                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ property `alertBarComponent` of unknown type

node_modules/@exponent/ex-navigation/src/ExNavigationStack.js:472
472:       <HeaderComponent
           ^ React element `HeaderComponent`
472:       <HeaderComponent
           ^ React element `HeaderComponent`. Expected React component instead of
464:     const HeaderComponent = this.props.headerComponent || this.context.headerComponent || NavigationBar;
                                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ mixed

node_modules/@exponent/ex-navigation/src/ExNavigationStack.js:472
472:       <HeaderComponent
           ^ React element `HeaderComponent`
472:       <HeaderComponent
           ^ React element `HeaderComponent`. Expected React component instead of
464:     const HeaderComponent = this.props.headerComponent || this.context.headerComponent || NavigationBar;
                                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ property `headerComponent` of unknown type

node_modules/@exponent/ex-navigation/src/drawer/ExNavigationDrawer.js:165
165:         {items.map(item => this.renderItemContent(item))}
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ call of method `map`
165:         {items.map(item => this.renderItemContent(item))}
                                                       ^^^^ undefined. This type is incompatible with
170:   renderItemContent(drawerItem: Object) {
                                     ^^^^^^ object type

node_modules/@exponent/ex-navigation/src/drawer/ExNavigationDrawerLayout.js:78
 78:     return this.props.items.map((item, index) => {
                ^ call of method `map`. Method cannot be called on
 78:     return this.props.items.map((item, index) => {
                ^^^^^^^^^^^^^^^^ property `items` of unknown type

node_modules/@exponent/ex-navigation/src/sliding-tab/ExNavigationSlidingTab.js:198
198:     return tabItem && tabItem.renderLabel ? tabItem.renderLabel(options) : null;
                                                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ call of method `renderLabel`. Function cannot be called on
198:     return tabItem && tabItem.renderLabel ? tabItem.renderLabel(options) : null;
                                                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ property `renderLabel` of unknown type

node_modules/@exponent/ex-navigation/src/tab/ExNavigationTab.js:171
171:         {tabs.map(tab => this.renderTab(tab))}
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ call of method `map`
171:         {tabs.map(tab => this.renderTab(tab))}
                                             ^^^ undefined. This type is incompatible with
176:   renderTab(tabItem: Object) {
                          ^^^^^^ object type


Found 9 errors

Am I missing some configurations or what is the problem?

@kpyorala
Copy link
Author

Issue #86 is about the same thing I think

@brentvatne
Copy link
Member

thanks @kpyorala - I haven't run this on 0.32 yet, that's a tricky thing about Flow -- hard to keep up with versions! could you possibly submit a PR to fix these and update us to 0.32?

@grabbou
Copy link
Contributor

grabbou commented Oct 25, 2016

We have experienced this issue internally and I am working on a fix today. Will send over a pull request updating to latest Flow.

@pstockley
Copy link

If you are fixing this can you also make sure anywhere the code specifies a react component for a prop it uses the type React.Element<*>. That way the prop types will propagate correctly. Many places it is ReactElement<{}> which breaks prop type checking.

@jacortinas
Copy link

jacortinas commented Nov 23, 2016

Hi, I'm also running flow (version 0.33.0) on a project using ex-navigation and I'm getting a lot of flow errors from inside of ex-navigation (version 2.1.3). I understand if the errors are hard to fix, but is there anything I can add to my .flowconfig to ignore these errors?

node_modules/@exponent/ex-navigation/src/ExNavigationStack.js:372
372:         ((parentNavigator: any): ExNavigationDrawerContext).setNavigatorUIDForCurrentItem(this.state.navigatorUID);
                                      ^^^^^^^^^^^^^^^^^^^^^^^^^ identifier `ExNavigationDrawerContext`. Could not resolve name

node_modules/@exponent/ex-navigation/src/ExNavigationStack.js:495
495:         <AlertBarComponent
             ^ React element `AlertBarComponent`
495:         <AlertBarComponent
             ^ React element `AlertBarComponent`. Expected React component instead of
486:     const AlertBarComponent = this.props.alertBarComponent || this.context.alertBarComponent || ExNavigationAlertBar;
                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ mixed

node_modules/@exponent/ex-navigation/src/ExNavigationStack.js:495
495:         <AlertBarComponent
             ^ React element `AlertBarComponent`
495:         <AlertBarComponent
             ^ React element `AlertBarComponent`. Expected React component instead of
486:     const AlertBarComponent = this.props.alertBarComponent || this.context.alertBarComponent || ExNavigationAlertBar;
                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ property `alertBarComponent` of unknown type

node_modules/@exponent/ex-navigation/src/ExNavigationStack.js:537
537:       <HeaderComponent
           ^ React element `HeaderComponent`
537:       <HeaderComponent
           ^ React element `HeaderComponent`. Expected React component instead of
524:     const HeaderComponent = this.props.headerComponent || this.context.headerComponent || NavigationBar;
                                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ mixed

node_modules/@exponent/ex-navigation/src/ExNavigationStack.js:537
537:       <HeaderComponent
           ^ React element `HeaderComponent`
537:       <HeaderComponent
           ^ React element `HeaderComponent`. Expected React component instead of
524:     const HeaderComponent = this.props.headerComponent || this.context.headerComponent || NavigationBar;
                                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ property `headerComponent` of unknown type

node_modules/@exponent/ex-navigation/src/drawer/ExNavigationDrawer.js:168
168:         {items.map(item => this.renderItemContent(item))}
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ call of method `map`
168:         {items.map(item => this.renderItemContent(item))}
                                                       ^^^^ undefined. This type is incompatible with
173:   renderItemContent(drawerItem: Object) {
                                     ^^^^^^ object type

node_modules/@exponent/ex-navigation/src/drawer/ExNavigationDrawerLayout.js:61
 61:       <View style={[styles.navigationViewContainer, this.props.style]}>
                                                                    ^^^^^ property `style`. Property not found in
 61:       <View style={[styles.navigationViewContainer, this.props.style]}>
                                                         ^^^^^^^^^^ object type

node_modules/@exponent/ex-navigation/src/drawer/ExNavigationDrawerLayout.js:78
 78:     return this.props.items.map((item, index) => {
                ^ call of method `map`. Method cannot be called on
 78:     return this.props.items.map((item, index) => {
                ^^^^^^^^^^^^^^^^ property `items` of unknown type

node_modules/@exponent/ex-navigation/src/sliding-tab/ExNavigationSlidingTab.js:223
223:         <TabBarComponent
             ^ React element `TabBarComponent`
 51:   renderLabel?: (routeParams: any) => ?React.Element<any>,
                                            ^^^^^^^^^^^^^^^^^^ null. This type is incompatible with
 35:   renderLabel?: (scene: Scene) => React.Element<*>;
                                       ^^^^^^^^^^^^^^^^ React$Element. See: node_modules/react-native-tab-view/src/TabBarTop.js:35

node_modules/@exponent/ex-navigation/src/sliding-tab/ExNavigationSlidingTab.js:223
223:         <TabBarComponent
             ^ React element `TabBarComponent`
 51:   renderLabel?: (routeParams: any) => ?React.Element<any>,
                                            ^^^^^^^^^^^^^^^^^^ undefined. This type is incompatible with
 35:   renderLabel?: (scene: Scene) => React.Element<*>;
                                       ^^^^^^^^^^^^^^^^ React$Element. See: node_modules/react-native-tab-view/src/TabBarTop.js:35

node_modules/@exponent/ex-navigation/src/sliding-tab/ExNavigationSlidingTab.js:223
223:         <TabBarComponent
             ^ React element `TabBarComponent`
 80: type Props = SceneRendererProps & {
                  ^^^^^^^^^^^^^^^^^^ property `getLastPosition`. Property not found in. See: node_modules/react-native-tab-view/src/TabBar.js:80
225:           {...tabBarProps}
                   ^^^^^^^^^^^ spread of object literal

node_modules/@exponent/ex-navigation/src/sliding-tab/ExNavigationSlidingTab.js:223
223:         <TabBarComponent
             ^ React element `TabBarComponent`
 80: type Props = SceneRendererProps & {
                  ^^^^^^^^^^^^^^^^^^ property `jumpToIndex`. Property not found in. See: node_modules/react-native-tab-view/src/TabBar.js:80
225:           {...tabBarProps}
                   ^^^^^^^^^^^ spread of object literal

node_modules/@exponent/ex-navigation/src/sliding-tab/ExNavigationSlidingTab.js:223
223:         <TabBarComponent
             ^ React element `TabBarComponent`
 80: type Props = SceneRendererProps & {
                  ^^^^^^^^^^^^^^^^^^ property `layout`. Property not found in. See: node_modules/react-native-tab-view/src/TabBar.js:80
225:           {...tabBarProps}
                   ^^^^^^^^^^^ spread of object literal

node_modules/@exponent/ex-navigation/src/sliding-tab/ExNavigationSlidingTab.js:223
223:         <TabBarComponent
             ^ React element `TabBarComponent`
 80: type Props = SceneRendererProps & {
                  ^^^^^^^^^^^^^^^^^^ property `navigationState`. Property not found in. See: node_modules/react-native-tab-view/src/TabBar.js:80
225:           {...tabBarProps}
                   ^^^^^^^^^^^ spread of object literal

node_modules/@exponent/ex-navigation/src/sliding-tab/ExNavigationSlidingTab.js:223
223:         <TabBarComponent
             ^ React element `TabBarComponent`
 80: type Props = SceneRendererProps & {
                  ^^^^^^^^^^^^^^^^^^ property `position`. Property not found in. See: node_modules/react-native-tab-view/src/TabBar.js:80
225:           {...tabBarProps}
                   ^^^^^^^^^^^ spread of object literal

node_modules/@exponent/ex-navigation/src/sliding-tab/ExNavigationSlidingTab.js:223
223:         <TabBarComponent
             ^ React element `TabBarComponent`
 80: type Props = SceneRendererProps & {
                  ^^^^^^^^^^^^^^^^^^ property `subscribe`. Property not found in. See: node_modules/react-native-tab-view/src/TabBar.js:80
225:           {...tabBarProps}
                   ^^^^^^^^^^^ spread of object literal

node_modules/@exponent/ex-navigation/src/sliding-tab/ExNavigationSlidingTab.js:223
223:         <TabBarComponent
             ^ React element `TabBarComponent`
 34: type Props = SceneRendererProps & {
                  ^^^^^^^^^^^^^^^^^^ property `getLastPosition`. Property not found in. See: node_modules/react-native-tab-view/src/TabBarTop.js:34
225:           {...tabBarProps}
                   ^^^^^^^^^^^ spread of object literal

node_modules/@exponent/ex-navigation/src/sliding-tab/ExNavigationSlidingTab.js:223
223:         <TabBarComponent
             ^ React element `TabBarComponent`
 34: type Props = SceneRendererProps & {
                  ^^^^^^^^^^^^^^^^^^ property `jumpToIndex`. Property not found in. See: node_modules/react-native-tab-view/src/TabBarTop.js:34
225:           {...tabBarProps}
                   ^^^^^^^^^^^ spread of object literal

node_modules/@exponent/ex-navigation/src/sliding-tab/ExNavigationSlidingTab.js:223
223:         <TabBarComponent
             ^ React element `TabBarComponent`
 34: type Props = SceneRendererProps & {
                  ^^^^^^^^^^^^^^^^^^ property `layout`. Property not found in. See: node_modules/react-native-tab-view/src/TabBarTop.js:34
225:           {...tabBarProps}
                   ^^^^^^^^^^^ spread of object literal

node_modules/@exponent/ex-navigation/src/sliding-tab/ExNavigationSlidingTab.js:223
223:         <TabBarComponent
             ^ React element `TabBarComponent`
 34: type Props = SceneRendererProps & {
                  ^^^^^^^^^^^^^^^^^^ property `navigationState`. Property not found in. See: node_modules/react-native-tab-view/src/TabBarTop.js:34
225:           {...tabBarProps}
                   ^^^^^^^^^^^ spread of object literal

node_modules/@exponent/ex-navigation/src/sliding-tab/ExNavigationSlidingTab.js:223
223:         <TabBarComponent
             ^ React element `TabBarComponent`
 34: type Props = SceneRendererProps & {
                  ^^^^^^^^^^^^^^^^^^ property `position`. Property not found in. See: node_modules/react-native-tab-view/src/TabBarTop.js:34
225:           {...tabBarProps}
                   ^^^^^^^^^^^ spread of object literal

node_modules/@exponent/ex-navigation/src/sliding-tab/ExNavigationSlidingTab.js:223
223:         <TabBarComponent
             ^ React element `TabBarComponent`
 34: type Props = SceneRendererProps & {
                  ^^^^^^^^^^^^^^^^^^ property `subscribe`. Property not found in. See: node_modules/react-native-tab-view/src/TabBarTop.js:34
225:           {...tabBarProps}
                   ^^^^^^^^^^^ spread of object literal

node_modules/@exponent/ex-navigation/src/tab/ExNavigationTab.js:173
173:         {tabs.map(tab => this.renderTab(tab))}
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ call of method `map`
173:         {tabs.map(tab => this.renderTab(tab))}
                                             ^^^ undefined. This type is incompatible with
178:   renderTab(tabItem: Object) {
                          ^^^^^^ object type

@zoontek
Copy link

zoontek commented Nov 28, 2016

Any ETA on this? 😃

@excitement-engineer
Copy link

excitement-engineer commented Dec 21, 2016

I am also running into this issue with flow version 0.35.0.

I also got the following errors:

node_modules/react-native/Libraries/EventEmitter/EmitterSubscription.js:0
EmitterSubscription. Duplicate module provider
current provider. See: node_modules/fbemitter/lib/EmitterSubscription.js:0

node_modules/react-native/Libraries/EventEmitter/EventSubscription.js:0
EventSubscription. Duplicate module provider
current provider. See: node_modules/fbemitter/lib/EventSubscription.js:0

node_modules/react-native/Libraries/EventEmitter/EventSubscriptionVendor.js:0
EventSubscriptionVendor. Duplicate module provider
current provider. See: node_modules/fbemitter/lib/EventSubscriptionVendor.js:0

node_modules/react-static-container/lib/StaticContainer.react.js:0
StaticContainer.react. Duplicate module provider
current provider. See: node_modules/react-native/Libraries/Components/StaticContainer.js:0

I was able to ignore the errors by adding the following to my .flowconfig.

[ignore]
; ex-navigation isn't compatible with the newest flow version, ignore it
.*/node_modules/@exponent/*

; These errors occur from importing ex-navigation
.*/node_modules/react-static-container/.*
.*/node_modules/fbemitter/lib/EmitterSubscription.js
.*/node_modules/fbemitter/lib/EventSubscription.js
.*/node_modules/fbemitter/lib/EventSubscriptionVendor.js

Note with this solution you need to force flow to ignore any imports from ex-navigation because it won't be able to find the module. Ignore as follows:

// $FlowFixMe
import {} from '@exponent/ex-navigation';

Are you still working on this @grabbou ?

motorica-org-bot pushed a commit to motorica-org/telemetry-ga-android that referenced this issue Feb 3, 2017
tl;dr use `flow-check` script to typecheck code.

Add a babel plugin to strip out type declarations from resulting code,
thus making it possible to actually write them and have things working
afterwards.

Also brings in `flow-result-checker`, an ugly workaround for
facebook/flow#869 - the tl;dr is Flow reports
type errors in all the `//@flow`'ed files, including ones in
`node_modules` - which isn't entirely helpful.

This affects us due to expo/ex-navigation#87,
the tl;dr for which is ex-navigation has type errors and no one seems
to be working on it ATM.

So, code can currently be typechecked as mentioned at the top of the
commit message; also, one of the components has been annotated to demonstrate.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

7 participants