react-native-debug-toolkit
Version:
A simple yet powerful debugging toolkit for React Native with a convenient floating UI for development
63 lines (56 loc) • 1.7 kB
JavaScript
import { Platform } from 'react-native';
import NativeDebugLibs from '../NativeDebugLibs';
// Define available third-party debug libraries
const availableLibs = [
{
id: 'flex',
name: 'FLEX',
description: 'In-app debugging and exploration tool for iOS',
platform: 'ios',
icon: 'tools',
actions: [
{ id: 'showExplorer', label: 'Show Explorer', method: NativeDebugLibs.showExplorer },
{ id: 'hideExplorer', label: 'Hide Explorer', method: NativeDebugLibs.hideExplorer },
]
},
{
id: 'doraemonkit',
name: 'DoraemonKit',
description: 'A full-featured iOS & Android development assistant',
platform: 'both',
icon: 'box',
actions: [
{ id: 'showDoraemonKit', label: 'Show DoraemonKit', method: NativeDebugLibs.showDoraemonKit },
{ id: 'hideDoraemonKit', label: 'Hide DoraemonKit', method: NativeDebugLibs.hideDoraemonKit },
]
}
];
// Get libraries available for current platform
const getPlatformLibs = () => {
const currentPlatform = Platform.OS;
return availableLibs.filter(lib =>
lib.platform === 'both' || lib.platform === currentPlatform
);
};
// Setup function is minimal since we're just presenting UI options
const setup = () => {
// No additional setup needed beyond initialization
};
// Get data - return available libraries for this platform
const getData = () => {
return getPlatformLibs();
};
// Cleanup function (if needed)
const cleanup = () => {
// Nothing specific to clean up
};
// Export the feature factory function
export const createThirdPartyLibsFeature = () => {
return {
name: 'thirdPartyLibs',
label: 'Debug Libraries',
setup,
getData,
cleanup
};
};