react-native-community / fetch

A fetch API polyfill for React Native with text streaming support.
MIT License
70 stars 10 forks source link

[Android] Streaming broken in development builds on Expo SDK50 due to ReactNativeFlipper #23

Open Vali-98 opened 5 months ago

Vali-98 commented 5 months ago

As previously pointed out in https://github.com/react-native-community/fetch/issues/13#issuecomment-1703097655 , ReactNativeFlipper breaks streaming completely.

With Expo SDK50, the nature of these files have changed:

React Native 0.73 changed from Java to Kotlin for Android Main* classes: MainApplication.java/MainActivity.java are now MainApplication.kt/MainActivity.kt. If you depend on any config plugins that use dangerous modifications to change these files, they may need to be updated for SDK 50 support.

In android/app/src/main/java/com/[name]/[app]/MainApplication.kt, here is the ReactNativeFlipper initialization:

if (BuildConfig.DEBUG) {
    ReactNativeFlipper.initializeFlipper(this, reactNativeHost.reactInstanceManager)
}

Simply comment it out and streaming will work once more.

if (BuildConfig.DEBUG) {
    // hacky fix for: https://github.com/react-native-community/fetch
    // ReactNativeFlipper.initializeFlipper(this, reactNativeHost.reactInstanceManager)
}

Though the issue is fixed on my end, I am leaving this here for the few people who come across this problem.

Haseebshah936 commented 4 months ago

@Vali-98 Hi, I am trying to implement streaming if you can share your implementation that would be great. As there is no minimal example for expo.