Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/plenty-comics-matter.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@clerk/clerk-expo': patch
---

Use a polyfill for the `atob` function to prevent errors when using the Hermes JS engine, since the engine's `atob` implementation is stricter than it should be.
9 changes: 7 additions & 2 deletions packages/expo/src/polyfills/base64Polyfill.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
import { decode, encode } from 'base-64';

if (!global.btoa) {
//@ts-expect-error HermesInternal is added by the Hermes JS Engine
const isHermes = !!global.HermesInternal;

// See Default Expo 51 engine Hermes' issue: https://github.com/facebook/hermes/issues/1379
if (!global.btoa || isHermes) {
global.btoa = encode;
Comment thread
anagstef marked this conversation as resolved.
}

if (!global.atob) {
// See Default Expo 51 engine Hermes' issue: https://github.com/facebook/hermes/issues/1379
if (!global.atob || isHermes) {
global.atob = decode;
}