diff --git a/MainScreen.js b/MainScreen.js index bd63f8d..1cea919 100644 --- a/MainScreen.js +++ b/MainScreen.js @@ -20,9 +20,11 @@ var { TabBarIOS, ActivityIndicatorIOS, StatusBarIOS, + Dimensions, } = React; +var deviceWidth = Dimensions.get('window').width; class MainScreen extends Component { @@ -127,17 +129,39 @@ class MainScreen extends Component { } renderSectionHeader(sectionData,sectionID){ //sectionID = 20140101 - var dateStr = [sectionID.slice(0,4),'-',sectionID.slice(4,6),'-',sectionID.slice(6)].join(''); + var dateStr = [sectionID.slice(0,4),'-',sectionID.slice(4,6),'-',sectionID.slice(6)].join(''); var dateObj = new Date(dateStr); var month = dateObj.getUTCMonth() + 1; var day = dateObj.getUTCDate(); var days = ['星期天','星期一','星期二','星期三','星期四','星期五','星期六']; + + //今日热闻 + var sectionStyle, + text; + if(dateObj.toDateString()=== new Date().toDateString()){ + sectionStyle = styles.currentSection; + text = '今日要闻'; + } else { + sectionStyle = styles.section; + text = month+'月'+day+'日 '+ days[dateObj.getDay()]; + } return ( - - {month+'月'+day+'日 '+ days[dateObj.getDay()]} + + {text} ); } + _renderHeader(){ + //listview添加header + var slider = this.state.sliderDataSource? + ( + + ) + :(); + + return slider; + + } renderFooter(){ return ( @@ -151,15 +175,26 @@ class MainScreen extends Component { //console.log(this.state.currentDay); this._fetchData(this.state.currentDay); + } + _onScroll(e){ + console.log(e.nativeEvent.contentOffset); + var {x,y} = e.nativeEvent.contentOffset; + // var headerStyle = styles.currentSection; + // console.log(headerStyle); + return{ + opacity: 1-y/200 + }; + + } render() { var spinner =