Non Programming Manager

    @nghinv/react-native-dropdown-alert
    TypeScript icon, indicating that this package has built-in type declarations

    1.0.6 • Public • Published

    @nghinv/react-native-dropdown-alert

    A dropdown alert component with react-native-reanimated


    Version MIT License All Contributors

    Installation

    Installing the package

    • Use yarn
    yarn add @nghinv/react-native-dropdown-alert
    • Use npm
    npm install @nghinv/react-native-dropdown-alert
    • peerDependencies
    yarn add react-native-gesture-handler react-native-reanimated react-native-safe-area-context

    How to use

    1. Wrapper DropdownAlertService in the Root Component
      import { DropdownAlertService } from '@nghinv/react-native-dropdown-alert';
    
      ...
      return (
        <DropdownAlertService>
          <RootComponent />
        </DropdownAlertService>
      );
      ...
    1. Use DropdownAlert.show() and DropdownAlert.hide()
    import React from 'react';
    import { View, StyleSheet, Button } from 'react-native';
    import { DropdownAlert } from '@nghinv/react-native-dropdown-alert';
    
    export default function Example() {
      const onPress = () => {
        DropdownAlert.show({
          title: 'Thông báo',
          message: 'Đã kích hoạt cảnh',
          timeDismiss: 1000,
        });
        DropdownAlert.show({
          title: 'Thông báo',
          message: 'Đã kích hoạt cảnh',
          type: 'error',
        });
        DropdownAlert.show({
          title: 'Thông báo',
          message: 'Đã kích hoạt cảnh',
          type: 'info',
          // autoHide: false,
        });
      };
    
      return (
        <View style={styles.container}>
          <Button title='Show notification' onPress={onPress} />
        </View>
      )
    }
    
    const styles = StyleSheet.create({
      container: {
        flex: 1,
        justifyContent: 'center',
        alignItems: 'center',
        backgroundColor: 'skyblue'
      }
    });

    Credits

    Install

    npm i @nghinv/react-native-dropdown-alert

    DownloadsWeekly Downloads

    22

    Version

    1.0.6

    License

    MIT

    Unpacked Size

    225 kB

    Total Files

    33

    Last publish

    Collaborators

    • nghinv