forked from Kerumen/react-native-awesome-card-io
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCardIOView.ios.js
51 lines (44 loc) · 1.27 KB
/
CardIOView.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
42
43
44
45
46
47
48
49
50
51
import React, { Component } from 'react'
import PropTypes from 'prop-types'
import {
requireNativeComponent,
NativeAppEventEmitter,
NativeModules,
} from 'react-native'
const { CardIOUtilities } = NativeModules
class CardIOView extends Component {
static propTypes = {
didScanCard: PropTypes.func.isRequired,
languageOrLocale: PropTypes.string,
guideColor: PropTypes.string,
useCardIOLogo: PropTypes.bool,
hideCardIOLogo: PropTypes.bool,
allowFreelyRotatingCardGuide: PropTypes.bool,
scanInstructions: PropTypes.string,
scanOverlayView: PropTypes.element,
scanExpiry: PropTypes.bool,
scannedImageDuration: PropTypes.number,
detectionMode: PropTypes.oneOf([
CardIOUtilities.DETECTION_MODE.AUTOMATIC,
CardIOUtilities.DETECTION_MODE.IMAGE_AND_NUMBER,
CardIOUtilities.DETECTION_MODE.IMAGE,
]),
}
componentWillMount() {
const { didScanCard } = this.props
this.listener = NativeAppEventEmitter.addListener(
'didScanCard',
didScanCard,
)
}
componentWillUnmount() {
if (this.listener) {
this.listener.remove()
}
}
render() {
return <RCTCardIOView {...this.props} />
}
}
const RCTCardIOView = requireNativeComponent('RCTCardIOView', CardIOView)
export default CardIOView