Skip to content
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

Added debugging docs #3446

Merged
merged 42 commits into from
Sep 22, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
fb5b1ab
Design PoC
Kwasow Aug 5, 2022
7bb7583
Added list of debugging tools with description
Kwasow Aug 5, 2022
6e6c099
Prepared table, map and constants
Kwasow Aug 5, 2022
30812a9
Added the obvious ones
Kwasow Aug 5, 2022
961e95d
Added smooth scrolling behaviour
Kwasow Aug 5, 2022
80f3eec
Finished JSC
Kwasow Aug 5, 2022
8e2a369
Updated table style
Kwasow Aug 5, 2022
3088ca2
More visual improvements
Kwasow Aug 5, 2022
43a0333
Finished Chrome debugger
Kwasow Aug 8, 2022
9e3cce5
Design updates
Kwasow Aug 8, 2022
2b6559c
Finished Safari DevTools
Kwasow Aug 8, 2022
a77fefe
Only Chrome DevTools left
Kwasow Aug 8, 2022
c5815c5
Minor wording changes
Kwasow Aug 8, 2022
a27cfef
Added description of testing setup
Kwasow Aug 8, 2022
1e5b991
Fixed code block styles
Kwasow Aug 8, 2022
d156185
Completed the 'Debugging Reanimated' section
Kwasow Aug 8, 2022
acb7e39
Minor improvements
Kwasow Aug 8, 2022
0174cc1
Minor improvement
Kwasow Aug 8, 2022
189af95
Fixed tsc issues
Kwasow Aug 8, 2022
e5f95cd
Improved details map implementation
Kwasow Aug 8, 2022
5ef69f1
Mmmm, this minor UI change makes it look miles better
Kwasow Aug 8, 2022
3134efe
Improvements after code review (part 1)
Kwasow Aug 8, 2022
a420533
Added linter for .md and .mdx files
Kwasow Aug 8, 2022
b88090b
Improvements after code review (part 2)
Kwasow Aug 8, 2022
aedd18a
Changed concept
Kwasow Aug 8, 2022
4d0520e
Fixed broken link
Kwasow Aug 8, 2022
9117538
Minor fixes
Kwasow Aug 8, 2022
c3d9671
Minor improvements
Kwasow Aug 9, 2022
1f769c8
Improvements after testing on mobile
Kwasow Aug 9, 2022
b1ad769
Improvements after review
Kwasow Aug 18, 2022
c049220
Added section describing differences between the JS and UI contexts
Kwasow Aug 18, 2022
1a50f74
Added docs linter to CI
Kwasow Aug 18, 2022
ace76f1
Minor improvements thanks to LanguageTool
Kwasow Aug 18, 2022
ff54d4d
Got rid of inline styles
Kwasow Aug 19, 2022
7faca3d
Fixed broken CI
Kwasow Aug 19, 2022
af23eca
Added instructions for Chrome DevTools and Flipper
Kwasow Sep 20, 2022
7aea696
Fixed broken links
Kwasow Sep 20, 2022
ef2b8c8
Added important comment
Kwasow Sep 20, 2022
345d41c
Improved Flipper and Chrome DevTools guides
Kwasow Sep 21, 2022
8a20466
Updated table icons
Kwasow Sep 22, 2022
17cc3b0
Improvements after review
Kwasow Sep 22, 2022
1d5b65b
Minor spelling fix
Kwasow Sep 22, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
99 changes: 87 additions & 12 deletions docs/docs/guide/debugging.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -138,28 +138,103 @@ thread now).
<ChromeDevToolsTable />

**Summary:**
Works, but only the JS context can be debugged.
Works and both contexts can be debugged.

Even though Chrome DevTools supports the Hermes and V8 engines, it
unfortunately doesn't recognize Reanimated's additional UI context. This
means that you won't be able to debug worklets and breakpoints set in them
will be ignored. All other features work as expected.
:::warning

*We are actively working on enabling worklet debugging with Chrome DevTools on Hermes.*
This is an early experimental feature.

:::

Worklet debugging is now available in Reanimated apps as an early experimental
feature. We do not recommend using Chrome DevTools to debug the UI context, but
instead try using the Flipper tool. It has fewer bugs and provides a much better
experience.

If you still want to use Chrome DevTools then follow these steps:

1. Add the `patch-package` to your project and set it up to run as a `post-install` task.

2. Add [this](/content/metro-inspector-proxy+0.72.1.patch) patch for metro and
[this](react-native-gesture-handler+2.5.0.patch) one for `react-native-gesture-handler`.

3. Go to [chrome://inspect](chrome://inspect) in a Google Chrome browser.
Kwasow marked this conversation as resolved.
Show resolved Hide resolved

4. Select the Reanimated runtime from the list. The list should look something
like this:

![Screenshot showing Chrome DevTools target selection](/img/debugging/ChromeDevToolsList.png)

You may choose either `Reanimated Runtime` or `Reaniamted Runtime experimental
Kwasow marked this conversation as resolved.
Show resolved Hide resolved
(Improved Chrome Reloads)`.

:::caution

Known issues include:
- Android app crashes after a few reloads if a debugger connection is opeb while
Kwasow marked this conversation as resolved.
Show resolved Hide resolved
performing a reload.

- iOS app crashes on every reload if a debugger connection is open while
performing a reload.

- Breakpoints might not be active after a reload even though they look as if they
were.

These **do not** affect release builds and debug builds, when the debugger connection
is closed while performing a reload.

:::

*We are actively working on improving the debugging experience with Chrome DevTools on Hermes.*

### Flipper (Hermes debugger)

<FlipperTable />

**Summary:**
Works, but only the JS context can be debugged.
Works and both contexts can be debugged.

:::warning

This is an early experimental feature.

:::

Worklet debugging is now available in Reanimated apps as an early experimental
feature. If you want to try it out follow these steps:

1. Add the `patch-package` to your project and set it up to run as a `post-install` task.

2. Add [this](/content/metro-inspector-proxy+0.72.1.patch) patch for metro and
[this](react-native-gesture-handler+2.5.0.patch) one for `react-native-gesture-handler`.

3. Install the `flipper-plugin-reanimated` plugin in flipper.

Even though Flipper supports the Hermes and V8 engines, it
unfortunately doesn't recognize Reanimated's additional UI context. This
means that you won't be able to debug worklets and breakpoints set in them
will be ignored. All other features work as expected.
4. Select the plugin from the side menu (it might be disabled) and you should
be good to go!

:::caution

Known issues include:
- Android app crashes after a few reloads if a debugger connection is opeb while
performing a reload.

- iOS app crashes on every reload if a debugger connection is open while
performing a reload.

- Breakpoints might not be active after a reload even though they look as if they
were.

- Android app crashes if the Flipper client is closed and will crash on startup
after that. This is a known Flipper issue ([link](https://github.com/facebook/flipper/issues/3026))
and is not related to Reanimated.

These **do not** affect release builds and debug builds, when the debugger connection
is closed while performing a reload.

:::

*We are actively working on enabling worklet debugging with Flipper on Hermes.*
*We are actively working on improving the debugging experience with Flipper on Hermes.*

### Safari DevTools

Expand Down
36 changes: 20 additions & 16 deletions docs/docs/guide/debugging_tables/tables.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ export function SummaryTable() {
<td className={styles.cellNormal}>Android</td>
<td className={styles.cellNotAvailable}>N/A</td>
<td className={styles.cellNormal}>✅ ²</td>
<td className={styles.cellNormal}>✅ ²</td>
<td className={styles.cellNormal}>⚛️</td>
</tr>
<tr>
<td className={styles.cellNormal}>iOS</td>
Expand All @@ -65,7 +65,7 @@ export function SummaryTable() {
<td className={styles.cellNormal}>Android</td>
<td className={styles.cellNotAvailable}>N/A</td>
<td className={styles.cellNormal}>✅ ²</td>
<td className={styles.cellNormal}>✅ ²</td>
<td className={styles.cellNormal}>⚛️</td>
</tr>
<tr>
<td className={styles.cellNormal}>iOS</td>
Expand Down Expand Up @@ -93,14 +93,14 @@ export function SummaryTable() {
<a href="#react-developer-tools">React Developer Tools</a>
</td>
<td className={styles.cellNormal}>Android</td>
<td className={styles.cellNormal}></td>
<td className={styles.cellNormal}></td>
<td className={styles.cellNormal}></td>
<td className={styles.cellNormal}>⚛️</td>
<td className={styles.cellNormal}>⚛️</td>
<td className={styles.cellNormal}>⚛️</td>
</tr>
<tr>
<td className={styles.cellNormal}>iOS</td>
<td className={styles.cellNormal}></td>
<td className={styles.cellNormal}></td>
<td className={styles.cellNormal}>⚛️</td>
<td className={styles.cellNormal}>⚛️</td>
<td className={styles.cellNotAvailable}>N/A</td>
</tr>
</tbody>
Expand All @@ -109,10 +109,14 @@ export function SummaryTable() {
the JS thread. This means that{' '}
<a href="../../api/nativeMethods/measure">measure</a> and LayoutAnimations
will not be available.
<br />² - Works, but only the JS context can be debugged.
<br />² - Experimental feature (see description).
<h4 style={{ marginBottom: 6 }}>Legend:</h4>
<ul>
<li>✅ - available in React Native apps using Reanimated</li>
<li>✅ - special features for React Native apps using Reanimated</li>
<li>
⚛️ - works the same as with all React Native apps, debugging worklets
is not available
</li>
<li>N/A - unavailable in React Native apps</li>
</ul>
</>
Expand Down Expand Up @@ -164,7 +168,7 @@ export function ChromeDevToolsTable() {
<td className={styles.cellNormal}>Android</td>
<td className={styles.cellNotAvailable}>N/A</td>
<td className={styles.cellNormal}>✅</td>
<td className={styles.cellNormal}></td>
<td className={styles.cellNormal}>⚛️</td>
</tr>
<tr>
<td className={styles.cellNormal}>iOS</td>
Expand Down Expand Up @@ -193,7 +197,7 @@ export function FlipperTable() {
<td className={styles.cellNormal}>Android</td>
<td className={styles.cellNotAvailable}>N/A</td>
<td className={styles.cellNormal}>✅</td>
<td className={styles.cellNormal}></td>
<td className={styles.cellNormal}>⚛️</td>
</tr>
<tr>
<td className={styles.cellNormal}>iOS</td>
Expand Down Expand Up @@ -249,14 +253,14 @@ export function ReactDeveloperToolsTable() {
<tbody>
<tr>
<td className={styles.cellNormal}>Android</td>
<td className={styles.cellNormal}></td>
<td className={styles.cellNormal}></td>
<td className={styles.cellNormal}></td>
<td className={styles.cellNormal}>⚛️</td>
<td className={styles.cellNormal}>⚛️</td>
<td className={styles.cellNormal}>⚛️</td>
</tr>
<tr>
<td className={styles.cellNormal}>iOS</td>
<td className={styles.cellNormal}></td>
<td className={styles.cellNormal}></td>
<td className={styles.cellNormal}>⚛️</td>
<td className={styles.cellNormal}>⚛️</td>
<td className={styles.cellNotAvailable}>N/A</td>
</tr>
</tbody>
Expand Down
Loading