UNPKG

@tamagui/react-native-web-lite

Version:
89 lines 3.48 kB
var __create = Object.create; var __defProp = Object.defineProperty; var __getOwnPropDesc = Object.getOwnPropertyDescriptor; var __getOwnPropNames = Object.getOwnPropertyNames; var __getProtoOf = Object.getPrototypeOf; 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 __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: true }) : target, mod)); var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", { value: true }), mod); var VirtualizedListContext_exports = {}; __export(VirtualizedListContext_exports, { VirtualizedListCellContextProvider: () => VirtualizedListCellContextProvider, VirtualizedListContext: () => VirtualizedListContext, VirtualizedListContextProvider: () => VirtualizedListContextProvider, VirtualizedListContextResetter: () => VirtualizedListContextResetter }); module.exports = __toCommonJS(VirtualizedListContext_exports); var import_VirtualizedList = require("../VirtualizedList/index.cjs"); var React = __toESM(require("react"), 1); var import_react = require("react"); var import_jsx_runtime = require("react/jsx-runtime"); const __DEV__ = process.env.NODE_ENV !== "production"; const VirtualizedListContext = React.createContext(null); if (__DEV__) { VirtualizedListContext.displayName = "VirtualizedListContext"; } function VirtualizedListContextResetter({ children }) { return /* @__PURE__ */(0, import_jsx_runtime.jsx)(VirtualizedListContext.Provider, { value: null, children }); } function VirtualizedListContextProvider({ children, value }) { const context = (0, import_react.useMemo)(() => ({ 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({ cellKey, children }) { const currContext = (0, import_react.useContext)(VirtualizedListContext); const context = (0, import_react.useMemo)(() => currContext == null ? null : { ...currContext, cellKey }, [currContext, cellKey]); return /* @__PURE__ */(0, import_jsx_runtime.jsx)(VirtualizedListContext.Provider, { value: context, children }); }