Skip to content

Commit

Permalink
Fix additional use of globalThis
Browse files Browse the repository at this point in the history
  • Loading branch information
Tom Duncalf committed Jun 24, 2022
1 parent f9650a3 commit 23603c6
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/react-native/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -42,7 +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
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.
Expand Down

0 comments on commit 23603c6

Please sign in to comment.