1.0.12 • Published 10 months ago

dyscan-expo-plugin v1.0.12

Weekly downloads
-
License
MIT
Repository
-
Last release
10 months ago

Expo plugin for @dyneti/react-native-dyscan

This plugin allows you to use @dyneti/react-native-dyscan in Expo mobile app.

For additional context and details about this plugin, check out this post.

Add the package to your npm dependencies

npx expo install dyscan-expo-plugin

Configuration in app.json/app.config.js

https://docs.dyneti.com/react-native-integration-guide#linking-for-android

{
  "expo": {
    "plugins": [
      [
        "dyscan-expo-plugin",
        {
          "username": "nexusUsername",
          "password": "nexusPassword"
        }
      ]
    ]
  }
}

Example

import { DyScan, DyScanModule } from '@dyneti/react-native-dyscan';
import { Env } from '@env';
import { useEffect } from 'react';


export const useScanCard = () => {
  useEffect(() => {
    DyScan.init({
      apiKey: Env.DYSCAN_API_KEY,
    });
  }, []);

  const scanCard = async () => {
    const isSupported = await DyScan.isDeviceSupported();

    if (!isSupported) {
      console.log('DyScan - device does not support');
      return null;
    }

    try {
      const card = await DyScanModule.scanCard({
        showDynetiLogo: false,
        helperTextFontFamily: 'inter',
        helperTextString: 'Your card will be scanned automatically',
        helperTextSize: 14,
        helperTextColor: '#F5F5F7',
        bgColor: '#2D2D2D',
        bgOpacity: 0.8,
        cornerInactiveColor: '#FFFFFF',
        cornerCompletedColor: '#F5F5F7',
        lightTorchWhenDark: false,
        vibrateOnCompletion: true,
      });

      return card;
    } catch (err) {
      console.error(err);
      return null;
    }
  };

  return scanCard;
};
1.0.12

10 months ago

1.0.11

11 months ago

1.0.10

11 months ago

1.0.9

11 months ago

1.0.8

11 months ago

1.0.7

11 months ago

1.0.6

11 months ago

1.0.5

11 months ago

1.0.4

11 months ago

1.0.3

11 months ago

1.0.2

11 months ago

1.0.1

11 months ago

1.0.0

11 months ago