UNPKG

@dynatrace/react-native-plugin

Version:

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

30 lines (29 loc) 1.38 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.createElement = void 0; const Types_1 = require("../model/Types"); const ElementHelper_1 = require("./ElementHelper"); const ClassComponent_1 = require("./components/ClassComponent"); const FunctionalComponent_1 = require("./components/FunctionalComponent"); const react_1 = require("react"); const createElement = (type, props, ...children) => { if (type != null && type._dtInfo != null && !(0, ElementHelper_1.isDtActionIgnore)(props)) { if (type._dtInfo.type === Types_1.Types.FunctionalComponent) { return (0, react_1.createElement)(FunctionalComponent_1.DynatraceFunctionalComponent, { children: (0, react_1.createElement)(type, props, ...children), }); } else if (type._dtInfo.type === Types_1.Types.ClassComponent && type.prototype !== undefined && type.prototype.isReactComponent !== undefined) { return (0, react_1.createElement)(ClassComponent_1.DynatraceClassComponent, { children: (0, react_1.createElement)(type, props, ...children), }); } else { (0, ElementHelper_1.modifyElement)(type, props); } } return (0, react_1.createElement)(type, props, ...children); }; exports.createElement = createElement;