You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1 line
3.6 KiB

{"ast":null,"code":"import { CurrentRenderContext } from '@react-navigation/core';\nimport * as React from 'react';\nimport ServerContext from \"./ServerContext\";\nexport default React.forwardRef(function ServerContainer(_ref, ref) {\n var children = _ref.children,\n location = _ref.location;\n React.useEffect(function () {\n console.error(\"'ServerContainer' should only be used on the server with 'react-dom/server' for SSR.\");\n }, []);\n var current = {};\n if (ref) {\n var value = {\n getCurrentOptions: function getCurrentOptions() {\n return current.options;\n }\n };\n if (typeof ref === 'function') {\n ref(value);\n } else {\n ref.current = value;\n }\n }\n return React.createElement(ServerContext.Provider, {\n value: {\n location: location\n }\n }, React.createElement(CurrentRenderContext.Provider, {\n value: current\n }, children));\n});","map":{"version":3,"sources":["ServerContainer.tsx"],"names":["CurrentRenderContext","React","ServerContext","forwardRef","ServerContainer","children","location","ref","useEffect","console","error","current","value","getCurrentOptions","options"],"mappings":"AAAA,SAASA,oBAAoB,QAAQ,wBAAwB;AAC7D,OAAO,KAAKC,KAAK,MAAM,OAAO;AAE9B,OAAOC,aAAa;AAcpB,eAAeD,KAAK,CAACE,UAAU,CAAC,SAASC,eAAe,CAAA,IAAA,EAEtDG,GAAkC,EAClC;EAFA,IAAEF,QAAQ,GAAmB,IAAA,CAA3BA,QAAQ;IAAEC,QAAAA,GAAiB,IAAA,CAAjBA,QAAAA;EAGZL,KAAK,CAACO,SAAS,CAAC,YAAM;IACpBC,OAAO,CAACC,KAAK,CACX,sFAAsF,CACvF;EACH,CAAC,EAAE,EAAE,CAAC;EAEN,IAAMC,OAA6B,GAAG,CAAC,CAAC;EAExC,IAAIJ,GAAG,EAAE;IACP,IAAMK,KAAK,GAAG;MACZC,iBAAiB,+BAAG;QAClB,OAAOF,OAAO,CAACG,OAAO;MACxB;IACF,CAAC;IAMD,IAAI,OAAOP,GAAG,KAAK,UAAU,EAAE;MAC7BA,GAAG,CAACK,KAAK,CAAC;IACZ,CAAC,MAAM;MAELL,GAAG,CAACI,OAAO,GAAGC,KAAK;IACrB;EACF;EAEA,OACE,KAAA,CAAA,aAAA,CAAC,aAAa,CAAC,QAAQ,EAAA;IAAC,KAAK,EAAE;MAAEN,QAAAA,EAAAA;IAAS;EAAE,CAAA,EAC1C,KAAA,CAAA,aAAA,CAAC,oBAAoB,CAAC,QAAQ,EAAA;IAAC,KAAK,EAAEK;EAAQ,CAAA,EAC3CN,QAAQ,CACqB,CACT;AAE7B,CAAC,CAAC","sourceRoot":"../../src","sourcesContent":["import { CurrentRenderContext } from '@react-navigation/core';\nimport * as React from 'react';\nimport ServerContext from './ServerContext';\n/**\n * Container component for server rendering.\n *\n * @param props.location Location object to base the initial URL for SSR.\n * @param props.children Child elements to render the content.\n * @param props.ref Ref object which contains helper methods.\n */\nexport default /*#__PURE__*/React.forwardRef(function ServerContainer(_ref, ref) {\n let {\n children,\n location\n } = _ref;\n React.useEffect(() => {\n console.error(\"'ServerContainer' should only be used on the server with 'react-dom/server' for SSR.\");\n }, []);\n const current = {};\n if (ref) {\n const value = {\n getCurrentOptions() {\n return current.options;\n }\n };\n\n // We write to the `ref` during render instead of `React.useImperativeHandle`\n // This is because `useImperativeHandle` will update the ref after 'commit',\n // and there's no 'commit' phase during SSR.\n // Mutating ref during render is unsafe in concurrent mode, but we don't care about it for SSR.\n if (typeof ref === 'function') {\n ref(value);\n } else {\n // @ts-expect-error: the TS types are incorrect and say that ref.current is readonly\n ref.current = value;\n }\n }\n return /*#__PURE__*/React.createElement(ServerContext.Provider, {\n value: {\n location\n }\n }, /*#__PURE__*/React.createElement(CurrentRenderContext.Provider, {\n value: current\n }, children));\n});\n//# sourceMappingURL=ServerContainer.js.map"]},"metadata":{},"sourceType":"module"}