Giter Club home page Giter Club logo

react-native-wallet's Introduction

react-native-wallet

ReactNative module for Apple Wallet Version 1.0.8

Installation

npm install --save react-native-wallet
react-native link react-native-wallet

Usage

// Import
import Wallet from 'react-native-wallet';

The following calls are implemented:

/**
 * Check if you can add passes.
 * @param callback A callback which will receive a boolean
 */
Wallet.canAddPasses(added => {
	// Handle rest
});

/**
 * Show the pass controller for the provided URL.
 * The resolving promise will contain a boolean saying if the pass was added or not.
 * @param passURL URL to pkpass file
 * @return Promise Passing a boolean
 */
Wallet.showAddPassControllerFromURL(passURL);

/**
 * Show the pass controller for the provided filepath.
 * The resolving promise will contain a boolean saying if the pass was added or not.
 * @param filepath File path pkpass file
 * @return Promise Passing a boolean
 */
Wallet.showAddPassControllerFromFile(passURL);

Usage with File

const sharePkPass = async () => {
   try
    const payload = {}; // custom payload
    const result = await RNFetchBlob.config({
      fileCache : true,
      // appendExt : 'pkpass',
    })
    .fetch(
      'POST',
      url,
      {
      },
      payload
    );

    const resultShare = await showAddPassControllerFromFile(result.data);
   } catch (err) {
    console.log('error on share pkpass: ', err)
    }
}

react-native-wallet's People

Contributors

erikpoort avatar jgfidelis avatar krislipscombe avatar markmadlangbayan avatar sibelius avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

react-native-wallet's Issues

Accept a `data` to create a PKPass instead of URL

I would like to create a PkPass using a data instead of a URL, do you accept a PR for this?

something like this:

dispatch_async(dispatch_get_main_queue()) { () -> Void in
                    if response.errorMessage == nil
                    {
                        let pass = PKPass(data: response.serviceResponse , error: nil)
                        
                        let nextVC = PKAddPassesViewController(pass: pass)
                        self.navigationController?.presentViewController(nextVC, animated: true, completion: nil)
                    } else {
                        let alert : UIAlertView = UIAlertView(title: NSLocalizedString("warning", comment: ""),
                            message: response.errorMessage,
                            delegate: nil,
                            cancelButtonTitle: NSLocalizedString("ok", comment: "")
                        )
                        alert.show()
                    }
                    
                    VLoading.hideLoading()
                }

error: Received invalid pass data

I am doing integration Add to Wallet feature in my React native App. I have installed the package and while testing on device, getting an error

error: Received invalid pass data

Can I get some help on this? Is there any proper documentation someone share if i am missing something.

Thanks!

Cannot read property 'canAddPasses' of undefined

Looks like it's not calling any native iOS methods. I tried deleting node_modules and installing packages again to work react-native-link. Still no luck with that.
screen shot 2017-12-06 at 8 29 15 pm

Is there anything that I might be missing?

screen shot 2017-12-05 at 11 03 49 am

FYI
I am calling below function on button click.

Wallet.canAddPasses()
      .then(res => {
          console.log(res);
      })
      .catch((e) => {
          console.log(e);
      });

bank payment card

Hello
Thanks for awesome package.
Is it possible to add a bank payment card using this package in order to use it in Apple Pay?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.