revtel / react-native-nfc-manager

React Native NFC module for Android & iOS
MIT License
1.32k stars 312 forks source link

Unable to write #692

Closed kamatil-dev closed 5 months ago

kamatil-dev commented 6 months ago

Hello guys, please i've contacted so many devs but none of them were able to solve this problem

you can check this snack https://snack.expo.dev/@karim.amahtil/bossy-red-chocolates and tell me why the writing is not working (you can go directly to line 80), i've tried expo cloud build and local build, on both the writing function was not working

kamatil-dev commented 6 months ago

@whitedogg13

cavasinf commented 5 months ago

Did you take a look at https://github.com/revtel/react-native-nfc-manager/wiki/Examples#write-a-tag?

if (bytes) {
  await NfcManager.ndefHandler // STEP 2
    .writeNdefMessage(bytes); // STEP 3
  result = true;
}

Your if is inverted:

if (!bytes) await NfcManager.ndefHandler.writeNdefMessage(bytes);