GT2/Ejectable/node_modules/@react-navigation/native/lib/commonjs/ServerContainer.js.map

1 line
2.7 KiB
Plaintext

{"version":3,"sources":["ServerContainer.tsx"],"names":["React","forwardRef","ServerContainer","children","location","ref","useEffect","console","error","current","value","getCurrentOptions","options"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;;;;;;;AAOA;AACA;AACA;AACA;AACA;AACA;AACA;4BACeA,KAAK,CAACC,UAAN,CAAiB,SAASC,eAAT,CAC9B;AAAEC,EAAAA,QAAF;AAAYC,EAAAA;AAAZ,CAD8B,EAE9BC,GAF8B,EAG9B;AACAL,EAAAA,KAAK,CAACM,SAAN,CAAgB,MAAM;AACpBC,IAAAA,OAAO,CAACC,KAAR,CACE,sFADF;AAGD,GAJD,EAIG,EAJH;AAMA,QAAMC,OAA6B,GAAG,EAAtC;;AAEA,MAAIJ,GAAJ,EAAS;AACP,UAAMK,KAAK,GAAG;AACZC,MAAAA,iBAAiB,GAAG;AAClB,eAAOF,OAAO,CAACG,OAAf;AACD;;AAHW,KAAd,CADO,CAOP;AACA;AACA;AACA;;AACA,QAAI,OAAOP,GAAP,KAAe,UAAnB,EAA+B;AAC7BA,MAAAA,GAAG,CAACK,KAAD,CAAH;AACD,KAFD,MAEO;AACL;AACAL,MAAAA,GAAG,CAACI,OAAJ,GAAcC,KAAd;AACD;AACF;;AAED,sBACE,oBAAC,sBAAD,CAAe,QAAf;AAAwB,IAAA,KAAK,EAAE;AAAEN,MAAAA;AAAF;AAA/B,kBACE,oBAAC,0BAAD,CAAsB,QAAtB;AAA+B,IAAA,KAAK,EAAEK;AAAtC,KACGN,QADH,CADF,CADF;AAOD,CAtCc,C","sourcesContent":["import * as React from 'react';\nimport { CurrentRenderContext } from '@react-navigation/core';\nimport ServerContext, { ServerContextType } from './ServerContext';\nimport type { ServerContainerRef } from './types';\n\ntype Props = ServerContextType & {\n children: React.ReactNode;\n};\n\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 React.forwardRef(function ServerContainer(\n { children, location }: Props,\n ref: React.Ref<ServerContainerRef>\n) {\n React.useEffect(() => {\n console.error(\n \"'ServerContainer' should only be used on the server with 'react-dom/server' for SSR.\"\n );\n }, []);\n\n const current: { options?: object } = {};\n\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\n return (\n <ServerContext.Provider value={{ location }}>\n <CurrentRenderContext.Provider value={current}>\n {children}\n </CurrentRenderContext.Provider>\n </ServerContext.Provider>\n );\n});\n"]}