Open alessbell opened 1 year ago
This seems to be unrelated to the issue where the community fetch polyfill doesn't work on Android, but made debugging more difficult so I'll leave this issue open.
Hi @alessbell Thanks for flagging this,
This seems to be unrelated to the issue where the community fetch polyfill doesn't work on Android, but made debugging more difficult so I'll leave this issue open.
What was the issue afterall? I can see that for Android we actually export an object: https://github.com/facebook/react-native/blob/5a926c5c4e2f61e2718e882bc7cc11ef8e9c1d14/packages/react-native/Libraries/Network/RCTNetworking.android.js#L43-L95
So I'm unsure why you noticed what you were reporting.
Hi @cortinico, thanks for your reply.
What was the issue afterall?
The original issue was https://github.com/react-native-community/fetch/issues/13: the community fetch polyfill that enables text streaming wasn't working on Android during local dev. It looks like some have found workarounds (see comment about disabling NetworkFlipperPlugin
), but I am still blocked there (I'm not using Flipper 🙂).
I also saw that RCTNetworking.android.js
exports an object, so I'm not sure what the possible cause could be, but you should be able to observe what I'm describing if you run the reproduction I included.
This issue is stale because it has been open 180 days with no activity. Remove stale label or comment or this will be closed in 7 days.
Description
Hi all 👋
I work on Apollo Client, and with
@defer
support coming to GraphQL, I've been investigating the state of text streaming in React Native so our community can use features that rely on it in their RN apps. I found https://github.com/facebook/react-native/issues/27741 which brought me to the polyfill, https://www.npmjs.com/package/react-native-fetch-api.There's an open bug about the polyfill not working on Android which I can reproduce: https://github.com/react-native-community/fetch/issues/13
When I looked into it, I was puzzled by what I found: when I run the same program on iOS, the polyfill uses native APIs to make the fetch by doing
import { Networking } from 'react-native';
. ThatNetworking
module exports an interface that includes thesendRequest
method, which is how the request is fired by the polyfill.When I run it on Android, the
Networking
module has no exported methods at all. I also triedimport AndroidNetworking from "react-native/Libraries/Network/RCTNetworking.android.js";
and again found an empty object.Since others using the polyfill are experiencing the same thing, it seems like it's not a local configuration issue I may be having. Happy to provide any additional info, thanks!
React Native Version
0.72.4
Output of
npx react-native info
Steps to reproduce
See README.md in https://github.com/alessbell/RNMultipartSubsDemo
Snack, screenshot, or link to a repository
https://github.com/alessbell/RNMultipartSubsDemo