amis-rpc-design/node_modules/@react-navigation/elements/lib/module/getNamedContext.js

15 lines
571 B
JavaScript
Raw Normal View History

2023-10-07 19:42:30 +08:00
import * as React from 'react';
const contexts = '__react_navigation__elements_contexts';
// We use a global variable to keep our contexts so that we can reuse same contexts across packages
global[contexts] = global[contexts] ?? new Map();
export function getNamedContext(name, initialValue) {
let context = global[contexts].get(name);
if (context) {
return context;
}
context = /*#__PURE__*/React.createContext(initialValue);
context.displayName = name;
global[contexts].set(name, context);
return context;
}
//# sourceMappingURL=getNamedContext.js.map