@tamagui/react-native-web-lite
Version:
React Native for Web
66 lines (65 loc) • 3.49 kB
JavaScript
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_VirtualizedList = require("../VirtualizedList"), React = __toESM(require("react"), 1), import_react = require("react"), import_jsx_runtime = require("react/jsx-runtime");
const __DEV__ = process.env.NODE_ENV !== "production";
const VirtualizedListContext = React.createContext(null);
__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), context = (0, import_react.useMemo)(
() => currContext == null ? null : { ...currContext, cellKey },
[currContext, cellKey]
);
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(VirtualizedListContext.Provider, { value: context, children });
}
//# sourceMappingURL=VirtualizedListContext.js.map