Authored by 于良

若干页面问题修复 review by 盖剑秋

... ... @@ -27,7 +27,7 @@ export default class AboutUs extends Component {
<Text style={styles.name}>Yoho!Buy有货</Text>
<View style={styles.version}>
<Text style={styles.versionText}>当前版本:</Text>
<Text style={styles.versionText}>{'v' + DeviceInfo.getBuildNumber()}</Text>
<Text style={styles.versionText}>{'v' + DeviceInfo.getVersion()}</Text>
</View>
<TouchableHighlight underlayColor={'white'} style={[styles.update, {opacity: this.props.showUpdate ? 1 : 0}]}
onPress={this.props.showUpdate ? () => {this.props.updateVersion()} : () => {}}>
... ...
... ... @@ -6,6 +6,7 @@ import ReactNative from 'react-native';
import Immutable, {List} from 'immutable';
import moment from 'moment';
import ImmutablePropTypes from 'react-immutable-proptypes';
import LoadingIndicator from './indicator/LoadingIndicator';
const {
Component,
... ... @@ -78,8 +79,12 @@ export default class Meassage extends Component {
<ListView style={styles.list}
dataSource={this.ds.cloneWithRows(this.props.items.toArray())}
renderRow={this.renderItem}
enableEmptySections={true}
renderSeparator={(sectionID, rowID) => <View key={`${sectionID}-${rowID}`} style={styles.separator}/>}
/>
<LoadingIndicator
isVisible={this.props.isFetching}
/>
</View>
);
... ...
... ... @@ -140,6 +140,8 @@ const styles = StyleSheet.create({
position: 'absolute',
right: 15,
bottom: 33,
width: 60,
paddingLeft: 30,
},
});
... ... @@ -176,7 +178,7 @@ class NavBar extends React.Component {
this.renderTitle = this.renderTitle.bind(this);
}
componentWillMount() {
componentDidMount() {
if (Platform.OS === 'android') {
BackAndroid.addEventListener('hardwareBackPress', this.onBackAndroid);
}
... ... @@ -413,8 +415,13 @@ class NavBar extends React.Component {
const brandName = this.props.getBrandName ? this.props.getBrandName(childState) : '';
return (
<View style={styles.userInfoContainer} >
<Text style={styles.userInfoTitle} onPress={() => {Actions.Logout();}}>{brandName}</Text>
<Image source={require('../images/white.png')} style={styles.whiteArrow}/>
<Text style={styles.userInfoTitle}>{brandName}</Text>
<TouchableOpacity
onPress={() => {Actions.Logout();}}
style={styles.whiteArrow}
>
<Image source={require('../images/white.png')} />
</TouchableOpacity>
</View>
);
... ...
... ... @@ -39,7 +39,7 @@ export default class User extends Component {
);
}
_renderRow(item) {
_renderRow(item, sectionID, rowID) {
let icon = item.icon;
return (
<TouchableHighlight underlayColor={'white'} onPress={() => this.props.onItemPressed(item)}>
... ... @@ -47,7 +47,8 @@ export default class User extends Component {
<Image source={item.icon}/>
<Text style={styles.title}>{item.title}</Text>
<Text>{item.subtitle}</Text>
<Image source={item.arrow} />
{rowID === 1 ? <Image source={item.arrow} /> : null}
</View>
</TouchableHighlight>
);
... ...
... ... @@ -31,7 +31,7 @@ export default class LoadingIndicator extends Component {
overlayHeight: 100,
overlayColor: 'rgba(0,0,0,0.6)',
size: (Platform.OS === 'ios') ? 'large' : 'Normal',
color: (Platform.OS === 'ios') ? 'gray' : 'gray',
color: (Platform.OS === 'ios') ? 'white' : 'gray',
text: '加载中...',
textColor: '#eeeeee',
textFontSize: 14,
... ...
... ... @@ -74,6 +74,7 @@ class MessageContainer extends Component {
<Message
items={this.props.message.messageList}
onPressItem={this.pressRow}
isFetching={this.props.message.isFetching}
/>
</View>
);
... ...
... ... @@ -37,47 +37,47 @@ export default function messageReducer(state = initialState, action) {
if (!(state instanceof InitialState)) return initialState.merge(state);
switch (action.type) {
case MESSAGE_DETAIL:{
// let nextState = state.setIn(['messageDetail', 'title'], action.payload.title)
// .setIn(['messageDetail', 'content'], action.payload.content)
// .setIn(['messageDetail', 'time'], action.payload.createTime)
// .setIn(['messageDetail', 'id'], action.payload.id)
// .setIn(['messageDetail', 'isRead'], action.payload.isRead)
// .setIn();
case MESSAGE_DETAIL: {
let nextState = state.set('messageDetail', action.payload);
return nextState;
}
case REQUEST_MSG_NUM:
case BATCH_SET_MSG_IS_READ:
case REQUEST_MSG_LIST:
{
case REQUEST_MSG_LIST: {
let nextState = state.set('isFetching', true)
.set('error', null);
return nextState;
}
case REQUEST_MSG_NUM_SUCCESS: {
let nextState = state.set('isFetching', false)
.set('error', null)
.set('unreadNum', action.payload);
return nextState;
}
case REQUEST_MSG_LIST_SUCCESS: {
let nextState = state.set('isFetching', false)
.set('error', null)
.set('messageList', Immutable.fromJS(action.payload.list));
return nextState;
}
case BATCH_SET_MSG_IS_READ_SUCCESS: {
case REQUEST_MSG_LIST_FAILURE: {
return state.set('isFetching', false)
.set('error', null);
.set('error', action.payload);
}
case REQUEST_MSG_NUM_SUCCESS: {
let nextState = state.set('unreadNum', action.payload);
return nextState;
}
case BATCH_SET_MSG_IS_READ_SUCCESS: {
// console.log(state);
let nextState = state.setIn(['messageList', state.messageDetail, 'isRead'], true);
// console.log(nextState);
return nextState;
}
case REQUEST_MSG_NUM:
case REQUEST_MSG_NUM_FAILURE:
case BATCH_SET_MSG_IS_READ:
case BATCH_SET_MSG_IS_READ_FAILURE:
case REQUEST_MSG_LIST_FAILURE:
{
return state.set('isFetching', false)
.set('error', action.payload);
}
return state;
case SWITCH_BRAND:
case LOGOUT:
return initialState;
... ...