forked from Kerumen/react-native-awesome-card-io
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathCardIOView.ios.js
43 lines (37 loc) · 1.02 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
import React, { Component } from 'react'
import PropTypes from 'prop-types'
import {
requireNativeComponent,
NativeAppEventEmitter
} from 'react-native'
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
}
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