New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
React-navigation: fixed flow type error with React$ #2522
Conversation
cc @Ashoat |
Some context: @flbaue initially reported this issue in the @sibelius, do you know if any of this has changed? @flbaue, is there anything non-standard about your environment that may be affecting things here? |
I think import does not work yet |
Hmm, but the docs page I linked above says:
|
What's confusing me is that the After reading a bit and remembering that @flbaue, if you move the |
@Ashoat If I move the import inside, the error does reoccur. So you might be right. Also I just noticed something. I am able to reproduce the type error in any project, when I render the navigator as a child of a react-redux provider. If the react-redux typedef is installed, I have the type error. If I render the Navigator as a child to a normal, self written, component, I don't have the error. I created an example here: https://github.com/flbaue/TestProject |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm. My first thought was that the issue must be with react-redux
then, but that libdef seems to any
-type Provider
's children, so I'm not sure why there would be any error...
Either way, given that this PR would any
-type every use of React
in the libdef, we definitely need some changes before we merge it.
@Ashoat Could you confirm the issue with my example? Just to make sure it's not just something weird on my side. |
This is certainly strange. If I copy the type definition of I wonder if it has to do with how |
I found another way to fix the type issue. |
Using |
I am seeing this issue now after updating the libdef for React Navigation 3.0. I'm not sure what's triggering it, but this patch allows us to circumvent the issue, and I don't have a better idea. Let's get this merged. |
1. `navigationOptions` in `RouteConfig`s is now `defaultNavigationOptions` 2. `create*Navigator` no longer return a container, they return a navigator 3. Introducing `createAppContainer` Closes react-navigation#4722 by including flow-typed/flow-typed#2522
1. `navigationOptions` in `RouteConfig`s is now `defaultNavigationOptions` 2. `create*Navigator` no longer return a container, they return a navigator 3. Introducing `createAppContainer` Closes #4722 by including flow-typed/flow-typed#2522
Done! Thanks everyone. |
1. `navigationOptions` in `RouteConfig`s is now `defaultNavigationOptions` 2. `create*Navigator` no longer return a container, they return a navigator 3. Introducing `createAppContainer` Closes #4722 by including flow-typed/flow-typed#2522
1. `navigationOptions` in `RouteConfig`s is now `defaultNavigationOptions` 2. `create*Navigator` no longer return a container, they return a navigator 3. Introducing `createAppContainer` Closes #4722 by including flow-typed/flow-typed#2522
1. `navigationOptions` in `RouteConfig`s is now `defaultNavigationOptions` 2. `create*Navigator` no longer return a container, they return a navigator 3. Introducing `createAppContainer` Closes #4722 by including flow-typed/flow-typed#2522
1. `navigationOptions` in `RouteConfig`s is now `defaultNavigationOptions` 2. `create*Navigator` no longer return a container, they return a navigator 3. Introducing `createAppContainer` Closes #4722 by including flow-typed/flow-typed#2522
I just created a new react native project (0.56) and added react-navigation (2.7.0) and flow libdef
react-navigation_v2.x.x
.As a result, I get a type error when I try to use the result of
createDrawerNavigator
(or the others).After some researching, I replaced the
React$
inside the libdef withReact.
plusimport * as React from "react"
. This is fixing the type error for me.Is this the right solution for this? Or are there any better ways?