bwip-js icon indicating copy to clipboard operation
bwip-js copied to clipboard

Does this library support react-native?

Open QMY-ZQ opened this issue 1 year ago • 4 comments

I tried installing this library and the same problem occurred,Is there any solution?https://github.com/metafloor/bwip-js/issues/296

QMY-ZQ avatar May 22 '24 02:05 QMY-ZQ

This project should support react-native. You likely need to enable export maps support in your project - it is the modern multi-platform packaging solution.

metafloor avatar May 23 '24 21:05 metafloor

This project should support react-native. You likely need to enable export maps support in your project - it is the modern multi-platform packaging solution.

So, do you have any guidance?

QMY-ZQ avatar May 28 '24 02:05 QMY-ZQ

This project should support react-native. You likely need to enable export maps support in your project - it is the modern multi-platform packaging solution.

So, do you have any guidance?

https://www.npmjs.com/package/bwip-js Here, You have docs about RN. You'll need also a "react-zlib-js"; lib to make bwip works. Then U'll need use useState with useEffect for fetch code from bwipjs.toDataURL in async/await function then You can use Image from React Native to displey the code. This is big short but maybe it will tell you something

ArturBuja avatar Jul 04 '24 08:07 ArturBuja

Yesterday, new platform specific packages were released, one of which specifically targets react-native. Please try:

npm install @bwip-js/react-native

The import will then be structured as:

import bwipjs from "@bwip-js/react-native";
   // or to allow tree shaking by the bundler
import { qrcode, code128 } from "@bwip-js/react-native";

For the react-native install, the react-zlib-js library is listed as a dependency, so it should install automatically.

If you have any issues with using the platform-specific library, please let me know.

metafloor avatar Jul 04 '24 13:07 metafloor