Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement polyfill for globalThis (v11) #4655

Closed
wants to merge 3 commits into from
Closed
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
3 changes: 1 addition & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
* <How to hit and notice issue? what was the impact?> ([#????](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
Expand Down
4 changes: 2 additions & 2 deletions 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/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,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.
Expand Down