Aleksandar Zoric
Aleksandar Zoric

Reputation: 1483

Can I use a Zebra scanner package with Expo project in React Native?

There is an npm package for Zebra scanners (Barcode scanner with laser/not camera) that we need to use in an Android app we plan to build with React Native. Now Expo CLI seems like the way to go but after some quick research, we are not too sure if this is possible - to include this zebra package in an Expo project. Can you confirm this is the case?

I ask because of the following facts regarding using Expo:

The application should allow a user to use the Zebra scanner running Android OS to scan a barcode and return the scanned data.

Package link: https://www.npmjs.com/package/react-native-zebra-scanner

Upvotes: 2

Views: 2491

Answers (2)

samf3u
samf3u

Reputation: 29

For anyone still trying to use a laser scanner with Expo, I have found a workaround on my particular device.

  1. In the apps on the device, there is a 'Scanner' app which consists of the settings for the scanning.

    App Icon View

  2. There is an 'Output Mode' setting which has a few options. The default option for me was set to 'Broadcast Mode' which doesn't work in an expo app. However, changing to the 'Keyboard Mode' worked.

    Output Mode Setting View

  3. The difference that I have noticed is that the 'Keyboard Mode' simply reads the bar code and inputs text, it doesn't go to a new line after the scan. To fix this, there is another setting called 'Append suffix' which can be set to the enter key of the device. So whenever a scan is complete, it will automatically go to the next line.

    Append Suffix Setting View

  4. Now when you are implementing your app in Expo, you can create a 'TextInput' and call your function in the 'onSubmitEditting' of that TextInput.

    TextInput onSubmitEdditing

  5. (Optional) I have set the 'autoFocus' of the TextInput to 'True' in order to be able to scan as soon as the page is displayed, as well as the 'blurOnSubmit' to False to stay focused on the TextInput after the scan has been completed and function has been called. This allows for multiple scans without having to click on the TextInput everytime.

    Optional Settings

Let me know if it works for you :)

Upvotes: 3

Aleksandar Zoric
Aleksandar Zoric

Reputation: 1483

@yeslamFaded - as per answer: In this package you need to change something inside the android/settings file and you dont have this when you work with expo. To use this package you would have to exject from expo

Upvotes: 0

Related Questions