Skip to content

markmadlangbayan/react-native-wallet

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

react-native-wallet

ReactNative module for Apple Wallet Version 1.0.5

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)
    }
}

About

ReactNative module for Apple Wallet

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Objective-C 52.3%
  • JavaScript 37.6%
  • Ruby 10.1%