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 🙏

© 2024 – Pkg Stats / Ryan Hefner

@quoctruongpt/rn-custom-alert

v0.1.1

Published

Custom alert

Downloads

143

Readme

rn-custom-alert

Custom alert

Installation

npm install @quoctruongpt/rn-custom-alert
# or
yarn add @quoctruongpt/rn-custom-alert

Usage

  1. Initialize CustomAlertProvider Add CustomAlertProvider to the root component to provider context for ther entire application:
import { CustomAlertProvider } from '@quoctruongpt/rn-custom-alert';

export default function App() {
  return (
    <CustomAlertProvider>
      {/* Child components */}
    </CustomAlertProvider>
  );
}
  1. Display an Alert Use useCustomAlert to call alerts from any component:
import { useCustomAlert } from 'rn-custom-alert';

function ExampleComponent() {
  const alert = useCustomAlert();

  const showAlert = () => {
    alert.show({
      title: 'Notice',
      message: 'This is a custom alert.',
      actions: [
        { label: 'OK', onPress: () => console.log('OK selected') },
        { label: 'Cancel', onPress: () => console.log('Cancel selected') },
      ],
    });
  };

  return (
    <TouchableOpacity onPress={showAlert}>
      <Text>Show Alert</Text>
    </TouchableOpacity>
  );
}

Configuration and Options

Here is a list of properties to customize:

  1. Props for CustomAlertProvider:

| Property | Require | Type | Description | | ---------------------- | ------- | --------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | style | false | ViewStyle | Custom styles for the main alert container. You can use this prop to modify the overall appearance of the alert, including padding, margins, and background color. | | titleStyle | false | TextStyle | Custom styles for the title text of the alert. Use this prop to adjust font size, color, font weight, and other text properties specific to the title. | | messageStyle | false | TextStyle | Custom styles for the message text of the alert. Similar to titleStyle, this allows you to style the message text, including its font characteristics and color. | | buttonContainerStyle | false | ViewStyle | Styles for the container that holds the action buttons of the alert. You can customize the layout, spacing, and alignment of the buttons with this prop. | | buttonCancelStyle | false | ViewStyle | Styles specifically for the cancel button. Use this to define unique styles such as background color, border radius, and padding for the cancel button. | | textButtonCancelStyle | false | TextStyle | Custom styles for the text of the cancel button. This allows you to set specific text properties like font size, color, and weight for the button's label. | | buttonConfirmStyle | false | ViewStyle | Styles specifically for the confirm button. Similar to buttonCancelStyle, this prop lets you customize the confirm button's appearance, such as colors and spacing. | | textButtonConfirmStyle | false | TextStyle | Custom styles for the text of the confirm button. Use this to adjust font size, color, and weight for the confirm button's label. | | AlertComponent | false | (props: ICustomAlertProps) => React.ReactNode | A custom alert component that can be provided to override the default alert UI. |

Structure of actions

  id: number;
  onHide: (id: number) => void;
  style?: StyleProp<ViewStyle>;
  titleStyle?: StyleProp<TextStyle>;
  messageStyle?: StyleProp<TextStyle>;
  buttonContainerStyle?: StyleProp<ViewStyle>;
  buttonCancelStyle?: StyleProp<ViewStyle>;
  textButtonCancelStyle?: StyleProp<TextStyle>;
  buttonConfirmStyle?: StyleProp<ViewStyle>;
  textButtonConfirmStyle?: StyleProp<TextStyle>;