npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@baronha/ting

v1.2.2

Published

test

Downloads

875

Readme

Logo1.2.2 BuyMeACoffee Kofi

Overview

Turbo Native Modules Swift Kotlin

🍞 Flexible and customizable React toast notifications with support for positioning, custom rendering, click handlers, and duration control.

Video Demo 📺

| ios | android | Modal | | ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- | | | | |

Installation

yarn add @baronha/ting
or
npm i @baronha/ting

If you want to use Expo. Burnt is the solution for you.

iOS

New Architecture

cd ios && RCT_NEW_ARCH_ENABLED=1 bundle exec pod install --verbose

Older

cd ios && pod install --verbose

Usage

Toast

import { toast } from '@baronha/ting';
// ...
const options = {
  title: 'Done 😎',
  message: 'Successful!!',
};

toast(options); // easy to use

Customize Icon

import { toast } from '@baronha/ting';
// ...
const options = {
  // ...
  title: 'Vietnamese Gangz 😎',
  message: 'Anh em tao là Vietnamese Gangz',
  titleColor: '#D60A2E',
  icon: {
    uri: require('./vietnam.png'), // or remote
    size: 24,
  },
};

toast(options); // icon is 🇻🇳

Alert

import { alert } from '@baronha/ting';
// ...
const options = {
  title: 'Done 😎',
  message: 'Successful!!',
};

alert(options); // easy to use

Initialization

Instead of using too many options like this:

const options = {
  // ...
  messageColor: '#D60A2E',
  titleColor: '#D60A2E',
  icon: {
    uri: require('./vietnam.png'), // or remote
    size: 24,
  },
  shouldDismissByTap: true,
  position: 'bottom',
  // ... bla bla bla
};

toast(options);

You want to initialize the default options for all subsequent use of toast or alert. You can use the setup function that is called when the application is initialized. Do the following:

import { setup } from '@baronha/ting';

const initOption = {
  toast: {
    messageColor: '#D60A2E',
    titleColor: '#D60A2E',
    backgroundColor: '#ffffff',
    // ... more and more
  },
  alert: {
    // ... alert's option
  },
};

setup(initOption);

// Use it next time. You can completely override it on subsequent calls
toast({
  title: 'Ting!',
  message: 'Easy toast for React Native',
});

alert({
  title: "What's up bruhhh!",
  message: 'Easy Alert for React Native',
});

Options

| Property | Type | Default value | Platform | Toast | Alert | Description | | --------------------- | :------: | :-----------: | :--------: | :---: | :---: | :------------------------------------------------------------------------------------------ | | title | string | null | Both | ✅ | ✅ | | | message | string | null | Both | ✅ | ✅ | | | titleColor | string | null | Both | ✅ | ✅ | The color of the title text in hexadecimal format (e.g., #FF0000) | | messageColor | string | null | Both | ✅ | ✅ | The color of the message text in hexadecimal format (e.g., #00FF00) | | icon | object | null | Both | ✅ | ✅ | See Icon | | preset | string | done | Both | ✅ | ✅ | done, error, none, spinner | | duration | number | 3 | Both | ✅ | ✅ | The lifetime of the toast (seconds) | | titleColor | string | null | Both | ✅ | ✅ | | | shouldDismissByDrag | boolean | true | Both | ✅ | | position | string | top | Both | ✅ | | Toast is displayed from top or bottom | | haptic | string | null | iOS | ✅ | | success, warning, error, none | | shouldDismissByTap | boolean | true | Both | | ✅ | | | borderRadius | number | null | Both | | ✅ | | | blurBackdrop | number | null | Android | | ✅ | | | backdropOpacity | number | null | Android | | ✅ | | | backgroundColor | string | #ffffff | Both | ✅ | ✅ | The background color of the toast in hexadecimal format (e.g., #0000FF) |

Icon

| icon | Type | Default value | Platform | | ----------- | :----: | :-----------: | :------: | | uri | string | null | Both | | size | number | null | Both | | tintColor | string | null | Both |

To Do

  • [x] Initialize for the first time (v.1.0.5)
  • [x] tintColor for icon (v.1.0.5)
  • [x] backgroundColor (v.1.0.3)
  • [x] spinner preset for toast (v.1.1.0)
  • [x] custom color like StyleSheet (e.g. #fff, red, rgba(0, 0, 0, .8))
  • [x] shouldDismissByDrag on Android
  • [ ] callback

Performance

We're trying to improve performance. If you have a better solution, please open a issue or pull request. Best regards!

Contributing

See the contributing guide to learn how to contribute to the repository and the development workflow.

Contributors ✨

Thanks go to these wonderful people:

License

MIT AlertKit SPIndicator EasyWindow