-
Notifications
You must be signed in to change notification settings - Fork 25k
Add basic documentation for debugging react native apps #420
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| --- | ||
| id: debugging | ||
| title: Debugging | ||
| layout: docs | ||
| category: Guides | ||
| permalink: docs/debugging.html | ||
| next: testing | ||
| --- | ||
|
|
||
| ## Debugging React Native Apps | ||
| To debug the javascript code of your react app do the following: | ||
|
|
||
| 1. Run your application in the iOS simulator. | ||
| 2. Press ```Command + D``` and a webpage should open up at [http://localhost:8081/debugger-ui](http://localhost:8081/debugger-ui). (Chrome only for now) | ||
| 3. Enable [Pause On Caught Exceptions](http://stackoverflow.com/questions/2233339/javascript-is-there-a-way-to-get-chrome-to-break-on-all-errors/17324511#17324511) for a better debugging experience. | ||
| 4. Press ```Command + Option + I``` to open the Chrome Developer tools, or open it via ```View``` -> ```Developer``` -> ```Developer Tools```. | ||
| 5. You should now be able to debug as you normally would. | ||
|
|
||
| ### Optional | ||
| Install the [React Developer Tools](https://chrome.google.com/webstore/detail/react-developer-tools/fmkadmapgofadopljbjfkapdkoienihi?hl=en) extension for Google Chrome. This will allow you to navigate the view hierarchy if you select the ```React``` tab when the developer tools are open. | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,7 +4,7 @@ title: Native Modules (iOS) | |
| layout: docs | ||
| category: Guides | ||
| permalink: docs/nativemodulesios.html | ||
| next: testing | ||
| next: debugging | ||
| --- | ||
|
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I ordered Debugging before Testing as one was user facing, and one was for contributors. I figure, you will generally use react before contributing. |
||
|
|
||
| Sometimes an app needs access to platform API, and React Native doesn't have a corresponding wrapper yet. Maybe you want to reuse some existing Objective-C or C++ code without having to reimplement it in JavaScript. Or write some high performance, multi-threaded code such as image processing, network stack, database or rendering. | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -66,6 +66,9 @@ var App = React.createClass({ | |
| <p> | ||
| All operations between the JavaScript application code and the native platform are performed asynchronously, and the native modules can also make use of additional threads as well. This means we can decode images off of the main thread, save to disk in the background, measure text and compute layouts without blocking the UI, and more. As a result, React Native apps are naturally fluid and responsive. The communication is also fully serializable, which allows us to leverage Chrome Developer Tools to debug the JavaScript while running the complete app, either in the simulator or on a physical device. | ||
| </p> | ||
| <p> | ||
| See <a href="docs/debugging.html">Debugging</a>. | ||
| </p> | ||
| <img src="/react-native/img/chrome_breakpoint.png" width="800" height="443" /> | ||
|
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I added a link to the Debugging doc right after the debugging capability is pitched. I'm not attached to this change, but I think it's a nice touch. |
||
|
|
||
| <h2>Touch Handling</h2> | ||
|
|
||
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.
A deeper explanation of how the debugging proxying works would be awesome, but beyond my current knowledge. I've kept it simple for now. I hope that someone will add more information here eventually.