npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@yousofabouhalawa/react-native-alert

v0.2.2

Published

A customizable fully-native alert on iOS and Android.

Downloads

350

Readme

@yousofabouhalawa/react-native-alert

Fully native alert dialogs for iOS and Android with a simple imperative API and Android custom styling (rounded buttons, custom colors, loading, ripples). iOS stays on public UIAlertController APIs.

Installation

npm install @yousofabouhalawa/react-native-alert

iOS:

cd ios && pod install

Expo:

  • Works with expo run:ios / expo run:android
  • Not supported in Expo Go

Usage

import { Alert } from "@yousofabouhalawa/react-native-alert";

Alert.show({
  title: "Hello",
  message: "This is the default alert.",
  buttons: [{ text: "OK" }],
});

Support

Buy me a coffee

API

Alert.show(options, onEvent?)

Shows a native alert. Returns a handle with dismiss().

const handle = Alert.show(
  { title: "Syncing", loading: true, buttons: [{ text: "Cancel" }] },
  (event) => {
    if (event.type === "action") {
      console.log(event.payload?.id);
    }
  }
);

// Later
handle?.dismiss();

Alert.dismiss()

Dismisses the current alert if one is shown.

Options

Common

  • title?: string
  • message?: string
  • dismissable?: boolean (default: true)
    Android only; iOS does not dismiss by tapping outside.
  • buttons?: AlertButton[]
  • onDismiss?: () => void (JS side callback)

iOS-only

  • iosPreferredStyle?: "alert" | "actionSheet"
    Uses UIAlertControllerStyleAlert or UIAlertControllerStyleActionSheet.

Android-only (custom styling + layout)

  • backgroundColor?: ColorValue
  • borderColor?: ColorValue
  • borderWidth?: number
  • cornerRadius?: number
  • titleColor?: ColorValue
  • messageColor?: ColorValue
  • loading?: boolean
  • loadingColor?: ColorValue
  • loadingSize?: number

Buttons

type AlertButton = {
  id?: string;
  text?: string;
  role?: "default" | "cancel" | "destructive"; // iOS only
  order?: number; // controls ordering/layout on both platforms
  dismissOnPress?: boolean;
  onPress?: () => void; // JS-only
  textColor?: ColorValue; // Android only
  rippleColor?: ColorValue; // Android only
};

Button ordering

  • Sorting is by order ascending (then original index).
  • Android max buttons: 3. Extra buttons are ignored.
  • Android layout:
    • 1 button: right
    • 2 buttons: both on the right
    • 3 buttons: one on the left, two on the right
      The lowest order button is rightmost (primary).

Examples

Two buttons with ordering

Alert.show({
  title: "Enable notifications?",
  message: "You can change this later in Settings.",
  buttons: [
    { text: "Not now", order: 1 },
    { text: "Allow", order: 0 },
  ],
});

iOS action sheet

Alert.show({
  title: "Options",
  message: "Choose an action",
  iosPreferredStyle: "actionSheet",
  buttons: [
    { text: "Share", role: "default", order: 0 },
    { text: "Delete", role: "destructive", order: 1 },
    { text: "Cancel", role: "cancel", order: 2 },
  ],
});

Android custom styles + loading

Alert.show({
  title: "Signing in",
  message: "Checking your credentials...",
  loading: true,
  loadingColor: "#60a5fa",
  backgroundColor: "#0f172a",
  borderColor: "#1e293b",
  borderWidth: 1,
  cornerRadius: 22,
  titleColor: "#f8fafc",
  messageColor: "#cbd5f5",
  buttons: [
    { text: "Cancel", textColor: "#94a3b8", rippleColor: "#334155", order: 1 },
    { text: "Retry", textColor: "#60a5fa", rippleColor: "#1d4ed8", order: 0 },
  ],
});

iOS

Android

Contributing

License

MIT


Made with create-react-native-library