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

react-native-sweet-alert-best

v1.2.0

Published

SweetAlert native library for React Native

Downloads

4

Readme

React Native Sweet Alert

Cute sweet alert for your app and your day.

alt text

Getting started

$ npm install react-native-sweet-alert --save

Mostly automatic installation

$ react-native link react-native-sweet-alert

Manual installation

On Android:

In the AndroidManifest.xml file

Below this line:

xmlns:android="http://schemas.android.com/apk/res/android"

add this:

xmlns:tools="http://schemas.android.com/tools"

And in the <application> tag, add this property:

tools:replace="android:icon"

so it will look like:

<application
  android:name=".MainApplication"
  android:allowBackup="true"
  android:label="@string/app_name"
  android:icon="@mipmap/ic_launcher"
  tools:replace="android:icon"
  android:theme="@style/AppTheme">

On iOS:

Since the vendor library is written in Swift, apart from doing usual react-native link react-native-sweet-alert, you will also have to create a Bridging Header for Swift file, which is also pretty easy:

  • ou have to create at least a .swift file in your project. It can be an empty Swift file, but it must exist. After that, XCode will ask you to "Create bridging header?" which enables Swift Bridging Header in Build Settings below.

  • Open the project with XCode (don't forget to open XCode, since using other editors won't be enough), create a new .h file. I recommend to create something like <Your-App-Name>-Bridging-Header.h , for example, if your app is named CuteApp, then it should be CuteApp-Bridging-Header.h

  • Paste in following code into that newly created .h file:

#import <React/RCTBridgeModule.h>
#import <React/RCTEventEmitter.h>
#import <React/RCTViewManager.h>
#import <React/RCTConvert.h>
#import <React/RCTUtils.h>

Or you can just see Example-Bridging-Header.h and copy and paste in.

  • In XCode, make sure you chose your app target. Go to Build Settings:

alt text

  • Now to the important part: In Objective-C Bridging Header, double-click on it and type in your created .h file earlier. In the above example it is CuteApp-Bridging-Header.h.

alt text

  • Make sure the path is relative. For example, if CuteApp-Bridging-Header.h is in ios folder, you only have to type CuteApp-Bridging-Header.h , but if it's in a sub-folder, you have to add the path too, e.g: some-path/CuteApp-Bridging-Header.h.

  • In Swift Language Version, choose 4.2. Yeah I had to convert the syntax of original library from Swift 2 to Swift 4.

And then you can use the library like so:

import SweetAlert from 'react-native-sweet-alert';
SweetAlert.showAlertWithOptions({
  title: '',
  subTitle: '',
  confirmButtonTitle: 'OK',
  confirmButtonColor: '#000',
  otherButtonTitle: 'Cancel',
  otherButtonColor: '#dedede',
  style: 'success',
  cancellable: true
},
  callback => console.log('callback'));
  • The first parameter is dialog option with above available properties. Please note that confirmButtonColor and otherButtonColor is only available on iOS.

  • The second parameter is callback, which returns a boolean value. Use it as you wish.

With the dialog in progress mode, we also have following methods available (Android Only):

resetCount() Reset the counter of the progress.

isSpinning(): Promise Get spinning status of the progress bar.

spin(): Start spinning.

setBarColor(type: string) Changes the progress bar color. Argument must be a hex color string like #ff0000

LICENSE

MIT License

Copyright (c) 2018 Clip-sub

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.