On the React Native, window global is exist but there is no location and hostname properties on that global, so typeof window !== 'undefined' checking is not working in React Native, and headers['X-Frappe-Site-Name'] = window.location.hostname; line throws error.
So I added another check as typeof document !== 'undefined' that understand better if it is browser or React Native environment
On the React Native,
window
global is exist but there is nolocation
andhostname
properties on that global, sotypeof window !== 'undefined'
checking is not working in React Native, andheaders['X-Frappe-Site-Name'] = window.location.hostname;
line throws error.So I added another check as
typeof document !== 'undefined'
that understand better if it is browser or React Native environment