reactotron-react-native
Version:
A development tool to explore, inspect, and diagnose your React Native apps.
32 lines (30 loc) • 879 B
JavaScript
;
import React from "react";
import mitt from "mitt";
import StorybookSwitcher from "./storybook.js";
/**
* A plugin which provides .storybookSwitcher() on Reactotron.
*/
import { jsx as _jsx } from "react/jsx-runtime";
export default () => () => {
const emitter = mitt();
return {
onCommand: command => {
if (command.type !== "storybook") return;
// relay this payload on to the emitter
emitter.emit("storybook", command.payload);
},
features: {
storybookSwitcher: storybookUi => WrappedComponent => function StorybookSwitcherContainer(props) {
return /*#__PURE__*/_jsx(StorybookSwitcher, {
storybookUi: storybookUi,
emitter: emitter,
children: /*#__PURE__*/_jsx(WrappedComponent, {
...props
})
});
}
}
};
};
//# sourceMappingURL=index.js.map