0.3.0 • Published 4 months ago

react-native-paper-fastalerts v0.3.0

Weekly downloads
-
License
MIT
Repository
github
Last release
4 months ago

react-native-paper-fastalerts

npm npm.io

A fast and easy to use alert and dialog system for react-native-paper

fastalerts.adriansoftware.de

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>
  );
}
0.3.0

4 months ago

0.2.1

4 months ago

0.2.0

4 months ago

0.1.1

5 months ago

0.1.0

5 months ago