![Maven Central Adds Sigstore Signature Validation](https://cdn.sanity.io/images/cgdhsj6q/production/7da3bc8a946cfb5df15d7fcf49767faedc72b483-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Maven Central Adds Sigstore Signature Validation
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.
@agney/ir-toast
Advanced tools
This packages enables the use of imperative Toasts as in Angular.
import { ToastProvider, useToast } from "@agney/ir-toast";
// Wrap you App.tsx with ToastProvider
const App: FC = () => {
<IonApp>
<ToastProvider>
// ...rest of your application
</ToastProvider>
</IonApp>
}
// In your component
const RegisterForm: FC () => {
const Toast = useToast();
// ...
function validate() {
const toast = Toast.warning('Passwords don\'t match');
}
function submit(data) {
try {
const response = await api.register(data);
Toast.success('Registration Successful');
} catch() {
Toast.error('Request failed');
}
}
}
npm i @agney/ir-toast
Requires react 16.8 or higher and @ionic/react 5 or higher.
ToastProvider
The useToast
requires the app to be wrapped with a ToastProvider
. The Provider can also take a value
as prop which serves as defaults for all toasts created under it.
const App: FC = () => {
<IonApp>
<ToastProvider value={{ color: 'primary', duration: 2000 }}>
// ...rest of your application
<ToastProvider>
</IonApp>
}
Supports all properties in docs.
useToast
Hook to be used in functional components.
function Component: FC = () => {
const Toast = useToast();
const handleClick = () => {
const toast = Toast.create({ message: 'thing' });
toast.present();
// When you want to.
toast.dismiss();
...
}
// ...
}
Toast
returned from useToast
supports:
create
A toast instance is created, takes all the props in docs as argument. Returns a toast instance that can be presented by calling present
and dismissed calling dismiss
on it.
success
, warning
, error
Takes one argument: message as string. Does not require present
to be called, directly shows the toast.
const toast = toast.success('Success message');
Contributions, issues and feature requests are welcome!
Feel free to check issues page.
We use yarn
v1 for development.
yarn
yarn start
yarn test
Give a ⭐️ if this project helped you!
Copyright © 2020 Agney Menon agney@outlook.in.
This project is MIT licensed.
FAQs
Enables the use of imperative Toasts as in Angular
The npm package @agney/ir-toast receives a total of 0 weekly downloads. As such, @agney/ir-toast popularity was classified as not popular.
We found that @agney/ir-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.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.
Security News
CISOs are racing to adopt AI for cybersecurity, but hurdles in budgets and governance may leave some falling behind in the fight against cyber threats.
Research
Security News
Socket researchers uncovered a backdoored typosquat of BoltDB in the Go ecosystem, exploiting Go Module Proxy caching to persist undetected for years.