How to use the react-native-nfc-manager.mifareClassicSectorToBlock function in react-native-nfc-manager

To help you get started, we’ve selected a few react-native-nfc-manager examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github whitedogg13 / react-native-nfc-manager / example / AndroidMifareClassic.js View on Github external
const write = () => {
      return NfcManager.mifareClassicSectorToBlock(parseInt(this.state.sector))
        .then(block => {
          // Create 1 block
          let data = [];
          for (let i = 0; i < NfcManager.MIFARE_BLOCK_SIZE; i++) {
            data.push(0);
          }

          // Fill the block with our text, but don't exceed the block size
          for (let i = 0; i < this.state.textToWrite.length && i < NfcManager.MIFARE_BLOCK_SIZE; i++) {
            data[i] = parseInt(this.state.textToWrite.charCodeAt(i));
          }

          return NfcManager.mifareClassicWriteBlock(block, data);
        })
        .then(read)
    };
github whitedogg13 / react-native-nfc-manager / example / AndroidMifareClassic.js View on Github external
.then(() =>
          NfcManager.mifareClassicSectorToBlock(parseInt(this.state.sector)),
        )