Authored by 于良

bug fix review by 阿瑟

... ... @@ -22,6 +22,10 @@ export default class SlicedImage extends React.Component {
this.mode = 1;
}
setNativeProps(nativeProps) {
this._root.setNativeProps(nativeProps);
}
_generateImageUrl(src) {
let style = StyleSheet.flatten(this.props.style);
let {width, height} = style;
... ... @@ -36,7 +40,7 @@ export default class SlicedImage extends React.Component {
.replace('{height}', height);
}
// __DEV__ && console.log(newSrc);
__DEV__ && console.log(newSrc);
return newSrc;
}
... ... @@ -55,12 +59,12 @@ export default class SlicedImage extends React.Component {
if (source && source.uri && this._isRemoteImageSrc(source.uri)) {
let uri = this._generateImageUrl(source.uri);
return (
<Image {...this.props} source={{uri}}/>
<Image ref={component => this._root = component} {...this.props} source={{uri}}/>
);
}
return (
<Image {...this.props}/>
<Image ref={component => this._root = component} {...this.props}/>
);
}
}
... ...
... ... @@ -54,13 +54,14 @@ export default class SuperMan extends React.Component {
render() {
let avatarContainerStyle = this.props.uid > 0 ? styles.avatarContainer : null;
let avatarStyle = this.props.uid > 0 ? styles.avatarBorder : null;
let defaultSource = this.props.uid > 0 ? null : require('../../images/home/superman.png');
return (
<View style={[styles.container, this.props.fly]}>
<TouchableOpacity activeOpacity={0.8} onPress={() => {
this.props.onSaveingTheWorld && this.props.onSaveingTheWorld();
}}>
<View style={avatarContainerStyle}>
<SlicedImage style={[styles.avatar, avatarStyle]} source={{uri: this.props.avatar}} resizeMode={'cover'} defaultSource={require('../../images/home/superman.png')}/>
<SlicedImage style={[styles.avatar, avatarStyle]} source={{uri: this.props.avatar}} resizeMode={'cover'} defaultSource={defaultSource}/>
</View>
{this.renderText()}
{this.renderMsgCount()}
... ...
... ... @@ -80,7 +80,6 @@ export default class UploadProgress extends React.Component {
}
return (
<Animated.View style={[styles.container, {opacity: this.state.fadeAnim,}]}>
<Image
style={styles.image}
... ... @@ -99,7 +98,7 @@ export default class UploadProgress extends React.Component {
style={styles.bar}
/>
{this._renderButton(uploadState)}
</Animated.View >
</Animated.View>
);
}
... ...
... ... @@ -3,6 +3,7 @@
import React from 'react';
import ReactNative from 'react-native';
import ImmutablePropTypes from 'react-immutable-proptypes';
import SlicedImage from '../../../common/components/SlicedImage';
const {
View,
... ... @@ -43,7 +44,7 @@ export default class UserCenterTop extends React.Component {
this.props.onPressBackgroundImg && this.props.onPressBackgroundImg();
}}
>
<Image
<SlicedImage
style={styles.backgroundImage}
defaultSource={require('../../images/user-bg.png')}
source={{uri:backgroundImage}}
... ... @@ -53,12 +54,11 @@ export default class UserCenterTop extends React.Component {
this.props.onPressUserAvatar && this.props.onPressUserAvatar();
}}
>
<Image
<SlicedImage
style={styles.avatarImage}
defaultSource={require('../../images/avatar-default.png')}
source={{uri:avatar}}
>
</Image>
/>
</TouchableOpacity>
<Text
style={styles.name}
... ... @@ -71,7 +71,7 @@ export default class UserCenterTop extends React.Component {
>
{sign}
</Text>
</Image>
</SlicedImage>
</TouchableHighlight>
</View>
);
... ...
... ... @@ -55,7 +55,10 @@ export function goAction(inputUrl) {
}
} else if (action == 'go.comm.postdetail') {
let id = params && params.postId ? params.postId : 0;
let id = params && params.postid ? params.postid : 0;
if (id == 0) {
id = params && params.postId ? params.postId : 0;
}
if (id != 0) {
dispatch(goToPost(id));
}
... ...