Skip to content

Commit 12fa6fa

Browse files
committed
update and ready to publish 1.0.0
1 parent 34ddbea commit 12fa6fa

16 files changed

Lines changed: 1531 additions & 324 deletions

.eslintignore

Lines changed: 0 additions & 4 deletions
This file was deleted.

.eslintrc.js

Lines changed: 0 additions & 23 deletions
This file was deleted.

.github/funding.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
github: noorjsdivs
2+
buymeacoffee: reactbd

.husky/pre-commit

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
npm run lint-staged

README.md

Lines changed: 73 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
55
[![TypeScript](https://img.shields.io/badge/TypeScript-5.7-blue.svg)](https://www.typescriptlang.org/)
66
[![React Native](https://img.shields.io/badge/React%20Native-0.83-green.svg)](https://reactnative.dev/)
7+
[![Support](https://img.shields.io/badge/Buy%20Me%20A%20Coffee-Support-orange.svg)](https://buymeacoffee.com/reactbd)
78

89
A modern, highly customizable toast notification library for React Native with full TypeScript support. Inspired by popular toast libraries like Sonner and react-native-toast-message, this library provides an elegant and flexible way to display notifications in your React Native applications.
910

@@ -20,6 +21,15 @@ A modern, highly customizable toast notification library for React Native with f
2021
- 📦 **Easy to Use** - Simple API similar to popular web toast libraries
2122
- 🔧 **Highly Configurable** - Global and per-toast configuration options
2223
- 🆕 **Latest React Native** - Compatible with React 19.2 and React Native 0.83
24+
- 🏗️ **Expo Compatible** - Works with Expo Go and prebuilds out of the box
25+
26+
## 📱 Expo Support
27+
28+
This library is fully compatible with Expo. It uses standard React Native APIs (`Animated`, `PanResponder`) and requires no native code linking. You can use it directly in:
29+
30+
- **Expo Go**
31+
- **Expo Development Builds**
32+
- **Expo Prebuilds**
2333

2434
## 📋 Requirements
2535

@@ -98,11 +108,11 @@ Toast.show({
98108

99109
### ToastContainer Props
100110

101-
| Prop | Type | Default | Description |
102-
| -------------- | ------------------------------------ | ----------- | --------------------------------------------------------- |
103-
| `config` | `ToastConfig` | `undefined` | Map of toast types to render functions |
104-
| `topOffset` | `number` | `40` | Top offset for positioning (when position is 'top') |
105-
| `bottomOffset` | `number` | `40` | Bottom offset for positioning (when position is 'bottom') |
111+
| Prop | Type | Default | Description |
112+
| -------------- | ------------- | ----------- | --------------------------------------------------------- |
113+
| `config` | `ToastConfig` | `undefined` | Map of toast types to render functions |
114+
| `topOffset` | `number` | `40` | Top offset for positioning (when position is 'top') |
115+
| `bottomOffset` | `number` | `40` | Bottom offset for positioning (when position is 'bottom') |
106116

107117
### Toast Methods
108118

@@ -187,7 +197,54 @@ Toast.hide();
187197
| `swipeable` | `boolean` | `true` | Enable swipe to dismiss |
188198
| `props` | `Record<string, any>` | `undefined` | Custom props for advanced use cases |
189199

190-
## 🎨 Customization Examples
200+
## 🎨 Advanced Customization (Sonner-style)
201+
202+
Inspired by libraries like [Sonner](https://sonner.emilkowal.ski/), this library gives you complete control over the toast's rendering, allowing you to build any design you want.
203+
204+
### 1. Global Configuration
205+
206+
Define your custom types once in `ToastContainer` and use them everywhere.
207+
208+
```tsx
209+
// types.ts
210+
import { ToastConfigParams } from 'react-native-toast-message-ts';
211+
212+
// Your custom toast component
213+
const TomatoToast = ({ text1, props }: ToastConfigParams<any>) => (
214+
<View
215+
style={{
216+
height: 60,
217+
width: '90%',
218+
backgroundColor: 'tomato',
219+
borderRadius: 10,
220+
padding: 15,
221+
justifyContent: 'center',
222+
}}
223+
>
224+
<Text style={{ color: 'white', fontWeight: 'bold' }}>{text1}</Text>
225+
<Text style={{ color: 'white' }}>{props.uuid}</Text>
226+
</View>
227+
);
228+
229+
// App.tsx
230+
const toastConfig = {
231+
tomato: TomatoToast,
232+
// Overwrite default types
233+
success: props => <BaseToast {...props} text1Style={{ fontSize: 20 }} />,
234+
};
235+
```
236+
237+
### 2. Usage
238+
239+
```tsx
240+
Toast.show({
241+
type: 'tomato',
242+
text1: 'Hello World',
243+
props: { uuid: 'b432-89ac' }, // Pass arbitrary props
244+
});
245+
```
246+
247+
## 💡 Examples
191248

192249
### Custom Colors
193250

@@ -249,7 +306,6 @@ Toast.success('New Message', 'Tap to view', {
249306

250307
To customize the default appearance globally, you can provide custom renderers in the `config` prop of `ToastContainer` as shown above.
251308

252-
253309
### Custom Toast Renderer
254310

255311
For complete control over toast appearance:
@@ -273,7 +329,9 @@ const toastConfig = {
273329
</View>
274330
),
275331
// You can overwrite default types too
276-
success: (props: ToastConfigParams) => <BaseToast {...props} style={{ borderLeftColor: 'pink' }} />
332+
success: (props: ToastConfigParams) => (
333+
<BaseToast {...props} style={{ borderLeftColor: 'pink' }} />
334+
),
277335
};
278336

279337
<ToastContainer config={toastConfig} />;
@@ -414,13 +472,19 @@ Inspired by:
414472
## 📞 Support
415473
416474
If you have any questions or need help, please:
417-
- Open an issue on [GitHub](https://github.com/noor-mohammad/react-native-toast-message-ts/issues)
475+
- Open an issue on [GitHub](https://github.com/noorjsdivs/react-native-toast-message-ts/issues)
418476
- Check the [examples](./example) directory for more usage examples
419477
420478
## 🎉 Show Your Support
421479
422480
If this library helped you, please give it a ⭐️ on GitHub!
423481
482+
You can also support the development of this project by buying me a coffee:
483+
484+
<a href="https://buymeacoffee.com/reactbd" target="_blank">
485+
<img src="https://cdn.buymeacoffee.com/buttons/v2/default-yellow.png" alt="Buy Me A Coffee" style="height: 60px !important;width: 217px !important;" >
486+
</a>
487+
424488
---
425489
426490
Made with ❤️ by Noor Mohammad

UPDATE_SUMMARY.md

Lines changed: 0 additions & 151 deletions
This file was deleted.

0 commit comments

Comments
 (0)