Commit 4167f5e0 authored by 陈天文's avatar 陈天文

修复使用immutable fromJson到toJson

parent fabb94e0
......@@ -39,13 +39,10 @@ class Market extends Component {
}, 1000);
}
// <TouchableOpacity onPress={ this.onButtonPress.bind(this) }>
// <Text>获取测试列表数据</Text>
// </TouchableOpacity>
render() {
const { navigate } = this.props.navigation;
const listData = this.props.auction;
console.log('listData', this.props.auction);
const { listData } = this.props.auction;
return (
<View style = {styles.container}>
......@@ -58,11 +55,6 @@ class Market extends Component {
</View>
);
}
onButtonPress() {
this.props.actions.getLongAuctionList();
console.log('auction', this.props.auction);
}
}
const actions = [
......@@ -71,7 +63,7 @@ const actions = [
function mapStateToProps(state) {
return {
...state
auction: state.auction.toJS(),
};
}
......@@ -93,8 +85,8 @@ const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: '#ffffff',
// alignItems: 'center',
// justifyContent: 'center'
alignItems: 'center',
justifyContent: 'center'
},
webviewWrap: {
width: Screen.width,
......
import { Record, fromJS } from 'immutable';
const InitialState = {
const InitialState = fromJS({
listData: []
};
// Record({
// listData: fromJS([])
// });
});
export default InitialState;
......@@ -8,11 +8,11 @@ const { GET_LIST_SUCC } = require('../actionTypes').default;
// alert(error.errorMessage || '网络错误');
// }
export default function auctionReducer(state = initialState, action) {
export default function auctionReducer (state = initialState, action) {
switch (action.type) {
case GET_LIST_SUCC: {
const listData = action.payload;
return state.listData = listData;
const listData = fromJS(action.payload);
return state.setIn(['listData'], listData);
}
}
return state;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment