Skip to content
This repository has been archived by the owner on Aug 24, 2021. It is now read-only.

React Native support is dropped #98

Open
somay opened this issue May 6, 2021 · 3 comments
Open

React Native support is dropped #98

somay opened this issue May 6, 2021 · 3 comments

Comments

@somay
Copy link

somay commented May 6, 2021

Describe the bug
The TextEncoder/TextDecoder reference errors occur on React Native environment because the environment doesn't provide them.
The multibase package drops the RN support at the version 4.0.3 release when it stops depending on the web-encoding library.
These APIs are provided by the web-encoding package on the RN environment from its 1.1.0 version release.

To Reproduce

Steps to reproduce the behavior:

Prerequisite: React Native development environment

  1. npx react-native init MultibaseIssue98App (create a React Native project)
  2. yarn add multibase@4.0.4
  3. use this package (example: somay/MultibaseIssue98App@6bf7e62 )
  4. yarn ios or yarn android (Run the application on mobile devices or emulators)
  5. Get the error message on console: ERROR ReferenceError: Can't find variable: TextDecoder

This repository is the result of the above steps' 1 to 3: https://github.com/somay/MultibaseIssue98App

Expected behavior
Able to use them.

Smartphone (please complete the following information):

  • Android (emulator of Pixel_3a_API_30_x86(AVD) - 11) and iOS applications (emulator of iPhone 12 - iOS 14.5)

Additional context

This PR actually removed web-encoding: #89

I'm grateful if you resume to support React Native even if such universality of this package actually isn't intended by the maintainers.
The web-encoding library intentionally starts to support the React Native platform in order to help RN developers use libraries depending on web-encoding such as multibase and uint8arrays.
I currently works on a domain (the decentralized identity domain) where this kind of support is quite helpful because many libraries providing core functionalities in this area are implemented in Javascript although it's very important to provide users with mobile applications.

@somay
Copy link
Author

somay commented Jul 1, 2021

I've written the "To Reproduce" section.
I'm grateful if you handle this issue!

@vasco-santos
Copy link
Member

@somay I would recommend you to use https://github.com/acostalima/react-native-polyfill-globals

While this is figured out

@somay
Copy link
Author

somay commented Jul 6, 2021

@vasco-santos Thank you for your quick reply!
I currently import the web-encoding package and define the globals explicitly in our code (the almost same solution you mentioned) and able to develop our application.
I hope the RN support will come back though.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants