Included in reactotron-react-native
is a plugin called networking
which allows you to track all XMLHttpRequests in React Native.
Wherever you setup your Reactotron in your app, you also add the additional plugin on the import
line.
import Reactotron, { networking } from 'reactotron-react-native'
Next, add it as a plugin to Reactotron.
Reactotron
.configure()
.use(networking()) // <--- here we go!
.connect()
You're done.
networking()
also accepts an object with two options:
ignoreContentTypes
: a regular expression which, when matched against theContent-Type
response header, will prevent the data from being displayed in Reactotron. You typically want to do this for images (which is the default).ignoreUrls
: a regular expression which, when matched against the URL of the XHR, will prevent the request from being tracked in Reactotron. Can be useful for ignoring noisy logging requests.
networking({
ignoreContentTypes: /^(image)\/.*$/i,
ignoreUrls: /\/(logs|symbolicate)$/,
})