Skip to content

Commit ffd3a16

Browse files
committed
fix: export hideToastable method
1 parent 94aaf03 commit ffd3a16

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

README.md

+8-1
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,12 @@ npm install react-native-toastable
3030
```
3131

3232
## Usage
33-
Place `Toastable` component at the root of your app, and import `showToastable` function anywhere in your app to show.
33+
Place `Toastable` component at the root of your app, and import `showToastable` function anywhere in your app to show or `hideToastable` to hide toast.
3434

3535
*All examples below assume that you have placed `Toastable` component at the root of your app and imported necessary components and functions.*
3636

3737
```js
38+
import { View } from 'react-native';
3839
import { useSafeAreaInsets } from 'react-native-safe-area-context';
3940
import Toastable from 'react-native-toastable';
4041

@@ -58,6 +59,8 @@ export default function RootNavigation() {
5859
);
5960
}
6061

62+
import { View, Button } from 'react-native';
63+
import { hideToastable, showToastable } from 'react-native-toastable';
6164

6265
export default function HomeScreen() {
6366
return (
@@ -66,6 +69,10 @@ export default function HomeScreen() {
6669
title="Show Toastable"
6770
onPress={() => showToastable({ message: 'React Native Heroes is awesome! 🚀', status:'success' })}
6871
/>
72+
<Button
73+
title="Hide Toastable"
74+
onPress={() => hideToastable()}
75+
/>
6976
</View>
7077
);
7178
}

src/index.tsx

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { Toastable, ToastableBody } from './components';
2-
import { showToastable } from './utils';
2+
import { showToastable, hideToastable } from './utils';
33
import type {
44
ToastableBodyParams,
55
ToastableMessageStatus,
@@ -20,4 +20,5 @@ export {
2020
StatusMap,
2121
ToastableBodyParams,
2222
TOASTABLE_STATUS_MAP,
23+
hideToastable,
2324
};

0 commit comments

Comments
 (0)