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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@team_yumi/code-scanner

v0.0.16

Published

This library was generated with [Nx](https://nx.dev).

Readme

code-scanner (using Capacitor)

This library was generated with Nx.

Instalation and Config

npm i @team_yumi/code-scanner

Config for iOS

For iOS you need to set a usage description in your info.plist file.

This can be done by either adding it to the Source Code directly or by using Xcode Property List inspector.

Adding it to the source code directly

Open up the Info.plist (in Xcode right-click > Open As > Source Code) With change the following

<dict>
+  <key>NSCameraUsageDescription</key>
+  <string>To be able to scan barcodes</string>
</dict>

NOTE: "To be able to scan barcodes" can be substituted for anything you like.

Adding it by using Xcode Property List inspector

Open up the Info.plist in Xcode (right-click > Open As > Property List) Next to "Information Property List" click on the tiny + button. Under key, type "Privacy - Camera Usage Description" Under value, type "To be able to scan barcodes" NOTE: "To be able to scan barcodes" can be substituted for anything you like.

More info here: https://developer.apple.com/documentation/bundleresources/information_property_list/nscamerausagedescription

Config for Android

Within your AndroidManifest.xml file, change the following:

<?xml version="1.0" encoding="utf-8"?>
<manifest
  xmlns:android="http://schemas.android.com/apk/res/android"
+  xmlns:tools="http://schemas.android.com/tools"
  package="com.example">

  <application
+    android:hardwareAccelerated="true"
  >
  </application>

+  <uses-permission android:name="android.permission.CAMERA" />

+  <uses-sdk tools:overrideLibrary="com.google.zxing.client.android" />
</manifest>

How to use

The package exports 2 elements : a ScannerHoC (higher order component) and a useScanner Hook.

ScannerHoc

The ScannerHoC component should be used on the root of your application. If you are using Ionic, you should put it wrapping your IonPage component. This is due the component hides the entire html root element and mounts its own.

Impotant Note:

Is important to import the index.css styles on the file where the HoC is imported.


import { ScannerHoC } from '@team_yumi/code-scanner';

import '@team_yumi/code-scanner/index.css';

const ToolPageWrapper: React.FC<IProps> = (props) => {
  return (
    <ScannerHoC>
      {/* Page */}
    </ScannerHoC>
  )
}

useScanner

The useScanner hook receives two optional function arguments, the first one is executed when the main button of the scanner is pressed, and the second one is executed when the back button of the scanner is pressed, that way you can create callbacks that executes when ever you press any of those buttons.

Also the useScanner gives a the startScan function. Once we execute this function all the magic begins and the scan reader component is mounted on the screen. To obtain the code scanned by the scanner you should pass a callback function to startScan as a parameter, this function must fulfill width the contract:

(code: string) => void

so to use it you should doit like this:

...
const { startScan } = useScanner(
  () => { console.log('This code executes when main button of scanner view is pressed') }, 
  () => { console.log('This code executes when back button of scanner view is pressed') }
);

const handleOnShowScannerClick = () => {
  if (startScan){
    startScan((scannedCode) => {
      // This function is executed when the barcode is scanned
      console.log(`This is the code scanned ${scannedCode}`)
    })
  }
}
...

Personalization

If you want to personalize the style of the component yo can use your own style file. Just use the same css-clases than the original.