make renderError and renderLoading props optional for WebView

Summary:
@vjeux Making the renderError and renderLoading props optional for WebView by setting the default to be what's shown for the WebView example in UIExplorer. issue #349
Closes https://github.com/facebook/react-native/pull/512
Github Author: Don Yu <donyu8@gmail.com>

Test Plan: Imported from GitHub, without a `Test Plan:` line.
This commit is contained in:
Don Yu
2015-03-31 18:46:14 -07:00
parent 0ca3136371
commit 414d975370
2 changed files with 57 additions and 59 deletions

View File

@@ -18,7 +18,6 @@
var React = require('react-native');
var StyleSheet = require('StyleSheet');
var {
ActivityIndicatorIOS,
StyleSheet,
Text,
TextInput,
@@ -95,8 +94,6 @@ var WebViewExample = React.createClass({
automaticallyAdjustContentInsets={false}
style={styles.webView}
url={this.state.url}
renderError={this.renderError}
renderLoading={this.renderLoading}
onNavigationStateChange={this.onNavigationStateChange}
startInLoadingState={true}
/>
@@ -129,33 +126,6 @@ var WebViewExample = React.createClass({
});
},
renderError: function(errorDomain, errorCode, errorDesc) {
return (
<View style={styles.errorContainer}>
<Text style={styles.errorTextTitle}>
Error loading page
</Text>
<Text style={styles.errorText}>
{'Domain: ' + errorDomain}
</Text>
<Text style={styles.errorText}>
{'Error Code: ' + errorCode}
</Text>
<Text style={styles.errorText}>
{'Description: ' + errorDesc}
</Text>
</View>
);
},
renderLoading: function() {
return (
<View style={styles.loadingView}>
<ActivityIndicatorIOS />
</View>
);
},
onSubmitEditing: function(event) {
this.pressGoButton();
},
@@ -230,28 +200,6 @@ var styles = StyleSheet.create({
borderRadius: 3,
alignSelf: 'stretch',
},
loadingView: {
backgroundColor: BGWASH,
flex: 1,
justifyContent: 'center',
alignItems: 'center',
},
errorContainer: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
backgroundColor: BGWASH,
},
errorTextTitle: {
fontSize: 15,
fontWeight: '500',
marginBottom: 10,
},
errorText: {
fontSize: 14,
textAlign: 'center',
marginBottom: 2,
},
statusBar: {
flexDirection: 'row',
alignItems: 'center',