New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

react-native-popup-confirm-toast

Package Overview
Dependencies
Maintainers
0
Versions
51
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-native-popup-confirm-toast

![platforms](https://img.shields.io/badge/platforms-Web%20%7C%20Android%20%7C%20iOS-brightgreen.svg?style=flat-square&colorB=191A17) [![npm](https://img.shields.io/npm/v/@sekizlipenguen/react-native-popup-confirm-toast.svg?style=flat-square)](https://www.

  • 2.3.9
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
200
decreased by-25.65%
Maintainers
0
Weekly downloads
 
Created
Source

platforms npm npm github issues github closed issues

@sekizlipenguen/react-native-popup-confirm-toast

A flexible and user-friendly popup, toast, and bottom sheet solution for React Native. This package provides customizable components for displaying interactive messages, confirmation dialogs, and toast notifications in your mobile applications.

Note: This package has been moved to the @sekizlipenguen scope for improved organization and better support for future updates.

Example Bottom Sheet

Custom Example 1Custom Example 2Custom Example 3Custom Example 4

Example Popup Message

Example MessageExample Confirm MessageExample Message AutoCloseExample Custom Body Component

Example Toast Message

Example Toast TopExample Toast Bottom

Usage

Installation

yarn add react-native-popup-confirm-toast
or
npm install react-native-popup-confirm-toast

Usage

Wrap your root component in Provider from react-native-popup-confirm-toast. If you have a vanilla React Native project, it's a good idea to add it in the component which is passed to AppRegistry.registerComponent. This will usually be in the index.js file. If you have an Expo project, you can do this inside the exported component in the App.js file.

Example Provider

import * as React from 'react';
import { AppRegistry } from 'react-native';
import {Root as PopupRootProvider} from 'react-native-popup-confirm-toast';
import { name as appName } from './app.json';
import App from './src/App';

export default function Main() {
  return (
    <PopupRootProvider>
      <App />
    </PopupRootProvider>
  );
}

AppRegistry.registerComponent(appName, () => Main);

Example Bottom Sheet

import { Root, SPSheet } from 'react-native-popup-confirm-toast'

const component = (props) => {
    //hook or class 
    return (<Text>Hi, SekizliPenguen</Text>);
    
    //props.spSheet.hide();
    //props.spSheet.setHeight(150,()=>alert('nice'));
};

<View>
    <TouchableOpacity
        onPress={() => {
            const spSheet = SPSheet;
            spSheet.show({
                component: () => component({...this.props, spSheet}),
                dragFromTopOnly: true,
                onCloseComplete: () => {
                    alert('onCloseComplete');
                },
                onOpenComplete: () => {
                    alert('onOpenComplete');
                },
                height:260
            });
        }
    >
        <Text>Open SPSheet Message</Text>
    </TouchableOpacity>
</View>

Example Message

import {Popup} from 'react-native-popup-confirm-toast'
<View>
    <TouchableOpacity
        onPress={() =>
          Popup.show({
            type: 'success',
            title: 'Success!',
            textBody: 'Mutlak özgürlük, kendi başına hiçbir anlam ifade etmez. ',
            buttonText: 'OK',
            callback: () => Popup.hide()
          })
        }
    >
        <Text>Open Popup Message</Text>
    </TouchableOpacity>
</View>

Example Confirm Message

import {Popup} from 'react-native-popup-confirm-toast'
<View>
    <TouchableOpacity
        onPress={() =>
            Popup.show({
                type: 'confirm',
                title: 'Dikkat!',
                textBody: 'Mutlak özgürlük, kendi başına hiçbir anlam ifade etmez. ',
                buttonText: 'Tamam',
                confirmText: 'Vazgeç',
                callback: () => {
                    alert('Okey Callback && hidden');
                    Popup.hide();
                },
                cancelCallback: () => {
                    alert('Cancel Callback && hidden');
                    Popup.hide();
                },
            })
        }
    >
        <Text>Open Popup Confirm Message</Text>
    </TouchableOpacity>
</View>

Example Custom Body Component

import { Root, Popup } from 'react-native-popup-confirm-toast'
//hooks or class component
const bodyComponent = ({props,bodyProps}) => {
    return (
        <View onLayout={(e}=>bodyProps.onLayout(e)}>
        <Text>Mustafa Kemal ATATÜRK</Text>
        </View>
    );
}

<Root>
    <View>
        <TouchableOpacity
            onPress={() => {
                const popup = Popup;
                popup.show({
                    type: 'confirm',
                    textBody: 'Hesabınızın silinme işlemini onaylamak için şifrenizi giriniz.',
                    bodyComponent: (bodyProps) => bodyComponent({...props,bodyProps,popup}),
                    confirmText: 'Cancel',
                    iconEnabled: false,
                    buttonEnabled: false,
                });
            }}
        >
            <Text>Open Popup Confirm Message</Text>
        </TouchableOpacity>
    </View>
</Root>

Toast

import { Root, Toast } from 'react-native-popup-confirm-toast'
    <Root>
        <View>
            <TouchableOpacity
                onPress={() => 
                      Toast.show({
                          title: 'I\'m Eight!',
                          text: 'The best gift I received in this life are the codes. They are worlds inside the worlds.',
                          backgroundColor: '#702c91',
                          timeColor: '#440f5f',
                          timing: 3000,
                          icon: <Icon name={'check'} color={'#fff'} size={31}/>,
                          position: 'bottom',
                          statusBarType:'dark-content',
                          onCloseComplete: () => {
                            alert('onCloseComplete');
                          },
                          onOpenComplete: () => {
                            alert('onOpenComplete');
                          },
                        })
                }
            >
                <Text>Open Bottom Toast</Text>
            </TouchableOpacity>
            
            <TouchableOpacity
                onPress={() => 
                    Toast.show({
                      title: 'I\'m Eight!',
                      text: 'The best gift I received in this life are the codes. They are worlds inside the worlds.',
                      backgroundColor: '#702c91',
                      timeColor: '#440f5f',
                      timing: 3000,
                      icon: <Icon name={'check'} color={'#fff'} size={31}/>,
                      position: 'top',
                      statusBarTranslucent: false,
                      statusBarType:'light-content',
                      onCloseComplete: () => {
                        alert('onCloseComplete');
                      },
                      onOpenComplete: () => {
                        alert('onOpenComplete');
                      },
                    })
                }
            >
                <Text>Open Top Toast</Text>
            </TouchableOpacity>

        </View>
    </Root>

Features & Documentation

SPSheet

KeyTypeDescriptionDefault
backgroundstringrgba(0, 0, 0, 0.5)
heightnumberauto height (min: 250)250
durationnumberanimation time used when opening250(ms)
closeDurationnumberanimation time used when closing300(ms)
closeOnDragDownbooleanUse drag with motion to close the windowtrue
closeOnPressMaskbooleanpress the outside space to close the windowtrue
closeOnPressBackbooleanPress the back key to close the window (Android only)true
dragTopOnlybooleanuse only the top area of the draggable icon to close the windowfalse
componentcomponent(hook or class)custom modal component containernull
onOpenfunctionworks after the window is openednull
onOpenCompletefunctionworks after the window is openednull
onClosefunctionworks after window is closednull
onCloseCompletefunctionworks after window is closednull
customStylesobjectcustomStyles: { draggableIcon: {}, container: {}, draggableContainer:{} }{}
timingnumberUse this parameter for automatic shutdown.0(ms)
keyboardHeightAdjustmentbooleanre-adjusts the height when the keyboard is openedfalse

Popup

KeyTypeDescriptionDefault
titlestringfalse
textBodystringfalse
bodyComponentcomponent(hook or class)custom modal component containernull
bodyComponentForcebooleanThe component you specify covers the entire spacefalse
onLayout(event: LayoutChangeEvent) => voidTriggers automatically to calculate and adjust the height of the popup component during rendering.-
typeenumenum(success, info, danger, warning, confirm)warning
buttonTextstringOk
confirmTextstringCancel
callbackfunctionok button presspopupHidden
cancelCallbackfunctioncancel button presspopupHidden
backgroundstringrgba(0, 0, 0, 0.5)
timingnumber0 > autoClose0
iconEnabledbooleantrue
iconHeaderStyleobject{height: 75, width: 100, backgroundColor: '#fff'}
iconrequireUrlrequire('../assets/{type}.png')
containerStyleobject{ position: 'absolute', zIndex: 10, backgroundColor: 'rgba(0, 0, 0, 0.5)', alignItems: 'center', top: 0, left: 0,}
modalContainerStyleobject{ width: '90%',backgroundColor: '#fff', borderRadius: 8, alignItems: 'center', overflow: 'hidden', position: 'absolute'}}
buttonContentStyleobject{}
okButtonStyleobject{backgroundColor: '#702c91'}
confirmButtonStyleobjectdefault
okButtonTextStyleobjectdefault
confirmButtonTextStyleobjectdefault
titleTextStyleobjectdefault
descTextStyleobjectdefault
bouncinessnumber15
onClosefunctionwhen the popup is first closedfalse
onCloseCompletefunctionfalse
onOpenfunctionwhen the popup is first openedfalse
onOpenCompletefunctionfalse
durationboolean100
closeDurationboolean100

Toast

KeyTypeDescriptionDefault
titlestringfalse
textstringDescriptionfalse
titleTextStyleobject{color: '#fff',fontWeight: 'bold',fontSize: 16}
descTextStyleobject{marginTop: 5,fontSize: 13,color: '#fff', fontWeight: '400',}
backgroundColorstring#1da1f2
timeColorstringtime backgroundColor#1c6896
positionenumparameters => top, bottombottom
iconcomponent(react-native-vector-icons or component)null
timingnumber5000 ms
statusBarTypestringdefault
statusBarTranslucentbooleanfalse
statusBarHiddenbooleanfalse
statusBarAndroidHiddenbooleantrue
statusBarAppleHiddenbooleanfalse
hiddenDurationnumber200 ms
startDurationnumber200 ms
onOpenfunctionworks after the window is openednull
onOpenCompletefunctionworks after the window is openednull
onClosefunctionworks after window is closednull
onCloseCompletefunctionworks after window is closednull

Methods

Component NameMethod NameExampleDescription
SPSheetshowconst spSheet = SPSheet; spSheet.show(config);
SPSheethideconst spSheet = SPSheet; spSheet.hide();
SPSheetsetHeightconst spSheet = SPSheet; spSheet.setHeight(500,completeEventFunction);allows you to change the box height
Popupshowconst popup = Popup; popup.show(config);
Popuphideconst popup = Popup; popup.hide();
Toastshowconst toast = Toast; toast.show(config);
Toasthideconst toast = Toast; toast.hide();

Helper Function

    import {getStatusBarHeight} from 'react-native-popup-confirm-toast';

Author

SekizliPenguen

License

MIT

Keywords

FAQs

Package last updated on 23 Dec 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc