Skip to content

Latest commit

 

History

History
51 lines (34 loc) · 1.25 KB

plugin-overlay.md

File metadata and controls

51 lines (34 loc) · 1.25 KB

Overlay

Overlay is a plugin for reactotron-react-native which allows you to have an image uploaded to your simulator to stay on top of your app.

Usage

Wherever you setup your Reactotron in your app, you also add the additional plugin on the import line.

import Reactotron, { overlay } from 'reactotron-react-native'

Add it as a plugin to Reactotron.

Reactotron
  .configure()
  .use(overlay()) // <--- here we go!
  .connect()

Next, find the root UI component in your app and wrap it.

// let's pretend this is your app.
class MyApp extends Component {
  render () {
    return <Text>I may have shipped too early.</Text>
  }
}

// let's wrap it, so the overlay stays on top!
const MyAppWithBenefits = Reactotron.overlay(MyApp)

export default MyAppWithBenefits

React Native Production Caveat

One common gotcha here is when you make production builds since reactotron-react-native is likely setup in devDependencies.

If you'd like to keep it like this (I recommend it!), then perhaps your code might look more like this:

const MyAppWithBenefits = __DEV__ ? Reactotron.overlay(MyApp) : MyApp

Another option is to ship it in your dependencies (not recommended -- but sometimes you wanna run it on a device).