diff --git a/src/components/ConfirmContent.js b/src/components/ConfirmContent.js deleted file mode 100644 index 13685c7392bb..000000000000 --- a/src/components/ConfirmContent.js +++ /dev/null @@ -1,173 +0,0 @@ -import PropTypes from 'prop-types'; -import React from 'react'; -import {View} from 'react-native'; -import _ from 'underscore'; -import useLocalize from '@hooks/useLocalize'; -import useNetwork from '@hooks/useNetwork'; -import useTheme from '@hooks/useTheme'; -import useThemeStyles from '@hooks/useThemeStyles'; -import variables from '@styles/variables'; -import Button from './Button'; -import Header from './Header'; -import Icon from './Icon'; -import sourcePropTypes from './Image/sourcePropTypes'; -import Text from './Text'; - -const propTypes = { - /** Title of the modal */ - title: PropTypes.string.isRequired, - - /** A callback to call when the form has been submitted */ - onConfirm: PropTypes.func.isRequired, - - /** A callback to call when the form has been closed */ - onCancel: PropTypes.func, - - /** Confirm button text */ - confirmText: PropTypes.string, - - /** Cancel button text */ - cancelText: PropTypes.string, - - /** Modal content text/element */ - prompt: PropTypes.oneOfType([PropTypes.string, PropTypes.element]), - - /** Whether we should use the success button color */ - success: PropTypes.bool, - - /** Whether we should use the danger button color. Use if the action is destructive */ - danger: PropTypes.bool, - - /** Whether we should disable the confirm button when offline */ - shouldDisableConfirmButtonWhenOffline: PropTypes.bool, - - /** Whether we should show the cancel button */ - shouldShowCancelButton: PropTypes.bool, - - /** Icon to display above the title */ - iconSource: PropTypes.oneOfType([PropTypes.string, sourcePropTypes]), - - /** Whether to center the icon / text content */ - shouldCenterContent: PropTypes.bool, - - /** Whether to stack the buttons */ - shouldStackButtons: PropTypes.bool, - - /** Styles for title */ - // eslint-disable-next-line react/forbid-prop-types - titleStyles: PropTypes.arrayOf(PropTypes.object), - - /** Styles for prompt */ - // eslint-disable-next-line react/forbid-prop-types - promptStyles: PropTypes.arrayOf(PropTypes.object), - - /** Styles for view */ - // eslint-disable-next-line react/forbid-prop-types - contentStyles: PropTypes.arrayOf(PropTypes.object), - - /** Styles for icon */ - // eslint-disable-next-line react/forbid-prop-types - iconAdditionalStyles: PropTypes.arrayOf(PropTypes.object), -}; - -const defaultProps = { - confirmText: '', - cancelText: '', - prompt: '', - success: true, - danger: false, - onCancel: () => {}, - shouldDisableConfirmButtonWhenOffline: false, - shouldShowCancelButton: true, - contentStyles: [], - iconSource: null, - shouldCenterContent: false, - shouldStackButtons: true, - titleStyles: [], - promptStyles: [], - iconAdditionalStyles: [], -}; - -function ConfirmContent(props) { - const styles = useThemeStyles(); - const theme = useTheme(); - const {translate} = useLocalize(); - const {isOffline} = useNetwork(); - - const isCentered = props.shouldCenterContent; - - return ( - - - {!_.isEmpty(props.iconSource) || - (_.isFunction(props.iconSource) && ( - - - - ))} - - -
- - - {_.isString(props.prompt) ? {props.prompt} : props.prompt} - - - {props.shouldStackButtons ? ( - <> -