UNPKG

react-native-screen-transitions

Version:
29 lines (28 loc) 697 B
"use strict"; import { createContext, useContext, useMemo } from "react"; import { jsx as _jsx } from "react/jsx-runtime"; const KeysContext = /*#__PURE__*/createContext(undefined); export const KeysProvider = ({ children, previous, current, next }) => { const value = useMemo(() => ({ previous, current, next }), [previous, current, next]); return /*#__PURE__*/_jsx(KeysContext.Provider, { value: value, children: children }); }; export const useKeys = () => { const context = useContext(KeysContext); if (context === undefined) { throw new Error("useKeys must be used within a KeysProvider"); } return context; }; //# sourceMappingURL=keys.js.map