How to use the react-confirm.confirmable function in react-confirm

To help you get started, we’ve selected a few react-confirm examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github DefinitelyTyped / DefinitelyTyped / types / react-confirm / react-confirm-tests.tsx View on Github external
<div>
                    {this.props.confirmation}
                </div>

                <div>
                    <button> this.props.proceed()}&gt;Yes</button>
                    <button> this.props.cancel()}&gt;No</button>
                </div>
            
        );
    }
}

// Adds ReactConfirmProps to CustomModal component
const ConfirmModal = confirmable(CustomModal);

// This is the function you need to call to open your modal, then you can use the
//   Promise object it returns to handle "proceed()" or "cancel()" functions.
const confirm = createConfirmation(ConfirmModal);

const markup = (
  <div>
    <b>Are you sure you want to delete this item?</b>
  </div>
);

// This is how you can detect what option ("Yes" or "No") the user has chosen.
confirm({ confirmation: markup })
  .then((result) =&gt; {
    // User chose "Yes"
  })
github haradakunihiko / react-confirm / example / react-bootstrap / src / components / Confirmation.js View on Github external
}
}

Confirmation.propTypes = {
  okLabbel: PropTypes.string,
  cancelLabel: PropTypes.string,
  title: PropTypes.string,
  confirmation: PropTypes.string,
  show: PropTypes.bool,
  proceed: PropTypes.func,     // called when ok button is clicked.
  cancel: PropTypes.func,      // called when cancel button is clicked.
  dismiss: PropTypes.func,     // called when backdrop is clicked or escaped.
  enableEscape: PropTypes.bool,
}

export default confirmable(Confirmation);
github joshwcomeau / Tello / src / components / Confirm / Confirm.js View on Github external
background-color: ${COLORS.gray.veryLight};
  }
`;

const ConfirmButton = styled.button`
  ${actionButtonCSS};
`;

const CancelButton = styled.button`
  ${actionButtonCSS};
  border-right: 1px solid ${COLORS.gray.light};
`;

Confirm.propTypes = propTypes;

export default confirmable(Confirm);
github zhuyst / SkyBlog / client_web / src / component / common / modal / ConfirmModal.js View on Github external
<div>
                
                
                    <button>确定</button>
                    <button>取消</button>
                
            
        )
    }
}

export default confirmable(ConfirmModal)</div>
github haradakunihiko / react-confirm / example / material-ui / src / components / Confirmation.js View on Github external
<dialog open="{show}" title="{title}">
          {confirmation}
        </dialog>
      
    );
  }
}

export default confirmable(Confirmation);
github haradakunihiko / react-confirm / example / react-bootstrap / src / components / ComplexConfirmation.js View on Github external
<button>Cancel</button>
            <button>1st</button>
            <button>2nd</button>
            <button>3rd</button>
          
        
      
    )
  }
}


export default confirmable(ComplexConfirmation);

react-confirm

Small library which makes your Dialog component callable

MIT
Latest version published 1 year ago

Package Health Score

59 / 100
Full package analysis