UNPKG

@embrace-io/react-native-navigation

Version:

A React Native wrapper for the OTel Navigation instrumentation library that creates telemetry data representing Navigation changes

25 lines (24 loc) 1.02 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.EmbraceNavigationWrapper = void 0; const React = require("react"); const react_1 = require("react"); const EMBRACE_ATTRIBUTES = { "emb.type": "ux.view", }; const EmbraceNavigationWrapper = (NavigationComponent) => (0, react_1.forwardRef)((props, ref) => { const { children, tracerProvider, screenAttributes, debug = true, tracerOptions, } = props; const attributes = (0, react_1.useMemo)(() => { if (screenAttributes) { return Object.assign(Object.assign({}, screenAttributes), EMBRACE_ATTRIBUTES); } return EMBRACE_ATTRIBUTES; }, [screenAttributes]); return (React.createElement(NavigationComponent, { ref: ref, provider: tracerProvider, config: { attributes, debug, tracerOptions, } }, children)); }); exports.EmbraceNavigationWrapper = EmbraceNavigationWrapper; EmbraceNavigationWrapper.displayName = "EmbraceNavigationWrapper";