@spencerls/react-native-nfc 1.0.0 → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +9 -8
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # @spencer/nfc
2
2
 
3
- A clean, easy, React-friendly NFC service built on `react-native-nfc-manager`.
3
+ An easy, clean, React-friendly NFC service built on `react-native-nfc-manager`.
4
4
 
5
5
  ## Installation
6
6
 
@@ -19,25 +19,26 @@ React Native 0.74+ or Expo (Bare / Prebuild)
19
19
  ## Usage
20
20
 
21
21
  ```tsx
22
- import { nfcService, useNfcState, NfcUtils } from "@spencer/nfc";
22
+ import { nfc } from "@spencer/nfc";
23
+ import { Ndef, NfcAdapter } from "react-native-nfc-manager";
23
24
 
24
25
  export default function Example() {
25
- const { state, isWriting } = useNfcState();
26
+ const { nfcState } = useNfc();
26
27
 
27
28
  useEffect(() => {
28
- nfcService.startReader(
29
+ nfc.service.startReader(
29
30
  NfcAdapter.FLAG_READER_NFC_V | NfcAdapter.FLAG_READER_NO_PLATFORM_SOUNDS,
30
31
  async (tag) => {
31
32
  console.log("Tag:", tag);
32
- await nfcService.stopReader();
33
- await nfcService.writeNdef([NfcUtils.textRecord("Hello NFC!")]);
33
+ await nfc.service.stopReader();
34
+ await nfc.service.writeNdef([Ndef.textRecord("Hello NFC!")]);
34
35
  }
35
36
  );
36
37
 
37
- return () => nfcService.stopReader();
38
+ return () => nfc.service.stopReader();
38
39
  }, []);
39
40
 
40
- return <Text>NFC state: {state}</Text>;
41
+ return <Text>NFC state: {nfcState}</Text>;
41
42
  }
42
43
  ```
43
44
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@spencerls/react-native-nfc",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "description": "A lightweight NFC manager for React Native projects using react-native-nfc-manager.",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",