Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
_startNfc = () => {
NfcManager.start()
.then(() => NfcManager.isEnabled())
.then(enabled => this.setState({ enabled }))
.catch(err => {
console.warn(err);
this.setState({ enabled: false });
});
};
_startNfc() {
NfcManager.start({
onSessionClosedIOS: () => {
console.log('ios session closed');
}
})
.then(result => {
console.log('start OK', result);
})
.catch(error => {
console.warn('start fail', error);
this.setState({supported: false});
})
if (Platform.OS === 'android') {
NfcManager.getLaunchTagEvent()
.then(tag => {
console.log('launch tag', tag);
_startNfc = () => {
NfcManager.start()
.then(() => NfcManager.isEnabled())
.then(enabled => this.setState({enabled}))
.catch(err => {
console.warn(err);
this.setState({enabled: false})
})
}