react-native-crostini

0.1.1 • Public • Published

react-native-crostini

Simple opinionless Toast with toppings.

Description

This package is designed to be an ultra light-weight themable universal opinionless hooks-based react-native toast provider.

Example

Wrap the provider around the app (or whever you want toasts to appear)

import {ToastProvider} from 'react-native-crostini';
 
export function AppContainer() {
  return (
    <ToastProvider>
      <App />
    </ToastProvider>
  );
}

Then import the hook and create toasts

import React, {useEffect} from 'react';
import {Text, View} from 'react-native';
import {useToast} from 'react-native-crostini';
 
export function MyComponent() {
  const {showToast} = useToast();
  useEffect(() => {
    showToast('MyComponent mounted!');
  }, [showToast]);
 
  return (
    <View>
      <Text>It works!</Text>
    </View>
  );
}

Readme

Keywords

Package Sidebar

Install

npm i react-native-crostini

Weekly Downloads

0

Version

0.1.1

License

MIT

Unpacked Size

405 kB

Total Files

8

Last publish

Collaborators

  • patsissons