Skip to content

Commit fdacf08

Browse files
author
soliury
committed
user loading bugs
1 parent 0618dd4 commit fdacf08

3 files changed

Lines changed: 20 additions & 18 deletions

File tree

src/components/MessageList.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,7 @@ class MessageList extends Component {
147147
if (this.props.didFocus) {
148148
return (
149149
<ListView
150+
enableEmptySections
150151
showsVerticalScrollIndicator={true}
151152
initialListSize={10}
152153
pagingEnabled={false}

src/layouts/TopicList.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,13 +128,13 @@ class TopicList extends Component {
128128
<ListView
129129
showsVerticalScrollIndicator
130130
removeClippedSubviews
131+
enableEmptySections
131132
ref={view => {this._listView = view}}
132133
initialListSize={10}
133134
pagingEnabled={false}
134135
scrollRenderAheadDistance={90}
135136
dataSource={this.state.ds}
136137
renderRow={this.renderRow.bind(this)}
137-
enableEmptySections={true}
138138
onEndReachedThreshold={30}
139139
onEndReached={()=>{
140140
actions.getTopicsByTab(tab, {

src/layouts/User.js

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React,{
1+
import React, {
22
Component,
33
View,
44
Dimensions,
@@ -18,10 +18,10 @@ import Spinner from '../components/base/Spinner';
1818
import Return from '../components/base/Return';
1919
import Setting from '../components/Setting';
2020
import ErrorHandle from '../components/base/ErrorHandle';
21-
import { parseImgUrl, link, genColor } from '../utils';
21+
import {parseImgUrl, link, genColor} from '../utils';
2222

2323

24-
const { height, width } = Dimensions.get('window');
24+
const {height, width} = Dimensions.get('window');
2525

2626

2727
class User extends Component {
@@ -49,15 +49,8 @@ class User extends Component {
4949
}
5050

5151

52-
componentWillReceiveProps(nextProps) {
53-
//if (!this.isClientUser && !nextProps.otherUser) {
54-
// this.props.router.pop();
55-
//}
56-
}
57-
58-
5952
_getUserInfo() {
60-
const { actions, user, userName } = this.props;
53+
const {actions, user, userName} = this.props;
6154
if (this.isClientUser) {
6255
actions.updateClientUserInfo(user);
6356
}
@@ -74,11 +67,13 @@ class User extends Component {
7467

7568

7669
render() {
77-
const { userInfo, ui } = this.props;
70+
const {userInfo, ui} = this.props;
7871
const spinnerView = (
79-
<Spinner
80-
size="large"
81-
style={styles.loading}/>
72+
<View style={styles.loadingWrapper}>
73+
<Spinner
74+
size="large"
75+
style={styles.loading}/>
76+
</View>
8277
);
8378

8479

@@ -204,7 +199,13 @@ const styles = StyleSheet.create({
204199
},
205200
loading: {
206201
flex: 1,
207-
width: width
202+
width: 50
203+
},
204+
loadingWrapper: {
205+
flex: 1,
206+
flexDirection: 'row',
207+
alignItems: 'center',
208+
justifyContent: 'center'
208209
},
209210
bgWall: {
210211
height: bgWallHeight,
@@ -254,7 +255,7 @@ const styles = StyleSheet.create({
254255

255256
export const LayoutComponent = User;
256257
export function mapStateToProps(state, props) {
257-
const { userName } = props;
258+
const {userName} = props;
258259
let userInfo = state.user.publicInfo || null;
259260
const isClientUser = userInfo && userInfo.loginname === userName;
260261
return {

0 commit comments

Comments
 (0)