Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@baronha/ting

Package Overview
Dependencies
Maintainers
0
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@baronha/ting

test

  • 1.2.3
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
0
Created
Source

Logo1.2.3 BuyMeACoffee Kofi

Overview

Turbo Native Modules Swift Kotlin

Ting - React Native Toast | Product Hunt

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

Video Demo 📺

iosandroidModal

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

PropertyTypeDefault valuePlatformToastAlertDescription
titlestringnullBoth
messagestringnullBoth
titleColorstringnullBothThe color of the title text in hexadecimal format (e.g., #FF0000)
messageColorstringnullBothThe color of the message text in hexadecimal format (e.g., #00FF00)
iconobjectnullBothSee Icon
presetstringdoneBothdone, error, none, spinner
durationnumber3BothThe lifetime of the toast (seconds)
titleColorstringnullBoth
shouldDismissByDragbooleantrueBoth
positionstringtopBothToast is displayed from top or bottom
hapticstringnulliOSsuccess, warning, error, none
shouldDismissByTapbooleantrueBoth
borderRadiusnumbernullBoth
blurBackdropnumbernullAndroid
backdropOpacitynumbernullAndroid
backgroundColorstring#ffffffBothThe background color of the toast in hexadecimal format (e.g., #0000FF)

Icon

iconTypeDefault valuePlatform
uristringnullBoth
sizenumbernullBoth
tintColorstringnullBoth

To Do

  • Initialize for the first time (v.1.0.5)
  • tintColor for icon (v.1.0.5)
  • backgroundColor (v.1.0.3)
  • spinner preset for toast (v.1.1.0)
  • custom color like StyleSheet (e.g. #fff, red, rgba(0, 0, 0, .8))
  • 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:

4cc3ssX
Ryam
baronha
Bảo Hà.
Acetyld
Dion Grendelman
jeongshin
Huckleberry
tuanngocptn
Nick - Ngoc Pham

License

MIT AlertKit SPIndicator EasyWindow

Keywords

FAQs

Package last updated on 10 Nov 2024

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc