Created
February 3, 2016 18:58
-
-
Save cpjolicoeur/d497d5364bfc4ae6a872 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 files changed, 15 insertions(+), 7 deletions(-) | |
Components/.#SplashScreen.js | 1 - | |
components/price_list.js | 21 +++++++++++++++------ | |
deleted Components/.#SplashScreen.js | |
@@ -1 +0,0 @@ | |
[email protected] | |
\ No newline at end of file | |
modified components/price_list.js | |
@@ -1,6 +1,7 @@ | |
import React, { | |
Component, | |
ListView, | |
+ Text, | |
} from 'react-native'; | |
import DrugPriceItem from './drug_price_item'; | |
@@ -11,6 +12,7 @@ class PriceList extends Component { | |
let ds = new ListView.DataSource({rowHasChanged: (r1, r2) => r1 !== r2}); | |
this.state = { | |
dataSource: ds, | |
+ pricesLoaded: false, | |
}; | |
} | |
@@ -26,18 +28,25 @@ class PriceList extends Component { | |
.then((responseData) => { | |
this.setState({ | |
dataSource: this.state.dataSource.cloneWithRows(responseData), | |
+ pricesLoaded: true | |
}); | |
}) | |
.done(); | |
} | |
render() { | |
- return ( | |
- <ListView | |
- dataSource={this.state.dataSource} | |
- renderRow={this.renderDrugPrice} | |
- /> | |
- ); | |
+ if (this.state.pricesLoaded) { | |
+ return ( | |
+ <ListView | |
+ dataSource={this.state.dataSource} | |
+ renderRow={this.renderDrugPrice} | |
+ /> | |
+ ); | |
+ } else { | |
+ return ( | |
+ <Text>Loading prices</Text> | |
+ ); | |
+ } | |
} | |
drugUrl() { | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment