import React from 'react' import { View } from '../View' import { Scroll } from '../Scroll' import { TypeGuards } from '@codeleap/types' import { Backdrop } from '../Backdrop' import { useBackButton } from '../../utils/hooks' import { Text } from '../Text' import { Touchable } from '../Touchable' import { ModalHeaderProps, ModalProps } from './types' import { AnyRecord, AppIcon, useNestedStylesByKey, IJSX, StyledComponentProps } from '@codeleap/styles' import { MobileStyleRegistry } from '../../Registry' import { useStylesFor } from '../../hooks' import { FadeIn, FadeOut } from 'react-native-reanimated' import { Platform, Modal as RNModal } from 'react-native' import { FullWindowOverlay } from 'react-native-screens' import { Button } from '../Button' export * from './styles' export * from './types' /** * On iOS, React Native's `Modal` renders into a separate UIWindow that sits below the system keyboard, causing keyboard-aware layouts to break inside modals. * `FullWindowOverlay` from react-native-screens renders at the top of the main UIWindow's view hierarchy instead, which the keyboard responder chain can reach. * Android does not have this issue, so the standard `RNModal` is used there. */ const Overlay = Platform.select({ ios: FullWindowOverlay, android: RNModal as any, }) const DefaultHeader = (props: ModalHeaderProps) => { const { styles, buttonStyles, title = null, showClose = false, description = null, closable, debugName, closeIconName = 'x', toggle, } = props return <> {(title || showClose || description) && ( {TypeGuards.isString(title) ? ( ) : ( title )} {(showClose && closable) ? (