Open sabaturgay opened 5 months ago
Thank you for investigating this Turgay!
I'm wondering if we could simply rely on the newly added atob and btoa functions in Hermes and RN 0.74.1 and avoid react-native-quick-base64
entirely. That would be much simpler.
Are you using Hermes and potentially able to verify that this works correctly with Clerk?
It works in Hermes and RN 0.74.1. So I think we can disable atob and btoa injection.
Awesome - thanks for checking 🙌
So plan is to remove that injection, and return a helpful error if the app is running in an environment without native atob
such as JavascriptCore or old Hermes.
I'll keep this issue open until that lands.
Description
When integrating
react-native-quick-base64
, specifically importing and settingatob
andbtoa
as global, there appears to be a conflict with@clerk/clerk-expo
which relies on the default base64 encoding utilities. This issue arises because the global injection ofatob
andbtoa
overrides the expected behavior in other libraries which also depend on these utilities.Steps to Reproduce
Install
react-native-quick-base64
and configure it as follows:Error:
Expected Behavior
The libraries should operate without interference in their handling of base64 encoding.
Actual Behavior
The global setting of atob and btoa interferes with @clerk/clerk-expo and potentially other libraries, leading to unexpected behaviors or failures in operations that rely on base64 encoding.
Suggested Solution
It would be beneficial for compatibility if we do not globally inject atob and btoa by default. Instead, allow developers to opt-in to this behavior in their own base code. This approach would prevent the override of native utilities unless explicitly desired by the developer, thereby reducing the risk of conflicts with other packages.