UNPKG

@dynatrace/react-native-plugin

Version:

This plugin gives you the ability to use the Dynatrace Mobile agent in your react native application.

55 lines (54 loc) 2.48 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const Types_1 = require("../model/Types"); const FunctionalComponent_1 = require("./components/FunctionalComponent"); const ClassComponent_1 = require("./components/ClassComponent"); const ElementHelper_1 = require("./ElementHelper"); const ReactDevRuntime = require("react/jsx-dev-runtime"); try { const jsxDEV = (...args) => { if (args[0] !== undefined && args[0]._dtInfo !== undefined && !(0, ElementHelper_1.isDtActionIgnore)(args[1])) { if (args[0]._dtInfo.type === Types_1.Types.FunctionalComponent) { const wrapperProps = { children: ReactDevRuntime.jsxDEV(...args), }; wrapperProps.dtActionName = args[1] !== undefined && args[1].dtActionName !== undefined ? args[1].dtActionName : args[0]._dtInfo.name; if (args[2] !== undefined) { return ReactDevRuntime.jsxDEV(FunctionalComponent_1.DynatraceFunctionalComponent, wrapperProps, args[2] + '_dt'); } else { return ReactDevRuntime.jsxDEV(FunctionalComponent_1.DynatraceFunctionalComponent, wrapperProps); } } else if (args[0]._dtInfo.type === Types_1.Types.ClassComponent && args[0].prototype !== undefined && args[0].prototype.isReactComponent !== undefined) { const wrapperProps = { children: ReactDevRuntime.jsxDEV(...args), }; if (args[2] !== undefined) { return ReactDevRuntime.jsxDEV(ClassComponent_1.DynatraceClassComponent, wrapperProps, args[2] + '_dt'); } else { return ReactDevRuntime.jsxDEV(ClassComponent_1.DynatraceClassComponent, wrapperProps); } } if (Array.isArray(args[1].children)) { (0, ElementHelper_1.modifyElement)(args[0], args[1], ...args[1].children); } else { (0, ElementHelper_1.modifyElement)(args[0], args[1], args[1].children); } } return ReactDevRuntime.jsxDEV(...args); }; module.exports = Object.assign(Object.assign({}, ReactDevRuntime), { jsxDEV }); } catch (error) { module.exports = {}; }