Summary: Previously we used <Link/> everywhere with useBaseUrl to avoid link destinations depending on the current url of the page. This isn't necessary if you instead link to the **file name**, rather than the **url path**. Then the links are resolved at build time, and work across imported markdown files etc. This diff just does the pages under Features, because other ones will get conflicts. I'll do those later. Reviewed By: nikoant Differential Revision: D25589707 fbshipit-source-id: 35ca986e19fc2af1054b81d7253eeb3827947ab8
64 lines
4.0 KiB
Plaintext
64 lines
4.0 KiB
Plaintext
---
|
||
id: react-native
|
||
title: React Native Support
|
||
---
|
||
import useBaseUrl from '@docusaurus/useBaseUrl';
|
||
|
||
<img alt="React Native + React DevTools" src={useBaseUrl("img/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/index.mdx#setup-your-react-native-app)
|
||
|
||
<center>
|
||
<iframe width="560" height="315" src="https://www.youtube.com/embed/WltZTn3ODW4" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
|
||
<br/><em>Flipper: The Extensible DevTool Platform for React Native</em>
|
||
</center>
|
||
|
||
## 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”.
|
||
|
||
<img alt="React Native Action Buttons and Logs" src={useBaseUrl("img/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 well. Example plugins include:
|
||
|
||
* Device logs
|
||
* Device crash reporter
|
||
* Inspecting network requests
|
||
* 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.
|
||
|
||
<img alt="Tic Tac Toe example plugin" src={useBaseUrl("img/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](../tutorial/react-native.mdx)
|
||
* [Create a Flipper Desktop Plugin](../tutorial/js-setup.mdx)
|
||
|
||
### Community React Native plugins for Flipper
|
||
|
||
The React Native community has also started to build plugins for Flipper.
|
||
|
||
* [Reactotron's](https://infinite.red/reactotron) [Flipper plugin](https://github.com/infinitered/flipper-plugin-reactotron) is an example of a standalone React Native desktop app, [ported to work as a Flipper plugin](https://shift.infinite.red/better-react-native-debugging-with-reactotron-in-flipper-6b823af29220).
|
||
|
||
*Got your own Flipper plugin for React Native you want to plug here? Please sent us a [Pull Request](https://github.com/facebook/flipper/blob/master/docs/features/react-native.mdx)!*
|