react-native-debug-toolkit
Version:
A simple yet powerful debugging toolkit for React Native with a convenient floating UI for development
67 lines (57 loc) • 1.51 kB
JavaScript
import { NativeModules, Platform } from 'react-native'
const { RNDebugLibs, BuildTypeModule } = NativeModules
export default class NativeDebugLibs {
// Build type methods
static getBuildType() {
if (BuildTypeModule) {
return BuildTypeModule.getBuildType();
}
return Promise.resolve(null);
}
static getBuildTypeSync() {
console.log('BuildTypeModule', BuildTypeModule);
if (BuildTypeModule) {
console.log('BuildTypeModule.getBuildTypeSync()', BuildTypeModule.getBuildTypeSync());
return BuildTypeModule.getBuildTypeSync();
}
return null;
}
static isDebugBuild() {
if (BuildTypeModule) {
return BuildTypeModule.getBuildTypeSync() === 'debug';
}
return false;
}
// FLEX methods (iOS only)
static showExplorer() {
if (Platform.OS === 'ios' && RNDebugLibs) {
RNDebugLibs.showExplorer()
}
}
static hideExplorer() {
if (Platform.OS === 'ios' && RNDebugLibs) {
RNDebugLibs.hideExplorer()
}
}
static toggleExplorer() {
if (Platform.OS === 'ios' && RNDebugLibs) {
RNDebugLibs.toggleExplorer()
}
}
// DoraemonKit/DoKit methods
static installDoraemonKit(productId) {
// if (RNDebugLibs) {
// RNDebugLibs.installDoraemonKit(productId)
// }
}
static showDoraemonKit() {
// if (RNDebugLibs) {
// RNDebugLibs.showDoraemonKit()
// }
}
static hideDoraemonKit() {
// if (RNDebugLibs) {
// RNDebugLibs.hideDoraemonKit()
// }
}
}