Skip to content

Commit

Permalink
fix: export hideToastable method
Browse files Browse the repository at this point in the history
  • Loading branch information
enestatli committed Jan 15, 2024
1 parent 94aaf03 commit ffd3a16
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
9 changes: 8 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,12 @@ npm install react-native-toastable
```

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

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

```js
import { View } from 'react-native';
import { useSafeAreaInsets } from 'react-native-safe-area-context';
import Toastable from 'react-native-toastable';

Expand All @@ -58,6 +59,8 @@ export default function RootNavigation() {
);
}

import { View, Button } from 'react-native';
import { hideToastable, showToastable } from 'react-native-toastable';

export default function HomeScreen() {
return (
Expand All @@ -66,6 +69,10 @@ export default function HomeScreen() {
title="Show Toastable"
onPress={() => showToastable({ message: 'React Native Heroes is awesome! 🚀', status:'success' })}
/>
<Button
title="Hide Toastable"
onPress={() => hideToastable()}
/>
</View>
);
}
Expand Down
3 changes: 2 additions & 1 deletion src/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Toastable, ToastableBody } from './components';
import { showToastable } from './utils';
import { showToastable, hideToastable } from './utils';
import type {
ToastableBodyParams,
ToastableMessageStatus,
Expand All @@ -20,4 +20,5 @@ export {
StatusMap,
ToastableBodyParams,
TOASTABLE_STATUS_MAP,
hideToastable,
};

0 comments on commit ffd3a16

Please sign in to comment.