forked from miyabi/react-native-passkit-wallet
-
Notifications
You must be signed in to change notification settings - Fork 0
/
PassKit.ios.js
executable file
·41 lines (33 loc) · 1.14 KB
/
PassKit.ios.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
/**
* @flow
*/
'use strict'
import { NativeModules, NativeEventEmitter } from 'react-native'
import type EmitterSubscription from 'EmitterSubscription'
const nativeModule = NativeModules.RNPassKit
const nativeEventEmitter = new NativeEventEmitter(nativeModule)
export default {
...nativeModule,
addPass: (base64Encoded: string, fileProvider?: string): Promise<void> => {
return nativeModule.addPass(base64Encoded)
},
presentAddPassesViewController: (base64Encoded: string): Promise<void> => {
// eslint-disable-next-line no-console
console.warn(
'PassKit.presentAddPassesViewController is deprecated. Use PassKit.addPass instead.'
)
return nativeModule.addPass(base64Encoded)
},
containsPass: (base64Encoded: string): Promise<boolean> => {
return nativeModule.containsPass(base64Encoded)
},
addEventListener: (
eventType: string,
listener: Function,
context: ?Object
): ?EmitterSubscription =>
nativeEventEmitter.addListener(eventType, listener, context),
removeEventListener: (eventType: string, listener: Function): void => {
nativeEventEmitter.removeListener(eventType, listener)
}
}