Show better error message when accessing React APIs on React Native#8099
Closed
satya164 wants to merge 2 commits into
Closed
Show better error message when accessing React APIs on React Native#8099satya164 wants to merge 2 commits into
satya164 wants to merge 2 commits into
Conversation
|
By analyzing the blame information on this pull request, we identified @sebmarkbage and @nicklockwood to be potential reviewers. |
Contributor
Author
|
I'll fix the flow error soon. |
Contributor
There was a problem hiding this comment.
Is it possible to make these __DEV__ only? (preferably the whole definition, otherwise just the method contents).
Contributor
Author
There was a problem hiding this comment.
@javache thanks. will make the method contents __DEV__ only. I don't think I can do that for the whole block.
Contributor
Author
|
@javache updated :) |
Contributor
|
@facebook-github-bot shipit |
|
Thanks for importing. If you are an FB employee go to Phabricator to review. |
grabbou
pushed a commit
that referenced
this pull request
Jun 21, 2016
Summary: **Motivation:** Lots of examples on the web still have the old way to import React APIs from React Native. Also when someone upgrades to latest version of React Native without reading the release notes can get confused. This PR adds getters for `createClass` and `Component` and throws an error with a better error message when they are accessed.  **Test plan:** Trying to use `ReactNative.createClass` or `ReactNative.Component` will throw an error with this error message. There's currently a bug in `symbolicateStackTrace` which actually crashes the app after showing the error due to the `stack` being null when updating the stack trace. But that's a separate issue which should be fixed separately. For now, to prevent the crash, we need to add the following before the return statement here - https://github.com/facebook/react-native/blob/master/Libraries/JavaScriptAppEn Closes #8099 Differential Revision: D3430468 Pulled By: javache fbshipit-source-id: c098e51e1f2c276d87eca6da3bd91a457d7840c5
This pull request was closed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation:
Lots of examples on the web still have the old way to import React APIs from React Native. Also when someone upgrades to latest version of React Native without reading the release notes can get confused. This PR adds getters for
createClassandComponentand throws an error with a better error message when they are accessed.Test plan:
Trying to use
ReactNative.createClassorReactNative.Componentwill throw an error with this error message.There's currently a bug in
symbolicateStackTracewhich actually crashes the app after showing the error due to thestackbeing null when updating the stack trace. But that's a separate issue which should be fixed separately. For now, to prevent the crash, we need to add the following before the return statement here - https://github.com/facebook/react-native/blob/master/Libraries/JavaScriptAppEngine/Initialization/symbolicateStackTrace.js#L29,There's still the issue of
stackbeing null, which prevents us from showing a proper stack trace.Related #7722
cc @mkonicek