import classNames from 'classnames' import PropTypes, { InferProps } from 'prop-types' import React from 'react' import { Modal } from 'react-native' import { View } from '@tarojs/components' import { CommonEvent } from '@tarojs/components/types/common' import { AtCurtainProps } from '../../../types/curtain' import AtIcon from '../icon' export default class AtCurtain extends React.Component { public static defaultProps: AtCurtainProps public static propTypes: InferProps private onClose(e: CommonEvent): void { this.props.onClose(e) } public render(): JSX.Element { const { className, customStyle, isOpened, closeBtnPosition } = this.props const curtainClass = classNames( { 'at-curtain': true, 'at-curtain--closed': !isOpened, }, className, ) const btnCloseClass = classNames({ 'at-curtain__btn-close': true, [`at-curtain__btn-close--${closeBtnPosition}`]: closeBtnPosition, }) return ( { this.props.onClose({} as any) }} > {this.props.children} ) } } AtCurtain.defaultProps = { customStyle: '', className: '', isOpened: false, closeBtnPosition: 'bottom', // eslint-disable-next-line @typescript-eslint/no-empty-function onClose: (): void => {}, } AtCurtain.propTypes = { customStyle: PropTypes.oneOfType([PropTypes.object, PropTypes.string]), className: PropTypes.oneOfType([PropTypes.array, PropTypes.string]), isOpened: PropTypes.bool, closeBtnPosition: PropTypes.string, onClose: PropTypes.func, }