aclec / expo-zebra-scanner

12 stars 6 forks source link

Error and help DataWedgeConfiguration #1

Closed pabl-o-ce closed 1 year ago

pabl-o-ce commented 1 year ago

Hi, nice project

I'm trying to play with your package but I'm getting this error

 ERROR  Error: Cannot find native module 'ExpoZebraScanner'
 ERROR  Invariant Violation: Failed to call into JavaScript module method AppRegistry.runApplication(). Module has not been registered as callable. Registered callable JavaScript modules (n = 11): Systrace, JSTimers, HeapCapture, SamplingProfiler, RCTLog, RCTDeviceEventEmitter, RCTNativeAppEventEmitter, GlobalPerformanceLogger, JSDevSupportModule, HMRClient, RCTEventEmitter.
        A frequent cause of the error is that the application entry file path is incorrect. This can also happen when the JS bundle is corrupt or there is an early initialization error when loading React Native.
 ERROR  Invariant Violation: Failed to call into JavaScript module method AppRegistry.runApplication(). Module has not been registered as callable. Registered callable JavaScript modules (n = 11): Systrace, JSTimers, HeapCapture, SamplingProfiler, RCTLog, RCTDeviceEventEmitter, RCTNativeAppEventEmitter, GlobalPerformanceLogger, JSDevSupportModule, HMRClient, RCTEventEmitter.
        A frequent cause of the error is that the application entry file path is incorrect. This can also happen when the JS bundle is corrupt or there is an early initialization error when loading React Native.

I enable in DataWedge Intent and barcode.

The thing I don't understand is what means your DataWedgeConfiguration and how to do it.

Any help or feedback will be very appreciate.

aclec commented 1 year ago

Hi,

To configure DataWedge, you need to use the native app of zebra: https://techdocs.zebra.com/datawedge/latest/guide/settings/

After, add the package with yarn and then you need to create an expo dev app to use it: https://docs.expo.dev/develop/development-builds/introduction/

If you just want to try, you can download my github, install dependencies in the core directory and in the example directory. Then, run "yarn android --device" in the example directory to start it on your zebra device. You will see the scanned data log to your console.

If an error persists, send me the returned error.

pabl-o-ce commented 1 year ago

Hi @aclec

Thanks for the response and sorry for my late response.

Yes I think my problem is in expo development build let me tested [just using expo start]

aclec commented 1 year ago

@pabl-o-ce ,

The package is adding custom native code, you need to use " expo start --dev-client ". If you just use " expo start ", you will run the development server for Expo Go and not for your custom development build. For the custom dev build, run " eas build --profile development --platform android ".

pabl-o-ce commented 1 year ago
Android Bundling complete 23945ms
 ERROR  Error: Cannot find native module 'ExpoZebraScanner'
 ERROR  Invariant Violation: Failed to call into JavaScript module method AppRegistry.runApplication(). Module has not been registered as callable. Registered callable JavaScript modules (n = 11): Systrace, JSTimers, HeapCapture, SamplingProfiler, RCTLog, RCTDeviceEventEmitter, RCTNativeAppEventEmitter, GlobalPerformanceLogger, JSDevSupportModule, HMRClient, RCTEventEmitter.
        A frequent cause of the error is that the application entry file path is incorrect. This can also happen when the JS bundle is corrupt or there is an early initialization error when loading React Native.
 ERROR  Invariant Violation: Failed to call into JavaScript module method AppRegistry.runApplication(). Module has not been registered as callable. Registered callable JavaScript modules (n = 11): Systrace, JSTimers, HeapCapture, SamplingProfiler, RCTLog, RCTDeviceEventEmitter, RCTNativeAppEventEmitter, GlobalPerformanceLogger, JSDevSupportModule, HMRClient, RCTEventEmitter.
        A frequent cause of the error is that the application entry file path is incorrect. This can also happen when the JS bundle is corrupt or there is an early initialization error when loading React Native.
aclec commented 1 year ago

@pabl-o-ce are you using Expo SDK 48 ?

if you have it:

Are you using TypeScript ?

pabl-o-ce commented 1 year ago

are you using Expo SDK 48 ?

no using SDK 47

Are you using TypeScript ?

yes I'm using typescript

aclec commented 1 year ago

@pabl-o-ce

Can you try with Expo 48 and enable Hermes Engine ?

Expo Module Api is new and it’s based on the new react-native architecture for native module. I don’t know if the SDK 47 support it.

pabl-o-ce commented 1 year ago

I upgrade and enable Hermes Engine...

in the useEffect I put:

useEffect(() => {
    const listner = ExpoZebraScanner.addListener(event => {
      const { scanData, scanLabelType } = event;
      console.log(scanData);
      console.log(scanLabelType);
    });
    ExpoZebraScanner.startScan();
    return () => {
      ExpoZebraScanner.removeListener(listner);
      ExpoZebraScanner.stopScan();
    };
  }, []);

I can't get the log of this scanData, scanLabelType

pabl-o-ce commented 1 year ago

Thanks a lot it works

change the config in the DataWedge:

Send the intent => Emit Intent

check the flag to broadcast intent

And work perfectly

THANKS a lot for the reference and guide.

I can help you to put in the README this so other can figure out more quickly?

Let me know

🙂 have a great day

aclec commented 1 year ago

@pabl-o-ce

Sure, feel free to update the README. Happy that helped you.