darryncampbell / react-native-datawedge-intents

React Native interface for Zebra's DataWedge Intent API
MIT License
43 stars 46 forks source link

Prevent iOS devices from crashing when using module in single app for both platforms #22

Closed vkozinec closed 3 years ago

vkozinec commented 3 years ago

Closes #21

Hello, as discussed I have added this simple check for Android and checked on a couple of devices that are not Zebra ( Huawei and Samsung ), and looks like it works without any problems. Not sure if this is the best solution, but works for our project atm.

The reason that I have this problem is we are building an RN app for scanning that also uses a camera and runs on both platforms so outside of Zebra devices ( at least for our project ) I do not need to have intents.

I have also removed all those deprecated values since they are not in types and maybe they can be removed in the latest version and kept in previous ones.

One more thing, our app uses functional components so I adapted intents to be used with 2 simple hooks. One hook runs on startup, checks if the profile is set, if so, it does not reset it again or sets it if there is specified profile from config. Another hook is used when we need access to scanned values or a list of all scans on the current screen.

I would be happy to share that code for example app if you are interested or help any other way I can.

darryncampbell commented 3 years ago

Hi, thank you for the contribution but I do not want to remove the 'deprecated' functions as it could break backwards compatibility. I could bump the major version from 0 to 1 to indicate a breaking change but I would rather not do that either. I would appreciate if you could please take a look at https://github.com/darryncampbell/react-native-datawedge-intents/commit/e5859f641fc095cd86ca812ae317513ab05b2442, does that address the immediate issue of the plugin not compiling on iOS? If so, I'll push it to npm, thanks.

vkozinec commented 3 years ago

This commit e5859f6 is the same thing I did the first time when I wanted to fix the issue on iOS so I am sure this works. I tested it right now just in case and can confirm that error is gone on iOS.

Thank you also for the time to include this fix. You can close this PR when you publish a new version.

darryncampbell commented 3 years ago

Thanks for the quick reply. Version 0.1.8 is now published to npm with this change: https://www.npmjs.com/package/react-native-datawedge-intents/v/0.1.8