A polyfill for React Native's fetch that adds timeout support. Currently at version 1.1.3 (stable, low release cadence). It patches the default fetch implementation from whatwg-fetch to expose the native XMLHttpRequest timeout property, which is otherwise inaccessible. Unlike alternatives like react-native-fetch-api or custom wrappers, this polyfill directly modifies the global fetch, providing seamless integration. Requires react-native >=0.27.
npm install react-native-fetch-polyfillNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Demonstrates importing the polyfill and using the timeout option in a fetch request with error handling for timeouts.
Import the polyfill and assign it: import fetch from 'react-native-fetch-polyfill'; then use fetch(...) instead of global fetch.
If using Expo managed, consider using the AbortController polyfill or a custom timeout implementation.
Upgrade to react-native-fetch-api or use the AbortController polyfill (available in React Native 0.50+).
Test after RN upgrades; check for compatibility issues.
Handle the error by checking for a timeout: if (error.message === 'Network request failed') { /* timeout logic */ }Pass timeout as part of the second argument (options): fetch(url, { timeout: 10000 })