Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
react-custom-toast
Advanced tools
基于 react 的 toast 组件。可以完全的自定义样式。并提供了内置动画与控制方法demo
使用 npm 安装
npm install react-custom-toast --save
使用 yarn 安装
yarn add react-custom-toast
添加 ToastContainer 组件至
render
中
import { ToastContainer } from 'react-custom-toast'
ReactDom.render(<ToastContainer />, document.body)
然后,开始使用 toast
import { Toast } from 'react-custom-toast'
Toast.open('hello,world')
参数 | 类型 | 默认值 | 描述 |
---|---|---|---|
component | JSX.FunctionComponent | undefinded | 自定义组件 |
clickClose | boolean | false | 点击 toast 即关闭 |
方法
Toast(msg: string, opt: ToastOption)
// 打开默认
提示
Toast.open(msg: string, opt: ToastOption)
// 打开无状态提示
Toast.info(msg: string, opt: ToastOption)
// 打开提示
Toast.info(msg: string, opt: ToastOption)
// 打开成功
提示
Toast.error(msg: string, opt: ToastOption)
// 打开错误
提示
Toast.warning(msg: string, opt: ToastOption)
// 打开警告
提示
Toast.remove(id: ToastId)
// 移除某个 toast
参数 | 类型 | 默认值 | 描述 |
---|---|---|---|
id | string|number | 随机 | 设置 toast id |
type | string | '' | 提示类型('info' | 'success' | 'error' | 'warning') |
placement | string | topLeft | toast 方位('topLeft' | 'topRight' | 'topCenter' | 'bottomLeft' | 'bottomRight' | 'bottomCenter') |
duration | number | 2000 | 提示持续时间 |
delay | number | 0 | 提示出现延时 |
animateDuration | number | 300 | 提示动画时间 |
animateName | string | slideX | 提示动画效果('slideX' | 'slideY') |
MIT
FAQs
基于 react 的 toast 组件。可以完全的自定义样式。并提供了内置动画与控制方法
We found that react-custom-toast demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.