Skip to content

Commit ed02577

Browse files
committed
temporary enforce the atob polyfill for React Native
1 parent 04f9ae5 commit ed02577

13 files changed

+27
-16
lines changed

Diff for: CHANGELOG.md

+5
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
## 0.21.3
2+
3+
- Enforce temporary the `atob` polyfill for ReactNative until [Expo 51+ and React Native v0.17+ `atob` fix get released](https://github.com/reactwg/react-native-releases/issues/287).
4+
5+
16
## 0.21.2
27

38
- Exported `HealthService` types ([#289](https://github.com/pocketbase/js-sdk/issues/289)).

Diff for: dist/pocketbase.cjs.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: dist/pocketbase.cjs.js.map

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: dist/pocketbase.es.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: dist/pocketbase.es.js.map

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: dist/pocketbase.es.mjs

+1-1
Large diffs are not rendered by default.

Diff for: dist/pocketbase.es.mjs.map

+1-1
Large diffs are not rendered by default.

Diff for: dist/pocketbase.iife.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: dist/pocketbase.iife.js.map

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: dist/pocketbase.umd.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: dist/pocketbase.umd.js.map

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"version": "0.21.2",
2+
"version": "0.21.3",
33
"name": "pocketbase",
44
"description": "PocketBase JavaScript SDK",
55
"author": "Gani Georgiev",

Diff for: src/stores/utils/jwt.ts

+11-5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
1+
// @todo remove after https://github.com/reactwg/react-native-releases/issues/287
2+
const isReactNative = (
3+
(typeof navigator !== 'undefined' && navigator.product === 'ReactNative') ||
4+
(typeof global !== 'undefined' && (global as any).HermesInternal)
5+
);
6+
17
let atobPolyfill: Function;
2-
if (typeof atob === "function") {
8+
if (typeof atob === "function" && !isReactNative) {
39
atobPolyfill = atob;
410
} else {
511
/**
@@ -23,10 +29,10 @@ if (typeof atob === "function") {
2329
(buffer = str.charAt(idx++));
2430
// character found in table? initialize bit storage and add its ascii value;
2531
~buffer &&
26-
((bs = bc % 4 ? (bs as any) * 64 + buffer : buffer),
27-
// and if not first of each 4 characters,
28-
// convert the first 8 bits to one ascii character
29-
bc++ % 4)
32+
((bs = bc % 4 ? (bs as any) * 64 + buffer : buffer),
33+
// and if not first of each 4 characters,
34+
// convert the first 8 bits to one ascii character
35+
bc++ % 4)
3036
? (output += String.fromCharCode(255 & (bs >> ((-2 * bc) & 6))))
3137
: 0
3238
) {

0 commit comments

Comments
 (0)