diff --git a/docs/web/supported-browsers-and-frameworks.mdx b/docs/web/supported-browsers-and-frameworks.mdx index c7d19a2..ee7b982 100644 --- a/docs/web/supported-browsers-and-frameworks.mdx +++ b/docs/web/supported-browsers-and-frameworks.mdx @@ -18,44 +18,3 @@ integrates seamlessly with various module loaders and bundlers such as [esbuild] [Vite](https://vitejs.dev) and [Rollup](https://rollupjs.org). You can find examples for many popular frameworks in the [examples-es](https://github.com/connectrpc/examples-es) repo. - -## React Native - -[React Native](https://reactnative.dev) does not offer great support for the Fetch API and the Text Encoding API. As -such, React Native requires a polyfill for these two implementations. We recommend the following to accomplish this: - -1. Install the polyfills. - -```bash -npm install react-native-fast-encoder react-native-fetch-api web-streams-polyfill -``` - -2. Apply the polyfills in the root of your app. - -```js -import { polyfillGlobal } from "react-native/Libraries/Utilities/PolyfillFunctions" -import TextEncoder from "react-native-fast-encoder" -import { fetch, Headers, Request, Response } from "react-native-fetch-api" -import { ReadableStream } from "web-streams-polyfill" - -polyfillGlobal("ReadableStream", () => ReadableStream) -polyfillGlobal("TextDecoder", () => TextEncoder) -polyfillGlobal("TextEncoder", () => TextEncoder) -polyfillGlobal( - "fetch", () => (...args) => fetch(args[0], { - ...args[1], - // Inject textStreaming: https://github.com/react-native-community/fetch/issues/15 - reactNative: { textStreaming: true } - }), -) -polyfillGlobal("Headers", () => Headers) -polyfillGlobal("Request", () => Request) -polyfillGlobal("Response", () => Response) -``` - -Unfortunately, only unary requests via the [Connect protocol](../protocol.md) are supported in -React Native due to some limitations in React Native's implementation of the Fetch API. For more information, please see -[this issue](https://github.com/connectrpc/connect-es/issues/199) - -For a working example, see the [React Native project](https://github.com/connectrpc/examples-es/tree/main/react-native) -in the [examples-es](https://github.com/connectrpc/examples-es) repo.