I am trying to add the NFC feature in my react-native app by using react-native-NFC-Manager and it is working fine. But the issue is at the first time I am unable to read/write the NFC card. For the first time, I need to write a new tag by using the NFC Tool app to convert 'NdefFormatable' to 'Ndef' otherwise I am not able to read/write the NFC card
I have used this code to write data:
await NfcManager.requestTechnology(NfcTech.Ndef, {
alertMessage: 'Ready to write some NDEF',
});
const bytes = Ndef.encodeMessage([Ndef.textRecord('Hello NFC')]);
if (bytes) {
await NfcManager.ndefHandler // Step2
.writeNdefMessage(bytes); // Step3
if (Platform.OS === 'ios') {
await NfcManager.setAlertMessageIOS('Successfully write NDEF');
}
}
Is there any solution to this issue?