When writing a text NDEF message to an NFC tag using the react-native-nfc-manager package, there is an issue where the length byte of the NDEF message is sometimes set to 0, causing the message to be unreadable. This issue only occurs on iOS and behaves inconsistently.
Steps to Reproduce:
Write a text NDEF message to an NFC tag, using a string passed as a parameter to the writeNdef function.
Read the tag to verify the message.
Observe that the length byte is sometimes set to 0.
Notes:
The issue does not occur when using a hardcoded string in the writeNdef function. However, when passing the string as a parameter, the length byte can be set to 0.
Logged the length and type of the string in both cases (hardcoded vs parameter) and confirmed that both are identical.
This issue has only been tested iOS; the behavior on Android has not yet been tested.
The length byte should be set correctly regardless of whether the string is hardcoded or passed as a parameter.
Actual Behavior:
In some cases, when passing a string as a parameter, the length byte is set to 0, causing the NDEF message to be unreadable.
Environment:
react-native-nfc-manager version: 3.16.0
iOS version: 18.1
React Native version: 0.72.3
Screenshots
The second byte in Block 0002 is the length byte. Left image was written using this library. Right image was written using NFC Tools application (Native iOS) with same message.
When writing a text NDEF message to an NFC tag using the
react-native-nfc-manager
package, there is an issue where the length byte of the NDEF message is sometimes set to 0, causing the message to be unreadable. This issue only occurs on iOS and behaves inconsistently.Steps to Reproduce:
writeNdef
function.Notes:
writeNdef
function. However, when passing the string as a parameter, the length byte can be set to 0.Expected Behavior:
The length byte should be set correctly regardless of whether the string is hardcoded or passed as a parameter.
Actual Behavior:
In some cases, when passing a string as a parameter, the length byte is set to 0, causing the NDEF message to be unreadable.
Environment:
react-native-nfc-manager
version: 3.16.0Screenshots
The second byte in Block 0002 is the length byte. Left image was written using this library. Right image was written using NFC Tools application (Native iOS) with same message.