import React, { useState } from 'react'; import { StyleSheet, View } from 'react-native'; import { Modal } from '../Modal'; import { Button, ButtonProps } from '../Button'; import Header from './Header'; import Footer from './Footer'; import Content from './Content'; import { PopConfirmProvider } from './Context'; import type { PopConfirmProps } from './types'; import { Box } from '../Box'; import { Divider } from '../Divider'; import { HEIGHT_DIVIDER } from './constants'; type ExportComponent = { Header: typeof Header; Content: typeof Content; }; export const PopConfirm: React.FC & ExportComponent = ({ children, visible, onClose, onOk, extra, actions, okText = 'Continue', cancelText = 'Cancel', type = 'default' }) => { return ( ) } > {children} {(onOk || !!actions?.length) && (
{actions?.map?.((action, index) => ( ))} {onOk && ( {okText} )}
)}
); }; function ButtonState({ onPress, ...rest }: ButtonProps) { const [isLoading, setIsLoading] = useState(false); const onInternalPress: ButtonProps['onPress'] = async (args) => { setIsLoading(true); await onPress?.(args); setIsLoading(false); }; return (