npm i react-native-smart-toast-alert
import React from 'react';
import {View, Text, StatusBar} from 'react-native';
import Toast from 'react-native-smart-toast-alert'
export default Mycomponent = () => {
const showToast = () => {
Toast.showToast('Great ! Toast is working...', '#228B22')
}
return (
<View style={{flex: 1}}>
<Toast /> { /*Add this line */}
<StatusBar barStyle="light-content" />
<Text onPress={() => showToast()}> CLICK ME </Text>
</View>
);
};
call this method when you need to show the toast in your app
Toast.showToast(YOUR_TOAST_MESSAGE, COLOR)