UNPKG

@tamagui/react-native-web-lite

Version:
87 lines (86 loc) 3.84 kB
"use strict"; var __create = Object.create; var __defProp = Object.defineProperty; var __getOwnPropDesc = Object.getOwnPropertyDescriptor; var __getOwnPropNames = Object.getOwnPropertyNames; var __getProtoOf = Object.getPrototypeOf, __hasOwnProp = Object.prototype.hasOwnProperty; var __export = (target, all) => { for (var name in all) __defProp(target, name, { get: all[name], enumerable: !0 }); }, __copyProps = (to, from, except, desc) => { if (from && typeof from == "object" || typeof from == "function") for (let key of __getOwnPropNames(from)) !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); return to; }; var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps( // If the importer is in node compatibility mode or this is not an ESM // file that has been converted to a CommonJS file using a Babel- // compatible transform (i.e. "__esModule" has not been set), then set // "default" to the CommonJS "module.exports" for node compatibility. isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: !0 }) : target, mod )), __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod); var VirtualizedListContext_exports = {}; __export(VirtualizedListContext_exports, { VirtualizedListCellContextProvider: () => VirtualizedListCellContextProvider, VirtualizedListContext: () => VirtualizedListContext, VirtualizedListContextProvider: () => VirtualizedListContextProvider, VirtualizedListContextResetter: () => VirtualizedListContextResetter }); module.exports = __toCommonJS(VirtualizedListContext_exports); var import_jsx_runtime = require("react/jsx-runtime"), import_VirtualizedList = require("../VirtualizedList"), React = __toESM(require("react")), import_react = require("react"), __DEV__ = process.env.NODE_ENV !== "production"; var VirtualizedListContext = /* @__PURE__ */ React.createContext(null); __DEV__ && (VirtualizedListContext.displayName = "VirtualizedListContext"); function VirtualizedListContextResetter(param) { var { children } = param; return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(VirtualizedListContext.Provider, { value: null, children }); } function VirtualizedListContextProvider(param) { var { children, value } = param, context = (0, import_react.useMemo)(function() { return { cellKey: null, getScrollMetrics: value.getScrollMetrics, horizontal: value.horizontal, getOutermostParentListRef: value.getOutermostParentListRef, registerAsNestedChild: value.registerAsNestedChild, unregisterAsNestedChild: value.unregisterAsNestedChild }; }, [ value.getScrollMetrics, value.horizontal, value.getOutermostParentListRef, value.registerAsNestedChild, value.unregisterAsNestedChild ]); return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(VirtualizedListContext.Provider, { value: context, children }); } function VirtualizedListCellContextProvider(param) { var { cellKey, children } = param, currContext = (0, import_react.useContext)(VirtualizedListContext), context = (0, import_react.useMemo)(function() { return currContext == null ? null : { ...currContext, cellKey }; }, [ currContext, cellKey ]); return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(VirtualizedListContext.Provider, { value: context, children }); } // Annotate the CommonJS export names for ESM import in node: 0 && (module.exports = { VirtualizedListCellContextProvider, VirtualizedListContext, VirtualizedListContextProvider, VirtualizedListContextResetter }); //# sourceMappingURL=VirtualizedListContext.js.map