import React from 'react' import { View, Text, TouchableOpacity } from 'react-native' import NfcManager, {NfcEvents} from '../NfcManager'; class AppV2 extends React.Component { componentDidMount() { NfcManager.start(); NfcManager.setEventListener(NfcEvents.DiscoverTag, tag => { console.warn('tag', tag); NfcManager.setAlertMessageIOS('I got your tag!'); NfcManager.unregisterTagEvent().catch(() => 0); }); } componentWillUnmount() { NfcManager.setEventListener(NfcEvents.DiscoverTag, null); NfcManager.unregisterTagEvent().catch(() => 0); } render() { return ( NFC Demo Test Cancel Test ) } _cancel = () => { NfcManager.unregisterTagEvent().catch(() => 0); } _test = async () => { try { await NfcManager.registerTagEvent(); } catch (ex) { console.warn('ex', ex); NfcManager.unregisterTagEvent().catch(() => 0); } } } export default AppV2