one
Version:
One is a React framework for web, iOS, and Android apps.
28 lines (25 loc) • 815 B
JavaScript
import { createContext, useContext } from "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 = createContext(void 0);
context.displayName = contextName;
contexts.set(contextName, context);
}
headerHeightContext = context;
return context;
}
function useHeaderHeight() {
return useContext(getHeaderHeightContext()) ?? 0;
}
export { useHeaderHeight };
//# sourceMappingURL=useHeaderHeight.mjs.map