import * as React from 'react'; import { useMemo } from 'react'; import { View, StyleSheet } from 'react-native'; import { themeStyle } from './global-style'; import Modal from './Modal'; import { PrimaryButton } from './buttons'; import { _ } from '@joplin/lib/locale'; import { Button } from 'react-native-paper'; interface Props { themeId: number; children: React.ReactNode; buttonBarEnabled: boolean; okTitle: string; cancelTitle: string; onOkPress: ()=> void; onCancelPress: ()=> void; } const useStyles = (themeId: number) => { return useMemo(() => { const theme = themeStyle(themeId); return StyleSheet.create({ container: { borderRadius: 4, backgroundColor: theme.backgroundColor, maxWidth: 600, maxHeight: 500, width: '100%', height: '100%', alignSelf: 'center', marginVertical: 'auto', flexGrow: 1, flexShrink: 1, padding: theme.margin, }, title: theme.headerStyle, contentWrapper: { flexGrow: 1, flexShrink: 1, }, buttonRow: { flexDirection: 'row', justifyContent: 'flex-end', gap: theme.margin, marginTop: theme.marginTop, }, // Ensures that screen-reader-only headings have size (necessary for focusing/reading them). invisibleHeading: { flexGrow: 1, }, }); }, [themeId]); }; const ModalDialog: React.FC = props => { const styles = useStyles(props.themeId); const theme = themeStyle(props.themeId); return ( {props.children} {props.okTitle} ); }; export default ModalDialog;