diff --git a/docs/assets/react-native-logs.png b/docs/assets/react-native-logs.png new file mode 100644 index 000000000..4c394b15d Binary files /dev/null and b/docs/assets/react-native-logs.png differ diff --git a/docs/assets/react-native-react.png b/docs/assets/react-native-react.png new file mode 100644 index 000000000..c7866cd60 Binary files /dev/null and b/docs/assets/react-native-react.png differ diff --git a/docs/assets/react-native-tictactoe.png b/docs/assets/react-native-tictactoe.png new file mode 100644 index 000000000..d5f67c3a5 Binary files /dev/null and b/docs/assets/react-native-tictactoe.png differ diff --git a/docs/features/react-native.md b/docs/features/react-native.md new file mode 100644 index 000000000..dacac28ad --- /dev/null +++ b/docs/features/react-native.md @@ -0,0 +1,47 @@ +--- +id: react-native +title: React Native Support +--- + +![React Native + React DevTools](/docs/assets/react-native-react.png) + +The React Native and Developer tooling teams at Facebook work in close collaboration to make sure Flipper offers top-notch value out of the box for React Native development. +Integration between React Native and Flipper is enabled out of the box in React Native version 0.62 and higher. + +→ [See setup instructions for React Native](../getting-started#setup-your-react-native-app) + +## Device type: React Native + +In Flipper there is a dedicated device type, “React Native”, that connects to a locally running Metro instance to interact with your React Native app. This device will be detected as soon as you fire up a Metro instance by running `yarn run ios` or `yarn run android` in your project. + +If Metro is connected, two new buttons will appear in Flipper’s main toolbar: “Reload” and “Open Dev Menu”. Both do exactly what their name suggests, without needing the agility of a pianist to get to the right keyboard combo inside your emulator. The “React Native” device will feature two plugins out of the box: “Logs” and “React DevTools”. + +![React Native Action Buttons and Logs](/docs/assets/react-native-logs.png) + +The React DevTools allows you to inspect the component tree and tune the props and state of your React components. + +The Logs plugins will allow you to search, filter and even put watch expressions on your logging output. This offers a much richer way to interact with your logs compared to the terminal output of Metro. + +## Native plugins for React Native + +Beyond the React Native specific Flipper plugins described above, with Flipper you will also inherit the plugin eco-system that exists for native Android and iOS apps. This means that you will be able to use plugins that are aimed at native apps for your React Native app as will. Example plugins include: + +* Device logs +* Device crash reporter +* Inspecting app local databases +* Inspecting device preferences +* Inspecting cached images +* Inspecting native layout elements + +## Writing JavaScript plugins for React Native + Flipper + +One of the greatest values of Flipper is its extensibility. Many teams across Facebook already have written their own one-off plugins that help with analysing very specific use cases. +Writing plugins for Flipper doesn't require any native code, as the Flipper SDK is exposed directly to JavaScript through the [react-native-flipper](https://www.npmjs.com/package/react-native-flipper) package. + +![Tic Tac Toe example plugin](/docs/assets/react-native-tictactoe.png) +_Example Flipper plugin: playing a game of Tic Tac Toe using Flipper and some emulators_ + +If you would love to build a specific (or generic) extension for Flipper check out the following pointers! Plugins for Flipper can be distributed through NPM so sharing them is trivial. + +→ Creating a React Native Flipper Plugin https://fbflipper.com/docs/tutorial/react-native.html +→ Create a Flipper Desktop Plugin https://fbflipper.com/docs/tutorial/js-setup.html diff --git a/website/i18n/en.json b/website/i18n/en.json index bba1b6c85..ce7c25f65 100644 --- a/website/i18n/en.json +++ b/website/i18n/en.json @@ -90,6 +90,9 @@ "features/network-plugin": { "title": "Network" }, + "features/react-native": { + "title": "React Native Support" + }, "features/sandbox-plugin": { "title": "Sandbox" }, diff --git a/website/sidebars.json b/website/sidebars.json index 14916cde2..1c6ee681f 100644 --- a/website/sidebars.json +++ b/website/sidebars.json @@ -12,7 +12,8 @@ "features/shared-preferences-plugin", "features/leak-canary-plugin", "features/crash-reporter-plugin", - "features/share-flipper-data" + "features/share-flipper-data", + "features/react-native" ] }, "setup": {