From 78001d2da1e2188c7a9f153558ba61530f6c8e26 Mon Sep 17 00:00:00 2001 From: Tom Duncalf Date: Thu, 16 Jun 2022 15:45:36 +0100 Subject: [PATCH 1/3] Fix additional use of globalThis --- lib/react-native/index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/react-native/index.js b/lib/react-native/index.js index 993a3da4bb..da691f2139 100644 --- a/lib/react-native/index.js +++ b/lib/react-native/index.js @@ -20,6 +20,7 @@ import { Platform, NativeModules } from "react-native"; import utils from "../utils"; import extend from "../extensions"; +import { safeGlobalThis } from "@realm.io/common"; //switch how babel transpiled code creates children objects. //Inheriting from Realm.Object with class syntax does not support using Reflect.construct the way babel transpiles it. @@ -42,8 +43,7 @@ if (Platform.OS === "android") { // TODO: Remove the need to store Realm as a global // @see https://github.com/realm/realm-js/issues/2126 -// eslint-disable-next-line no-restricted-globals -export const Realm = globalThis.Realm; +export const Realm = safeGlobalThis.Realm; // Otherwise, we must be in a "normal" react native situation. // In that case, the Realm type should have been injected by the native code. From af0da656f50cc7536d73773e36e772c13155900d Mon Sep 17 00:00:00 2001 From: Tom Duncalf Date: Mon, 24 Oct 2022 11:22:38 +0100 Subject: [PATCH 2/3] Changelog --- CHANGELOG.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e9dbc06ecb..2313e1689d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,8 +5,7 @@ * All fields of a `Realm.Object` treated as optional by TypeScript when constructing a new class-based model, unless specified in the second type parameter [#5000](https://github.com/realm/realm-js/pull/5000) ### Fixed -* ([#????](https://github.com/realm/realm-js/issues/????), since v?.?.?) -* None +* Fixed an additional use of `globalThis` undefined issue, causing Realm to not load on iOS 11/12. ([#4655](https://github.com/realm/realm-js/pull/4655)) ### Compatibility * React Native >= v0.70.0 From 6a5bd4c8c5393af0a56ca7f34381a87096e25489 Mon Sep 17 00:00:00 2001 From: Tom Duncalf Date: Mon, 24 Oct 2022 14:44:17 +0100 Subject: [PATCH 3/3] Fix realm common import --- lib/react-native/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/react-native/index.js b/lib/react-native/index.js index da691f2139..48ebd8b343 100644 --- a/lib/react-native/index.js +++ b/lib/react-native/index.js @@ -20,7 +20,7 @@ import { Platform, NativeModules } from "react-native"; import utils from "../utils"; import extend from "../extensions"; -import { safeGlobalThis } from "@realm.io/common"; +import { safeGlobalThis } from "@realm/common"; //switch how babel transpiled code creates children objects. //Inheriting from Realm.Object with class syntax does not support using Reflect.construct the way babel transpiles it.