Skip to content

Commit 068af15

Browse files
committed
Add docs for Flipper plugin
1 parent e4ccad5 commit 068af15

File tree

5 files changed

+60
-11
lines changed

5 files changed

+60
-11
lines changed
Loading
Loading
325 KB
Loading

versioned_docs/version-5.x/devtools.md

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ sidebar_label: Developer tools
66

77
Developer tools to make debugging easier when using React Navigation.
88

9-
To configure the developer tools, install [`@react-navigation/devtools`](https://github.com/react-navigation/react-navigation/tree/master/packages/devtools):
9+
To use the developer tools, install [`@react-navigation/devtools`](https://github.com/react-navigation/react-navigation/tree/master/packages/devtools):
1010

1111
```bash npm2yarn
1212
npm install @react-navigation/devtools
@@ -18,19 +18,19 @@ The package exposes the following APIs:
1818

1919
### `useReduxDevToolsExtension`
2020

21-
This hook provides integration with [Redux DevTools Extension](https://github.com/zalmoxisus/redux-devtools-extension).It also works with [`React Native Debugger app`](https://github.com/jhen0409/react-native-debugger) which includes this extension.
21+
This hook provides integration with [Redux DevTools Extension](https://github.com/zalmoxisus/redux-devtools-extension). It also works with [`React Native Debugger app`](https://github.com/jhen0409/react-native-debugger) which includes this extension.
2222

23-
The hook accepts a `ref` to the `NavigationContainer` as its argument.
23+
**Usage:**
2424

25-
Usage:
25+
To use the hook, import it and pass a `ref` to the `NavigationContainer` as its argument:
2626

2727
```js
2828
import * as React from 'react';
29-
import { NavigationContainer } from '@react-navigation/native';
29+
import { NavigationContainer, useNavigationContainerRef } from '@react-navigation/native';
3030
import { useReduxDevToolsExtension } from '@react-navigation/devtools';
3131

3232
export default function App() {
33-
const navigationRef = React.useRef();
33+
const navigationRef = useNavigationContainerRef();
3434

3535
useReduxDevToolsExtension(navigationRef);
3636

@@ -40,4 +40,6 @@ export default function App() {
4040
}
4141
```
4242

43+
Now, you'll be able to see logs from React Navigation in Redux DevTools Extension, e.g. when you're debugging your app with React Native Debugger app.
44+
4345
The hook only works during development and is disabled in production. You don't need to do anything special to remove it from the production build.

versioned_docs/version-6.x/devtools.md

Lines changed: 52 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,23 +6,70 @@ sidebar_label: Developer tools
66

77
Developer tools to make debugging easier when using React Navigation.
88

9-
To configure the developer tools, install [`@react-navigation/devtools`](https://github.com/react-navigation/react-navigation/tree/master/packages/devtools):
9+
To use the developer tools, install [`@react-navigation/devtools`](https://github.com/react-navigation/react-navigation/tree/master/packages/devtools):
1010

1111
```bash npm2yarn
1212
npm install @react-navigation/devtools@next
1313
```
1414

15+
Hooks from this package only work during development and are disabled in production. You don't need to do anything special to remove them from the production build.
16+
1517
## API Definition
1618

1719
The package exposes the following APIs:
1820

21+
### `useFlipper`
22+
23+
This hook provides integration with [Flipper](https://fbflipper.com/) for React Native apps.
24+
25+
> This doesn't work in Expo managed apps since they don't support Flipper.
26+
27+
To be able to use this hook, you need to:
28+
29+
- [Configure Flipper in your React Native app](https://fbflipper.com/docs/features/react-native/) if it's not configured already
30+
- Install the `react-native-flipper` package in your app:
31+
32+
```bash npm2yarn
33+
npm install --save-dev react-native-flipper
34+
```
35+
36+
- Install the `react-navigation` plugin in the Flipper app
37+
38+
![Install Flipper](/devtools/flipper-plugin-install.png)
39+
40+
**Usage:**
41+
42+
To use the hook, import it and pass a `ref` to the `NavigationContainer` as its argument:
43+
44+
```js
45+
import * as React from 'react';
46+
import { NavigationContainer, useNavigationContainerRef } from '@react-navigation/native';
47+
import { useFlipper } from '@react-navigation/devtools';
48+
49+
export default function App() {
50+
const navigationRef = useNavigationContainerRef();
51+
52+
useFlipper(navigationRef);
53+
54+
return (
55+
<NavigationContainer ref={navigationRef}>{/* ... */}</NavigationContainer>
56+
);
57+
}
58+
```
59+
60+
Now, you'll be able to use the React Navigation devtools in Flipper whenever your device is connected to Flipper.
61+
62+
![React Navigation Logs](/devtools/flipper-plugin-logs.png)
63+
64+
![React Navigation Linking](/devtools/flipper-plugin-linking.png)
65+
1966
### `useReduxDevToolsExtension`
2067

21-
This hook provides integration with [Redux DevTools Extension](https://github.com/zalmoxisus/redux-devtools-extension).It also works with [`React Native Debugger app`](https://github.com/jhen0409/react-native-debugger) which includes this extension.
68+
This hook provides integration with [Redux DevTools Extension](https://github.com/zalmoxisus/redux-devtools-extension). It also works with [`React Native Debugger app`](https://github.com/jhen0409/react-native-debugger) which includes this extension.
2269

23-
The hook accepts a `ref` to the `NavigationContainer` as its argument.
70+
**Usage:**
2471

25-
Usage:
72+
To use the hook, import it and pass a `ref` to the `NavigationContainer` as its argument:
2673

2774
```js
2875
import * as React from 'react';
@@ -40,4 +87,4 @@ export default function App() {
4087
}
4188
```
4289

43-
The hook only works during development and is disabled in production. You don't need to do anything special to remove it from the production build.
90+
Now, you'll be able to see logs from React Navigation in Redux DevTools Extension, e.g. when you're debugging your app with React Native Debugger app.

0 commit comments

Comments
 (0)