Skip to content

Commit 5280968

Browse files
Luna Weifacebook-github-bot
authored andcommitted
Remove ProgressBar from examples and fix XHRDownloadExample
Summary: Changelog: [Internal] - Remove usage of ProgressViewIOS and ProgressBarAndroid from RNTester Note: Android example doesn't properly update progress. Filing an issue here: TODO Reviewed By: yungsters Differential Revision: D31328094 fbshipit-source-id: 5afa3bb1079b91bb98fa51587e96402fb1565f82
1 parent 046b026 commit 5280968

File tree

1 file changed

+5
-22
lines changed

1 file changed

+5
-22
lines changed

packages/rn-tester/js/examples/XHR/XHRExampleDownload.js

Lines changed: 5 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,6 @@ const React = require('react');
1414

1515
const {
1616
Alert,
17-
Platform,
18-
ProgressBarAndroid,
19-
ProgressViewIOS,
2017
StyleSheet,
2118
Switch,
2219
Text,
@@ -31,21 +28,6 @@ function roundKilo(value: number): number {
3128
return Math.round(value / 1000);
3229
}
3330

34-
class ProgressBar extends React.Component<$FlowFixMeProps> {
35-
render() {
36-
if (Platform.OS === 'android') {
37-
return (
38-
<ProgressBarAndroid
39-
progress={this.props.progress}
40-
styleAttr="Horizontal"
41-
indeterminate={false}
42-
/>
43-
);
44-
}
45-
return <ProgressViewIOS progress={this.props.progress} />;
46-
}
47-
}
48-
4931
class XHRExampleDownload extends React.Component<{...}, Object> {
5032
state: Object = {
5133
downloading: false,
@@ -126,7 +108,10 @@ class XHRExampleDownload extends React.Component<{...}, Object> {
126108
Alert.alert('Error', xhr.responseText);
127109
}
128110
};
129-
xhr.open('GET', 'http://aleph.gutenberg.org/cache/epub/100/pg100.txt.utf8');
111+
xhr.open(
112+
'GET',
113+
'http://aleph.gutenberg.org/cache/epub/100/pg100-images.html.utf8',
114+
);
130115
// Avoid gzip so we can actually show progress
131116
xhr.setRequestHeader('Accept-Encoding', '');
132117
xhr.send();
@@ -149,7 +134,7 @@ class XHRExampleDownload extends React.Component<{...}, Object> {
149134
) : (
150135
<TouchableHighlight style={styles.wrapper} onPress={this._download}>
151136
<View style={styles.button}>
152-
<Text>Download 5MB Text File</Text>
137+
<Text>Download 7MB Text File</Text>
153138
</View>
154139
</TouchableHighlight>
155140
);
@@ -164,7 +149,6 @@ class XHRExampleDownload extends React.Component<{...}, Object> {
164149
responseText: {roundKilo(responseLength)}/{roundKilo(contentLength)}
165150
k chars
166151
</Text>
167-
<ProgressBar progress={responseLength / contentLength} />
168152
</View>
169153
);
170154
}
@@ -176,7 +160,6 @@ class XHRExampleDownload extends React.Component<{...}, Object> {
176160
onprogress: {roundKilo(progressLoaded)}/{roundKilo(progressTotal)}{' '}
177161
KB
178162
</Text>
179-
<ProgressBar progress={progressLoaded / progressTotal} />
180163
</View>
181164
);
182165
}

0 commit comments

Comments
 (0)