Skip to content
This repository has been archived by the owner on Oct 10, 2024. It is now read-only.

v2.0.0

Compare
Choose a tag to compare
@tafelnl tafelnl released this 04 Jun 13:10
· 58 commits to main since this release
a020fd2

🚀 This release adds support for Capacitor 3

How to migrate from v1 to v2?

Update your main package

First of all, you should make sure you have followed all the steps of the official Capacitor docs to migrate your main app to Capacitor 3.0, if you haven't already. Read more about this here.

Upgrade this package through npm

Run

npm install @capacitor-community/barcode-scanner@latest
npx cap sync

from your terminal.

Troubleshooting

If XCode or Android Studio give any errors after upgrading, check: troubleshooting

(Android) Registering plugin in MainActivity

From Capacitor 3 on, it is not necessary anymore to register the plugin manually in MainActivity. So you can remove the following lines from your MainActivity.java:

import com.dutchconcepts.capacitor.barcodescanner.BarcodeScanner;
add(BarcodeScanner.class);

Read more about this here

Plugin import

Additionally you can, but are not required to, change how you import this plugin.

Old way:

import { Plugins } from '@capacitor/core';
const { BarcodeScanner } = Plugins;

New way:

import { BarcodeScanner } from '@capacitor-community/barcode-scanner';

Read more about this here

Breaking changes

Error message unimplemented methods on web

The Error being thrown for unimplemented web method is a little different now (diff).

Old error message: method not available in web
New error message: Not implemented on web.

TypeScript definitions

Some TypeScript definitions were incorrect and are fixed now (diff)