1- import React , {
1+ import React , {
22 Component ,
33 View ,
44 Dimensions ,
@@ -18,10 +18,10 @@ import Spinner from '../components/base/Spinner';
1818import Return from '../components/base/Return' ;
1919import Setting from '../components/Setting' ;
2020import 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
2727class 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
255256export const LayoutComponent = User ;
256257export 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