A fetch API polyfill for React Native built on top of the native Networking API instead of XMLHttpRequest, enabling text streaming support. Current stable version is 3.0.0 (2022-12-01). This package is maintained by the React Native community and released on an as-needed basis. Key differentiators: supports streaming text via ReadableStream (Response.body) for performance, avoids XHR overhead. Limited to text-only streaming; binary transfers do not support incremental reading. For apps requiring text streaming in React Native.
npm install react-native-fetch-apiVerified import paths — ran on the pinned version, not inferred.
Demonstrates using the fetch API with text streaming: importing default fetch and named constructors, making a GET request, and reading the response body as a stream.
Remove any await on Response construction: const response = new Response(body, init); (not await new Response(...))
Install and import 'abort-controller' polyfill (e.g., from npm) and use AbortController from there.
Use responseType: 'text' (default) for streaming. For binary, use blob or base64 – note that streaming is not supported.
Use new Response(body, { status, statusText, headers }) instead of new Response(body, status, statusText, headers)Use a different method for non-HTTP URLs (e.g., react-native-fs for local files)
Install abort-controller: npm install abort-controller, then import AbortController from 'abort-controller'.
Use import { Response } from 'react-native-fetch-api' instead of import Response from ...Construct Response with an init object: new Response(body, { status: 200 })Ensure URLs start with http:// or https://. For Android, check AndroidManifest.xml for INTERNET permission.
No dependency data recorded yet.