import React , { memo , forwardRef } from 'react' ; import Box , { IBoxProps } from '../../primitives/Box' ; import { usePropsResolution } from '../../../hooks' ; import { AlertDialogContext } from './Context' ; import { useHasResponsiveProps } from '../../../hooks/useHasResponsiveProps' ; const AlertDialogContent = ( props , ref ? ) => { const { ... newProps } = usePropsResolution ( 'AlertDialogContent' , props ) ; const { contentSize , initialFocusRef , finalFocusRef , handleClose , } = React . useContext ( AlertDialogContext ) ; React . useEffect ( ( ) => { let finalRefVal = finalFocusRef ? finalFocusRef . current : null ; if ( initialFocusRef && initialFocusRef . current ) { initialFocusRef . current . focus ( ) ; } return ( ) => { if ( finalRefVal ) { finalRefVal . focus ( ) ; } } ; } , [ initialFocusRef , finalFocusRef ] ) ; if ( useHasResponsiveProps ( props ) ) { return null ; } return ( < Box { ... contentSize } { ... newProps } ref = { ref } onAccessibilityEscape = { handleClose } aria - modal = "true" accessibilityRole = "alert" accessibilityViewIsModal / > ) ; } ; export default memo ( forwardRef ( AlertDialogContent ) ) ;