UNPKG

one

Version:

One is a React framework for web, iOS, and Android apps.

47 lines (46 loc) • 1.71 kB
var __defProp = Object.defineProperty; var __getOwnPropDesc = Object.getOwnPropertyDescriptor; var __getOwnPropNames = Object.getOwnPropertyNames; var __hasOwnProp = Object.prototype.hasOwnProperty; var __export = (target, all) => { for (var name in all) __defProp(target, name, { get: all[name], enumerable: true }); }; var __copyProps = (to, from, except, desc) => { if (from && typeof from === "object" || typeof from === "function") { for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); } return to; }; var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); var useHeaderHeight_exports = {}; __export(useHeaderHeight_exports, { useHeaderHeight: () => useHeaderHeight }); module.exports = __toCommonJS(useHeaderHeight_exports); var import_react = require("react"); const contextsKey = "__react_navigation__elements_contexts"; const contextName = "HeaderHeightContext"; let headerHeightContext; function getHeaderHeightContext() { if (headerHeightContext) return headerHeightContext; let contexts = Reflect.get(globalThis, contextsKey); if (!contexts) { contexts = /* @__PURE__ */ new Map(); Reflect.set(globalThis, contextsKey, contexts); } let context = contexts.get(contextName); if (!context) { context = (0, import_react.createContext)(void 0); context.displayName = contextName; contexts.set(contextName, context); } headerHeightContext = context; return context; } function useHeaderHeight() { return (0, import_react.useContext)(getHeaderHeightContext()) ?? 0; }