From 33cbccce1f7356510a2a08e7d1bf34432aaf5a31 Mon Sep 17 00:00:00 2001 From: Krishna Rajendran Date: Thu, 23 Apr 2020 09:03:46 -0700 Subject: [PATCH] Fix react native window/cookie error --- src/metadata-storage.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/metadata-storage.js b/src/metadata-storage.js index aa61ce5b..7c4d7d1a 100644 --- a/src/metadata-storage.js +++ b/src/metadata-storage.js @@ -17,8 +17,12 @@ class MetadataStorage { this.secure = secure; this.sameSite = sameSite; this.expirationDays = expirationDays; - const writableTopDomain = topDomain(getLocation().href); - this.cookieDomain = domain || (writableTopDomain ? '.' + writableTopDomain : null); + this.cookieDomain =''; + + if (!BUILD_COMPAT_REACT_NATIVE) { + const writableTopDomain = topDomain(getLocation().href); + this.cookieDomain = domain || (writableTopDomain ? '.' + writableTopDomain : null); + } } getCookieStorageKey() {