Skip to content

Commit 84c742e

Browse files
Revamp the how-to-report-a-bug page (facebook#4589)
Co-authored-by: Riccardo Cipolleschi <[email protected]>
1 parent 394f0b4 commit 84c742e

File tree

6 files changed

+86
-29
lines changed

6 files changed

+86
-29
lines changed

website/community/support.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ If you need help with your React Native app, the right place to go depends on th
99

1010
The core of **React Native** is worked on full-time by Meta's React Native team. But there are far more people in the community who make key contributions and fix things. If the issue you are facing is code related, you should check the open issues in the [main repository](https://github.com/facebook/react-native/issues).
1111

12-
If you cannot find an existing issue, please refer to [How to file an issue](/contributing/how-to-file-an-issue).
12+
If you cannot find an existing issue, please refer to [How to report a bug](/contributing/how-to-report-a-bug).
1313

1414
### Upgrade support
1515

website/contributing/how-to-file-an-issue.md

Lines changed: 0 additions & 25 deletions
This file was deleted.
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
---
2+
title: How to Report a Bug
3+
---
4+
5+
Reporting a bug for React Native is one of the best way to start contributing to the project. We use [GitHub issues](https://github.com/facebook/react-native/issues) as the main channel for handling new bug reports.
6+
7+
Before opening a new bug, please [search if the bug already exists](https://github.com/facebook/react-native/issues?q=sort%3Aupdated-desc%20is%3Aissue) in our issue tracker. Most of the time, that's the fastest way to find a response as someone else already experienced the same problem.
8+
9+
If you can't find your bug in the issue tracker, you can open a new one. Once you create a new issue, make sure you:
10+
11+
- Add a description of the problem.
12+
- Follow the instructions on the [issue template](https://github.com/facebook/react-native/issues/new?template=bug_report.yml).
13+
- Add the React Native version you're using.
14+
- Add the output of the `npx @react-native-community/cli info` command.
15+
- Add screenshots and videos of the problem if applicable.
16+
17+
All the bug reports should also include a **reproducer**: the code necessary for us to understand what is going on and help us with the debugging.
18+
19+
:::warning
20+
21+
Due to high number of issues we receive, reproducers are **mandatory**. Issues without reproducer cannot be investigated and will most likely be closed.
22+
23+
:::
24+
25+
## Providing a Reproducers
26+
27+
The goal of a reproducer is to provide a way to _reproduce_ your bug. Without a reproducer, we won't be able to understand the bug, and we also won't be able to fix it.
28+
29+
The reproducer should be **minimal**: having as little dependencies as possible (ideally none other than `react-native`) as this will help us better isolate the bug.
30+
When someone on GitHub is asking for a reproducer, they're **not** asking for all of your source code.
31+
32+
You need instead to create a **minimal** project that reproduces the same crash/bug/issue you're reporting.
33+
34+
This process is crucial, as often issues are actually solved by creating a reproducer. By creating a reproducer, it will be easier to understand if the issue is related to your specific setup or if it's actually a bug inside React Native.
35+
36+
Due to the amount of traffic we have on React Native, we can accept only one of those as a valid reproducer:
37+
38+
1. For majority of bugs: send us a Pull Request with the [RNTesterPlayground.js](https://github.com/facebook/react-native/blob/main/packages/rn-tester/js/examples/Playground/RNTesterPlayground.js) edited to reproduce your bug.
39+
2. If your bug is UI related: a [Snack](https://snack.expo.dev).
40+
3. If your bug is build/upgrade related: a project using our [Reproducer Template](https://github.com/react-native-community/reproducer-react-native/generate).
41+
42+
### RNTesterPlayground.js
43+
44+
The best way for you to provide a reproducer is to open a Pull Request against React Native that edits the [`RNTesterPlayground.js`](https://github.com/facebook/react-native/blob/main/packages/rn-tester/js/examples/Playground/RNTesterPlayground.js) file.
45+
46+
:::tip
47+
48+
This reproducer will run your code against `main` of `react-native` and is the **fastest** way we have to investigate and fix your bugs.
49+
50+
:::
51+
52+
The `RNTesterPlayground.js` file is located inside the RN-Tester application, our reference App. You can read more about it how it works and how to build it inside its [dedicated README file](https://github.com/facebook/react-native/blob/main/packages/rn-tester/README.md).
53+
54+
An example of such type of reproducer is here: [Reproduce modal layout issues #50704](https://github.com/facebook/react-native/pull/50704/).
55+
56+
Once you edit the `RNTesterPlayground.js`, you'll be able to see your code running inside the **Playground** Tab of RNTester:
57+
58+
![Step one](/docs/assets/RNTesterPlayground.png)
59+
60+
### Expo Snack
61+
62+
For most UI related bugs, you reproduce them using an [Expo Snack](https://snack.expo.dev/).
63+
64+
With Expo Snack, you can run React Native code in your browser, and see it rendering right away.
65+
66+
Once you are able to reproduce your issue in an Expo Snack, click the **Save** button to get a shareble link to attach to your issue report
67+
68+
### Reproducer Template
69+
70+
For most build-related bugs instead, you should reproduce them using the [community reproducer template](https://github.com/react-native-community/reproducer-react-native).
71+
72+
This template creates a small project that runs with the React Native Community CLI and that can be used to showcase build issues.
73+
74+
The template also comes with its own CI already set up with GitHub Actions, as this will help spotting any build issues you might be having.
75+
76+
To use this template:
77+
78+
1. Click the [Use this template](https://github.com/new?template_name=reproducer-react-native&template_owner=react-native-community) button on GitHub to create a new project starting from the template.
79+
2. Clone your newly created repository locally.
80+
3. Apply the modifications to reproduce your issue.
81+
4. Attach your repository link to the new bug report you're creating.

website/sidebarsContributing.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,12 @@ export default {
1010
items: [
1111
'overview',
1212
'versioning-policy',
13+
'how-to-report-a-bug',
1314
'how-to-contribute-code',
1415
'how-to-build-from-source',
1516
'how-to-run-and-write-tests',
1617
'how-to-open-a-pull-request',
1718
'changelogs-in-pull-requests',
18-
'how-to-file-an-issue',
1919
'contribution-license-agreement',
2020
{
2121
type: 'category',

website/static/_redirects

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,9 @@
1212
/docs/testing /contributing/how-to-run-and-write-tests
1313
/docs/understanding-cli https://github.com/react-native-community/cli#react-native-cli
1414

15-
/contributing/how-to-contribute /contributing/overview
16-
/releases/release-candidate-minor /releases/release-branch-cut-and-rc0
15+
/contributing/how-to-contribute /contributing/overview
16+
/contributing/how-to-file-an-issue /contributing/how-to-report-a-bug
17+
/releases/release-candidate-minor /releases/release-branch-cut-and-rc0
1718

1819
# Redirect New Architecture docs of all versions
1920
# Note: We had to delete the older versions to get redirects to work
22.7 KB
Loading

0 commit comments

Comments
 (0)