robinpowered / react-native-fetch-polyfill

Exposes options to React Native's XMLHttpRequest that are not accessible by `whatwg-fetch`
72 stars 23 forks source link

Bugfix - Undefined self #3

Closed atticoos closed 7 years ago

atticoos commented 7 years ago

2 fixed an issue where self wasn't declared, and instead used this. As it turns out, when running the compiled build (not in development mode via chrome), that lead to some errors where this wasn't defined.

This ensures the reference works both in development and production modes on React Native by using either this or global, depending on which one exists.

The error can be seen below screen shot 2017-03-20 at 12 17 08 pm

This has been verified to work in both environments, hadn't tested both in #2. Third time's a charm...