Skip to content

Commit

Permalink
api: Add network activity indicator. (#327)
Browse files Browse the repository at this point in the history
Add network activity indicator when fetching data.
Fixes #320.
  • Loading branch information
trueskawka authored and borisyankov committed Feb 13, 2017
1 parent 019e51e commit b630bb0
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
3 changes: 3 additions & 0 deletions src/api/apiFetch.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { StatusBar } from 'react-native';
import { Auth } from '../types';
import { getAuthHeader, encodeAsURI } from '../utils/url';
import userAgent from '../utils/userAgent';
Expand All @@ -19,6 +20,7 @@ export const apiFetch = async (
},
...params,
};
StatusBar.setNetworkActivityIndicatorVisible(true);
return fetch(url, allParams);
};

Expand Down Expand Up @@ -63,6 +65,7 @@ export const apiCall = async (
return resFunc(json);
} finally {
clearTimeout(timeout);
StatusBar.setNetworkActivityIndicatorVisible(false);
}
};

Expand Down
1 change: 0 additions & 1 deletion src/common/LoadingIndicator.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import React from 'react';
import { Animated, Easing, Image, StyleSheet, View } from 'react-native';
import { BRAND_COLOR } from '../common/styles';

const styles = StyleSheet.create({
row: {
Expand Down

0 comments on commit b630bb0

Please sign in to comment.