The NativeBase Toast API works the same way on iOS and Android. Notifications are difficult to handle in a cross-platform way, but thankfully, this API makes this possible. Let's look at an example now:
import React from "react";
import { Button, Text, Toast } from "native-base";
import Container from "./Container";
export default function App() {
return (
<Container title="Showing User Notifications">
<Button
onPress={() =>
Toast.show({
text: "Something happened!",
buttonText: "dismiss",
duration: 3000
})
}
>
<Text>Show Notification</Text>
</Button>
</Container>
);
}
This app renders a button that, when clicked, calls Toast.show() to display a notification to the user. This function takes an object with several message configuration values, such as the text to display...