UNPKG

@dynatrace/react-native-plugin

Version:

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

34 lines (33 loc) 1.05 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.getNameFromComponent = void 0; const getNameFromComponent = (props) => { if (props !== undefined && props.children !== undefined) { let child; if (Array.isArray(props.children) && props.children.length === 1) { child = props.children[0]; } else { child = props.children; } if (child.props !== undefined && child.props.dtActionName !== undefined) { return child.props.dtActionName; } else if (child.type !== undefined) { if (child.type.displayName !== undefined) { return child.type.displayName; } else if (child.type._dtInfo !== undefined) { return child.type._dtInfo.name; } else { return child.type.name; } } } else { return 'Undefined Name'; } }; exports.getNameFromComponent = getNameFromComponent;