个人中心bug fix review by 盖剑秋
Showing
3 changed files
with
19 additions
and
21 deletions
@@ -302,7 +302,10 @@ const ScrollableTabView = React.createClass({ | @@ -302,7 +302,10 @@ const ScrollableTabView = React.createClass({ | ||
302 | }; | 302 | }; |
303 | } | 303 | } |
304 | 304 | ||
305 | - let heightStyle = this.state.currentPageContentHeight ? {height: this.state.currentPageContentHeight} : null; | 305 | + let heightStyle = null; |
306 | + if (this.state.currentPageContentHeight) { | ||
307 | + heightStyle = {height: this.state.currentPageContentHeight}; | ||
308 | + } | ||
306 | 309 | ||
307 | return <View style={[styles.container, heightStyle, this.props.style, ]} onLayout={this._handleLayout}> | 310 | return <View style={[styles.container, heightStyle, this.props.style, ]} onLayout={this._handleLayout}> |
308 | {this.props.tabBarPosition === 'top' && this.renderTabBar(tabBarProps)} | 311 | {this.props.tabBarPosition === 'top' && this.renderTabBar(tabBarProps)} |
@@ -272,7 +272,7 @@ export default class User extends React.Component { | @@ -272,7 +272,7 @@ export default class User extends React.Component { | ||
272 | <SectionTabBar | 272 | <SectionTabBar |
273 | style={{borderBottomWidth: 0.5, borderBottomColor: '#e0e0e0',}} | 273 | style={{borderBottomWidth: 0.5, borderBottomColor: '#e0e0e0',}} |
274 | tabs={this.tabs} | 274 | tabs={this.tabs} |
275 | - activeTab={this.state.currentPage} | 275 | + activeTab={this.currentPage} |
276 | scrollValue={this.state.scrollValueH} | 276 | scrollValue={this.state.scrollValueH} |
277 | goToPage={(page) => this._goToPage(page)} | 277 | goToPage={(page) => this._goToPage(page)} |
278 | /> | 278 | /> |
@@ -321,30 +321,12 @@ export default class User extends React.Component { | @@ -321,30 +321,12 @@ export default class User extends React.Component { | ||
321 | } | 321 | } |
322 | 322 | ||
323 | render() { | 323 | render() { |
324 | - let {userInfo, list, endReached, isRefreshing, isLoadingMore, isFetching} = this.props; | 324 | + let {userInfo, list, endReached, isRefreshing, isLoadingMore, isFetching, endReachedText} = this.props; |
325 | let dataSource = { | 325 | let dataSource = { |
326 | userInfo: userInfo.toArray(), | 326 | userInfo: userInfo.toArray(), |
327 | list: list.toArray(), | 327 | list: list.toArray(), |
328 | }; | 328 | }; |
329 | 329 | ||
330 | - let endReachedText = '暂无更多'; | ||
331 | - if (this.currentPage == 0) { | ||
332 | - let items = list.get(0).get('posts'); | ||
333 | - if (items.size == 0) { | ||
334 | - endReachedText = '你还没有发布的帖子'; | ||
335 | - } | ||
336 | - } else if (this.currentPage == 1) { | ||
337 | - let items = list.get(0).get('like'); | ||
338 | - if (items.size == 0) { | ||
339 | - endReachedText = '你还没有赞过的帖子'; | ||
340 | - } | ||
341 | - } else if (this.currentPage == 2) { | ||
342 | - let items = list.get(0).get('reply'); | ||
343 | - if (items.size == 0) { | ||
344 | - endReachedText = '你还没有回复过的帖子'; | ||
345 | - } | ||
346 | - } | ||
347 | - | ||
348 | return ( | 330 | return ( |
349 | <View style={styles.container}> | 331 | <View style={styles.container}> |
350 | <ListView | 332 | <ListView |
@@ -241,19 +241,29 @@ class UserContainer extends React.Component { | @@ -241,19 +241,29 @@ class UserContainer extends React.Component { | ||
241 | let isRefreshing = ptr; | 241 | let isRefreshing = ptr; |
242 | let userInfo = Immutable.fromJS([profile]); | 242 | let userInfo = Immutable.fromJS([profile]); |
243 | let isLoadingMore, endReached; | 243 | let isLoadingMore, endReached; |
244 | + let endReachedText = '暂无更多'; | ||
244 | 245 | ||
245 | if (activeTab === 0) { | 246 | if (activeTab === 0) { |
246 | isLoadingMore = !ptr && postsData.isFetching; | 247 | isLoadingMore = !ptr && postsData.isFetching; |
247 | isFetching = postsData.isFetching; | 248 | isFetching = postsData.isFetching; |
248 | endReached = postsData.endReached; | 249 | endReached = postsData.endReached; |
250 | + if (postsData.list.size == 0) { | ||
251 | + endReachedText = '你还没有发布的帖子'; | ||
252 | + } | ||
249 | } else if (activeTab === 1) { | 253 | } else if (activeTab === 1) { |
250 | isLoadingMore = !ptr && likeData.isFetching; | 254 | isLoadingMore = !ptr && likeData.isFetching; |
251 | isFetching = likeData.isFetching; | 255 | isFetching = likeData.isFetching; |
252 | endReached = likeData.endReached; | 256 | endReached = likeData.endReached; |
257 | + if (likeData.list.size == 0) { | ||
258 | + endReachedText = '你还没有赞过的帖子'; | ||
259 | + } | ||
253 | } else if (activeTab === 2) { | 260 | } else if (activeTab === 2) { |
254 | isLoadingMore = !ptr && replyData.isFetching; | 261 | isLoadingMore = !ptr && replyData.isFetching; |
255 | isFetching = replyData.isFetching; | 262 | isFetching = replyData.isFetching; |
256 | endReached = replyData.endReached; | 263 | endReached = replyData.endReached; |
264 | + if (replyData.list.size == 0) { | ||
265 | + endReachedText = '你还没有回复过的帖子'; | ||
266 | + } | ||
257 | } | 267 | } |
258 | 268 | ||
259 | return ( | 269 | return ( |
@@ -278,7 +288,10 @@ class UserContainer extends React.Component { | @@ -278,7 +288,10 @@ class UserContainer extends React.Component { | ||
278 | isRefreshing={isRefreshing} | 288 | isRefreshing={isRefreshing} |
279 | isLoadingMore={isLoadingMore} | 289 | isLoadingMore={isLoadingMore} |
280 | onEndReached={this._onEndReached} | 290 | onEndReached={this._onEndReached} |
291 | + onChangeTab={this._onChangeTab} | ||
281 | rightButtonClick={this._rightButtonClick} | 292 | rightButtonClick={this._rightButtonClick} |
293 | + endReachedText={endReachedText} | ||
294 | + activeTab={activeTab} | ||
282 | /> | 295 | /> |
283 | </View> | 296 | </View> |
284 | ); | 297 | ); |
-
Please register or login to post a comment