import { CurrentRenderContext } from '@react-navigation/core' ; import * as React from 'react' ; import ServerContext , { ServerContextType } from './ServerContext' ; import type { ServerContainerRef } from './types' ; type Props = ServerContextType & { children : React . ReactNode ; } ; param props . location param props . children param props . ref export default React . forwardRef ( function ServerContainer ( { children , location } , ref ) { React . useEffect ( ( ) => { console . error ( "'ServerContainer' should only be used on the server with 'react-dom/server' for SSR." ) ; } , [ ] ) ; const current = { } ; if ( ref ) { const value = { getCurrentOptions ( ) { return current . options ; } , } ; if ( typeof ref === 'function' ) { ref ( value ) ; } else { ref . current = value ; } } return ( < ServerContext . Provider value = { { location } } > < CurrentRenderContext . Provider value = { current } > { children } < /CurrentRenderContext.Provider> < /ServerContext.Provider>); } ) ;