UNPKG

@dynatrace/react-native-plugin

Version:

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

27 lines (26 loc) 1.24 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const Types_1 = require("../model/Types"); const ElementHelper_1 = require("./ElementHelper"); const ClassComponent_1 = require("./components/ClassComponent"); const FunctionalComponent_1 = require("./components/FunctionalComponent"); const _createElement = require('react').createElement; 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 _createElement(FunctionalComponent_1.DynatraceFunctionalComponent, {}, _createElement(type, props, ...children)); } else if (type._dtInfo.type === Types_1.Types.ClassComponent && type.prototype !== undefined && type.prototype.isReactComponent !== undefined) { return _createElement(ClassComponent_1.DynatraceClassComponent, {}, _createElement(type, props, ...children)); } else { (0, ElementHelper_1.modifyElement)(type, props, ...children); } } return _createElement(type, props, ...children); }; module.exports = { createElement, };