reactotron-react-native
Version:
A development tool to explore, inspect, and diagnose your React Native apps.
37 lines (36 loc) • 1.2 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _react = _interopRequireDefault(require("react"));
var _mitt = _interopRequireDefault(require("mitt"));
var _storybook = _interopRequireDefault(require("./storybook"));
var _jsxRuntime = require("react/jsx-runtime");
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
/**
* A plugin which provides .storybookSwitcher() on Reactotron.
*/
var _default = () => () => {
const emitter = (0, _mitt.default)();
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__*/(0, _jsxRuntime.jsx)(_storybook.default, {
storybookUi: storybookUi,
emitter: emitter,
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(WrappedComponent, {
...props
})
});
}
}
};
};
exports.default = _default;
//# sourceMappingURL=index.js.map