Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Needs a way to embed only on dev mode #45

Open
paulocf92 opened this issue Nov 16, 2021 · 1 comment
Open

Needs a way to embed only on dev mode #45

paulocf92 opened this issue Nov 16, 2021 · 1 comment

Comments

@paulocf92
Copy link

It would be cool if we could apply this plugin only in development mode, much like react-query-native-devtools does.

@pke
Copy link

pke commented Apr 7, 2022

thats how @react-navigation/devtools is doing it

const noop: any = () => {};

export let useReduxDevToolsExtension: typeof import('./useReduxDevToolsExtension').default;
export let useFlipper: typeof import('./useFlipper').default;

if (process.env.NODE_ENV !== 'production') {
  useReduxDevToolsExtension = require('./useReduxDevToolsExtension').default;
  useFlipper = require('./useFlipper').default;
} else {
  useReduxDevToolsExtension = noop;
  useFlipper = noop;
}

For the time being I am doing this:

import UnsecureStorage from "@react-native-async-storage/async-storage"

let RNAsyncStorageFlipper: typeof import("rn-async-storage-flipper").default

if (process.env.NODE_ENV !== "production") {
  RNAsyncStorageFlipper = require("rn-async-storage-flipper").default
  RNAsyncStorageFlipper(UnsecureStorage)
}

export default UnsecureStorage

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants