Skip to content

Improve handling of React Native version warnings #72

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

Conversation

udfalkso
Copy link
Contributor

Using React Native, a disruptive error appears to warn about function/no-function for Provider in app root. It seems that the version check is failing as React.version is undefined in my React Native environment.

As these are just warnings, perhaps it's best to use console.warn rather than console.error? Or perhaps there is a better way to fix the version check?

{
"react": "^0.13.3",
"react-native": "^0.8.0",
"react-redux": "^1.0.0",
"redux": "^1.0.1",
"redux-thunk": "^0.1.0"
}
ios simulator screen shot aug 25 2015 11 52 03 am

@gnoff
Copy link
Contributor

gnoff commented Aug 25, 2015

@udfalkso since React Native is not using React 0.14 the correct fix would be to change https://github.com/udfalkso/react-redux/blob/console-warn-instead-of-error-for-function-wrap/src/components/createProvider.js#L6 to return true;

In fact i believe it is a genuine bug that we are returning false here since the only version of React today not using Parent Context is 0.14 beta.

@gnoff
Copy link
Contributor

gnoff commented Aug 25, 2015

mind recreating the PR with that one change? Or i can do so in a minute

@udfalkso udfalkso force-pushed the console-warn-instead-of-error-for-function-wrap branch from 29fdf27 to b820c3b Compare August 25, 2015 17:13
@udfalkso
Copy link
Contributor Author

Ok, how's that look?

@gnoff
Copy link
Contributor

gnoff commented Aug 25, 2015

perfect, can you confirm this fixes the bug on react-native?

@udfalkso
Copy link
Contributor Author

Yup, the error display goes away.

@udfalkso udfalkso changed the title change console.error to console.warn Improve handling of React Native version warnings Aug 25, 2015
@gaearon
Copy link
Contributor

gaearon commented Aug 25, 2015

Interesting. I returned false there because I assumed that today any React distribution has a version, so if it is missing, we are running a much more modern React..

@gaearon
Copy link
Contributor

gaearon commented Aug 25, 2015

There's something I don't understand then.

fbjs uses console.error for warning.
react uses warning for PropTypes validation.

How is React Native different? I think we should use the same warning kind as PropTypes validation.

gaearon added a commit that referenced this pull request Aug 25, 2015
…r-function-wrap

Improve handling of React Native version warnings
@gaearon gaearon merged commit cb80904 into reduxjs:master Aug 25, 2015
gaearon added a commit that referenced this pull request Aug 25, 2015
@gaearon
Copy link
Contributor

gaearon commented Aug 25, 2015

Should be fixed in 1.0.1.

@gnoff
Copy link
Contributor

gnoff commented Aug 25, 2015

Yeah, i figured that was the intention of the original return false; but since we are going to drop all of this logic with R14 and RN10 (hopefully) and just use a peer Dependency i figured being more conservative with the version check is the proper choice right now

@udfalkso
Copy link
Contributor Author

Thanks guys!

@gnoff
Copy link
Contributor

gnoff commented Aug 25, 2015

RE: warnings for PropTypes I actually think the red screen is what you get too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants