react-native-fast-toast
Advanced tools
Comparing version 1.0.3 to 1.0.4
{ | ||
"name": "react-native-fast-toast", | ||
"version": "1.0.3", | ||
"version": "1.0.4", | ||
"main": "index.ts", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
@@ -28,3 +28,3 @@ # react-native-fast-toast | ||
import React, { useEffect, useRef } from "react"; | ||
import { View, StyleSheet } from "react-native"; | ||
import { View } from "react-native"; | ||
import Toast from "react-native-fast-toast"; | ||
@@ -47,2 +47,27 @@ | ||
## Global Example | ||
If you want to have one Toast and use it everywhere on your app. do this in root component of your app (index.js or App.js) | ||
```js | ||
import React, { useEffect, useRef } from "react"; | ||
import { View } from "react-native"; | ||
import Toast from "react-native-fast-toast"; | ||
export default function App() { | ||
const toast = useRef(null); | ||
useEffect(() => { | ||
// Here | ||
global['toast'] = toast.current | ||
}, []); | ||
return ( | ||
<> | ||
<RestOfYourApp /> | ||
<Toast ref={toast} /> | ||
</> | ||
); | ||
``` | ||
now you can call ```toast.show()``` everywhere on app. like alert. | ||
## Type Example | ||
@@ -49,0 +74,0 @@ |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
7313
198
119