joltup / rn-fetch-blob

A project committed to making file access and data transfer easier, efficient for React Native developers.
MIT License
2.81k stars 773 forks source link

iOS: Disable changing Network Activity Indicator by Native Code #494

Open skizzo opened 4 years ago

skizzo commented 4 years ago

Hi, when using this package (v0.11.2) on iOS, I noticed that on every finished download, the code

dispatch_async(dispatch_get_main_queue(), ^{
  [[UIApplication sharedApplication] setNetworkActivityIndicatorVisible:NO];
});

is called in RNFetchBlobRequest.m.

This leads to undesired behaviour when wanting to manage the network activity indicator via the React Native StatusBar, since rn-fetch-blob constantly manually overrides the value (that should be exclusively taken from the StatusBar component) via the native code mentioned above.

Could this be somehow avoided? Please don't suggest using a timer and manually setting (/overriding) the indicator' visibility with setNetworkActivityIndicatorVisible() , it's a hacky non-solution.

cristianocca commented 4 years ago

I don't think the library should be messing with the activity indicator at all unless told to. Also looking for this.

cristianoccazinsp commented 4 years ago

I've added a check here to not disable it if it was not enabled to begin with (there's a prop on the request config to enable it). This PR contains other changes, but I've added that as well since it was affecting me: https://github.com/joltup/rn-fetch-blob/pull/497