Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
console.warn('start fail', error);
this.setState({supported: false});
})
if (Platform.OS === 'android') {
NfcManager.getLaunchTagEvent()
.then(tag => {
console.log('launch tag', tag);
if (tag) {
this.setState({ tag });
}
})
.catch(err => {
console.log(err);
})
NfcManager.isEnabled()
.then(enabled => {
this.setState({ enabled });
})
.catch(err => {
console.log(err);
})
NfcManager.onStateChanged(
event => {
if (event.state === 'on') {
this.setState({enabled: true});
} else if (event.state === 'off') {
this.setState({enabled: false});
} else if (event.state === 'turning_on') {
// do whatever you want
} else if (event.state === 'turning_off') {
// do whatever you want
export function check_tagged_nfc_card(props, deviceId) {
NfcManager.isEnabled().then(status => {
if (status) {
register_tag_event(props, deviceId);
} else {
showToastDanger("NFC is disabled");
}
});
}
.then(() => NfcManager.isEnabled())
.then(enabled => this.setState({enabled}))
.then(() => NfcManager.isEnabled())
.then(enabled => this.setState({ enabled }))