Skip to content

levepic/react-native-nfc-manager

This branch is 310 commits behind revtel/react-native-nfc-manager:main.

Folders and files

NameName
Last commit message
Last commit date

Latest commit

2cd94ce · Feb 27, 2020
Oct 28, 2019
Jan 28, 2020
Jan 31, 2020
Oct 28, 2019
Apr 15, 2018
Apr 15, 2018
Apr 15, 2018
Sep 10, 2019
Sep 10, 2019
Oct 5, 2018
Oct 5, 2018
Jun 21, 2017
Dec 30, 2019
Sep 17, 2018
Apr 15, 2018
Jan 31, 2020
Feb 27, 2020
Jan 31, 2020
Sep 17, 2018
Jan 31, 2020
Apr 14, 2018

Repository files navigation

react-native-nfc-manager

npm version build issues

Bring NFC feature to React Native. Inspired by phonegap-nfc and react-native-ble-manager

Contributions are welcome!

Install

# RN >= 0.60
npm i --save react-native-nfc-manager
# RN < 0.60 (without the latest iOS 13 feature)
npm i --save react-native-nfc-manager@1.2.2

Setup

# RN >= 0.60, iOS
cd ios && pod install && cd ..
# ...then open ios/xxx.xcworkspace...
# RN >= 0.60, Android
# This module leverages autolink, so no extra steps are required

(see here for more info about autolink)

# RN < 0.60, both platforms
react-native link react-native-nfc-manager

Extra iOS setup is required

You will need to setup some capabilities / entitlement / plist stuff to enable NFC development on your device, this repo explains these requirements very well:

IMPORTANT: For the new NFC capabilities available on iOS 13 to work, the entitlements file mentioned in the previous guide should look like this:

<key>com.apple.developer.nfc.readersession.formats</key>
<array>
  <string>NDEF</string>
  <string>TAG</string>
</array>

Launch app on nfc event

Note on getLaunchTagEvent: keep in mind that you can only create intent-filters for the very first NDEF record on an NFC tag! If your intent-filter doesn't match the FIRST record your app will launch but it won't get the tag data. Check out for details: https://stackoverflow.com/questions/25504418/get-nfc-tag-with-ndef-android-application-record-aar/25510642

Also you should add

android:launchMode="singleTask"

to your manifest to prevent launching your app as another task when it is already running.

Demo project

Please use this repo as a quick start.

Example codes

Look into example for the features you need.

v2 examples

v1 examples

API Document

About

React Native NFC module for Android & iOS

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 45.1%
  • Java 33.9%
  • Objective-C 20.8%
  • Ruby 0.2%