File tree 3 files changed +12
-3
lines changed
3 files changed +12
-3
lines changed Original file line number Diff line number Diff line change
1
+ type Toast = React . RefObject <
2
+ import ( 'react-native-magnus' ) . SnackbarRef
3
+ > [ 'current' ] ;
4
+
5
+ declare global {
6
+ const toast : Toast ;
7
+ }
8
+
9
+ declare var toast : Toast ;
Original file line number Diff line number Diff line change @@ -17,7 +17,7 @@ const SnackbarComponent: React.FC = () => {
17
17
block
18
18
p = "lg"
19
19
onPress = { ( ) => {
20
- ( global as any ) . toast . show ( 'Hello World' , {
20
+ toast ? .show ( 'Hello World' , {
21
21
duration : 5000 ,
22
22
suffix : (
23
23
< Button bg = "green500" fontSize = "sm" p = "sm" px = "md" >
Original file line number Diff line number Diff line change 1
1
import React from 'react' ;
2
2
import { createStackNavigator } from '@react-navigation/stack' ;
3
3
import { NavigationContainer } from '@react-navigation/native' ;
4
- import { Snackbar , SnackbarRef , ThemeProvider } from 'react-native-magnus' ;
4
+ import { Snackbar , ThemeProvider } from 'react-native-magnus' ;
5
5
import AppLoading from 'expo-app-loading' ;
6
6
import { useFonts } from 'expo-font' ;
7
7
@@ -60,7 +60,7 @@ const App = () => {
60
60
< Snackbar
61
61
px = "xl"
62
62
py = "lg"
63
- ref = { ( ref ) => ( ( global as any ) . toast = ref ) }
63
+ ref = { ( ref ) => ( global . toast = ref ) }
64
64
color = "white"
65
65
fontSize = "lg"
66
66
duration = { 2000 }
You can’t perform that action at this time.
0 commit comments