Skip to content

Commit fccbbb5

Browse files
committed
Now showing gather data message
Search View now shows appropriate loading message for gathering current weather data and 10 day forecast data
1 parent c26eec8 commit fccbbb5

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

ios/WeatherApp/App/Views/SearchView.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ var SearchView = React.createClass({
6060
})).done();
6161
},
6262
handleResponseForForecast: function(forecastData, currentWeatherData) {
63-
this.setState({isLoading: false});
63+
this.setState({isLoading: false, message: ''});
6464
//once response from both API's come, navigate to TodayView
6565
this.props.navigator.push({
6666
title: "Current",
@@ -106,13 +106,14 @@ var SearchView = React.createClass({
106106
//this.props.navigator.pop()
107107
handleResponseForCurrentWeather: function(currentWeatherData) {
108108
//make API call for 10 day Forecast
109+
this.setState({message: 'Gathering 10 day forecast data'});
109110
this.fetchApiDataForForecast(this.prepareAPIUrlForForecast(), currentWeatherData);
110111
},
111112
handleTextInputChange: function(event) {
112113
this.setState({searchString: event.nativeEvent.text});
113114
},
114-
handleButtonPressed: function() {
115-
this.setState({isLoading: true, message: ''});
115+
handleSearchButtonPressed: function() {
116+
this.setState({isLoading: true, message: 'Gathering current weather data'});
116117
this.fetchApiDataForCurrentWeather(this.prepareAPIUrlForCurrentWeather());
117118
},
118119
render: function() {
@@ -131,7 +132,7 @@ var SearchView = React.createClass({
131132
value={this.state.searchString}
132133
onChange={this.handleTextInputChange}></TextInput>
133134

134-
<TouchableHighlight style={styles.button} underlayColor="#5CBC85" onPress={this.handleButtonPressed}>
135+
<TouchableHighlight style={styles.button} underlayColor="#5CBC85" onPress={this.handleSearchButtonPressed}>
135136
<Text style={styles.buttonText}>Get Weather</Text>
136137
</TouchableHighlight>
137138
{spinner}

0 commit comments

Comments
 (0)