npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

react-native-cardsdk

v2.1.1

Published

Goodcom card(magnetic cards, IC cards, and NFC cards) sdk for react-native

Readme

react-native-cardsdk (v2.1.1)

React Native module for reading/writing magnetic cards, IC cards, and interacting with NFC/CPU cards using Goodcom card SDK.

Installation

npm install react-native-cardsdk --save

or

yarn add react-native-cardsdk

Android setup

  1. Register the packages in your MainApplication.java:
import com.goodcom.react.GcCard.GcNfcPackage;
import com.goodcom.react.GcCard.GcIccPackage;

@Override
protected List<ReactPackage> getPackages() {
    List<ReactPackage> packages = new PackageList(this).getPackages();
    packages.add(new GcNfcPackage());
	packages.add(new GcIccPackage());
    return packages;
}
  1. To read a magnetic or IC card, you need to perform the following in your MainActivity.java:
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
    if (keyCode == KeyEvent.KEYCODE_F10) {
        GcIccModule.readCardFromActivity();
        GcCardModule.readCardFromActivity();
        return true;
    }
    return super.onKeyDown(keyCode, event);
}

Usage

import {GcCardModule} from 'react-native-cardsdk';

const CardTestScreen = ({ goBack }) => {
  const [cardNumber, setCardNumber] = useState('');
  const [statusMsg, setStatusMsg] = useState('');
  const toastOpacity = useRef(new Animated.Value(0)).current;
  const cardEmitter = new NativeEventEmitter(GcCardModule);
  const toastTimer = useRef(null);

  useEffect(() => {

  	GcCardModule.init();

  	const subReady = cardEmitter.addListener('Nfc_ready', (event) => {
      GcCardModule.GcReadCPU();
    });

    const subSmartCard = nfcEmitter.addListener('Nfc_smart', (event) => {
      console.log("message: ", event.message);
      setCardNumber(event.message || '');
    });

	const subMag = cardEmitter.addListener('Mag_card', data => {
	  if (data && data.R_res) {
	    setCardNumber(data.R_res);
	  }
	});

	const subMagData = cardEmitter.addListener("Mag_data", (data) => {
	    console.log("Track1:", data.track1);
	    console.log("Track2:", data.track2);
	    console.log("Track3:", data.track3);
  	});

    const subIcc = cardEmitter.addListener('Icc_card', data => {
	  if (data && data.R_res) {
	    setCardNumber(data.R_res);
	  }
	});

	const subIccCustom = cardEmitter.addListener('Icc_custom', data => {
	  if (data && data.R_res) {
	    setCardNumber(data.R_res);
	  }
	});

 	const subIccEvent = cardEmitter.addListener('Icc_event', data => {
 		console.log("Icc_event:", data);
 		showToast(data);
 		if (data === 'ICC_POWER_ON') {
 			GcCardModule.GcReadIcCard();
 		}
	});

    const backHandler = BackHandler.addEventListener('hardwareBackPress', () => {
      if (goBack) {
        goBack();
        return true;
      }
      return false;
    });

    return () => {
      backHandler.remove();
      subMag.remove();
      subMagData.remove();
      subIcc.remove();
      subIccCustom.remove();
      subIccEvent.remove();
      subReady.remove();
      subSmartCard.remove();
      if (toastTimer.current) {
        clearTimeout(toastTimer.current);
      }
    };
  }, []);

API Methods (GcCardModule)

| Method | Parameters | Description | Return / Notes | | -------------------------------------------------------------- | --------------------------------------------------------------------------------- | ---------------------------------------------------- | -------------- | | init() | None | Initialize card manager and register message handler | void | | GcReadIcCard() | None | Read IC card | void | | IccSend_APDU(hexData) | hexData: string | Send APDU command to IC card | void | | GcReadMF0ALL() | None | Read all MF0 blocks | void | | GcWriteMF0ALL(data) | data: string | Write data to all MF0 blocks | void | | GcDefaultAuth1() | None | Default authentication | void | | GcDefaultAuth2(block) | block: number | Authenticate single block | void | | GcDefaultAuth3(auth_type, block) | auth_type: number, block: number | Authenticate with custom type | void | | GcUserAuth(auth_type, block, userPwd) | auth_type: number, block: number, userPwd: string | Authenticate with user password | void | | GcReadMF1() | None | Read all MF1 blocks | void | | GcReadMF1_Custom1(startBlock, blockNum) | startBlock: number, blockNum: number | Read specific MF1 blocks | void | | GcWriteMF1(data) | data: string | Write to MF1 | void | | GcWriteMF1_Custom1(startBlock, blockNum, data) | startBlock: number, blockNum: number, data: string | Write to custom MF1 blocks | void | | GcWriteMF1_Custom2(startBlock, blockNum, data, bUseGcFormat) | startBlock: number, blockNum: number, data: string, bUseGcFormat: boolean | Write MF1 with optional Goodcom format | void | | GcSetValue1(value) | value: number | Set default MF1 value | void | | GcSetValue2(block, value) | block: number, value: number | Set value for block | void | | GcAddValue1(value) | value: number | Add value to default MF1 | void | | GcAddValue2(block, value) | block: number, value: number | Add value to specific block | void | | GcGetValue1() | None | Get default MF1 value | void | | GcGetValue2(block) | block: number | Get value from block | void | | GcReduceValue1(value) | value: number | Reduce default MF1 value | void | | GcReduceValue2(block, value) | block: number, value: number | Reduce value for block | void | | GcNfcReset() | None | Reset NFC | void | | GcReadCPU() | None | Read CPU card | void | | SendAPDU(hexCommand) | hexCommand: string | Send APDU to NFC | void | | SendRATS() | None | Send RATS command | void | | addListener(eventName) | eventName: string | Register listener for events | void | | removeListeners(count) | count: number | Remove listeners | void |


Events

| Event | Payload | Description | | ------------------ | ---------------------------------------------------- | ---------------------------- | | Nfc_ready | { message: string } | NFC ready with serial number | | Nfc_auth | { result: boolean } | Authentication result | | Nfc_Read_res | { message: string } | Read data from MF blocks | | Nfc_Write_res | { result: boolean } | Write result | | Nfc_Set_value | { result: boolean } | Set value result | | Nfc_Get_value | { value: number } | Get value result | | Nfc_Add_value | { result: boolean } | Add value result | | Nfc_Reduce_value | { result: boolean } | Reduce value result | | Nfc_smart | { message: string } | Smart card number | | Nfc_apdu | { message: string } | APDU response | | Mag_card | { R_res: string } | Magnetic card raw result | | Mag_data | { track1: string, track2: string, track3: string } | Parsed magnetic track data | | Icc_card | { R_res: string } | IC card raw result | | Icc_custom | { R_res: string } | Custom APDU response |