import React from 'react'; import SignatureCanvas from 'react-signature-canvas'; import { Button, Modal, Tag } from 'antd'; import { VerifiedOutlined } from '@ant-design/icons'; class IceSignature extends React.Component { constructor(props) { super(props); this.onChange = props.onChange; this.state = { visible: false, }; this.signature = React.createRef(); } componentDidMount() { } show() { this.setState({ visible: true }); } setSignature(ref) { if (ref == null) { return; } const { value } = this.props; if (value != null && value.length > 10) { ref.fromDataURL(value); } } hide() { this.setState({ visible: false }); } clear() { this.signature.clear(); } save() { const data = this.signature.toDataURL('image/png'); this.onChange(data); this.setState({ visible: false }); } render() { const { readOnly } = this.props; return ( <> { this.hide(); }} footer={[ , , , ]} > { this.signature = ref; this.setSignature(ref); }} canvasProps={{ width: 250, height: 200, className: 'sigCanvas', ...( readOnly ? { readOnly } : {}), }} /> { this.show(); }}> {' '} Sign ); } } export default IceSignature;