react-native-paper-fastalerts
v0.3.0
Published
A fast and easy to use alert and dialog system for react-native-paper
Downloads
15
Readme
react-native-paper-fastalerts
A fast and easy to use alert and dialog system for react-native-paper
Demo
https://github.com/adrianschubek/react-native-paper-fastalerts/assets/19362349/99ac2580-82c7-4655-a1a1-0a0d3110b33b
import { useAlerts } from "react-native-paper-fastalerts";
export default function HelloWorld() {
const { alert /*, confirm, warning, error, info */ } = useAlerts();
// or use: const alerts = useAlerts();
return (
<Button
onPress={() =>
alert({
// all options are optional and have sensible defaults
message: "What is the capital of Germany?",
okText: "Submit 🔥",
okAction(values) {
if (values[0] === "b") {
alert({ message: "Correct 🤗" });
} else {
return "Wrong 😅 Try again.";
}
},
fields: [
{
type: "radio",
data: [
{ key: "Berlin", value: "b" },
{ key: "Paris", value: "p" },
{ key: "London", value: "l" },
{ key: "Madrid", value: "m" },
],
},
],
})
}
>
Ask me a question!
</Button>
);
}