Authored by 张丽霞

modify toast, review by redding

... ... @@ -23,7 +23,7 @@ export default class ProductListView extends Component {
rowHasChanged: (r1, r2) => r1.key != r2.key,
});
this._renderSeparator = this._renderSeparator.bind(this);
this.tipMessage = '';
this.state = {
selectedIndex: 0,
};
... ... @@ -82,11 +82,14 @@ export default class ProductListView extends Component {
}
</View>
<TouchableOpacity onPress={() => {
if (this.tipMessage == '') {
if (rowData.wait) {
this.props.onPressRemindBtn && this.props.onPressRemindBtn(rowData);
}else {
this.props.onPressProductItem && this.props.onPressProductItem(rowData);
}
}
}}>
{
(tipState=='取消提醒')?
... ... @@ -118,7 +121,9 @@ export default class ProductListView extends Component {
render() {
let {
resource,
tipMessage,
} = this.props;
this.tipMessage = tipMessage;
let backgroundWidth = width;
let backgroundHeight = 64 + 20 + resource.length * rowHeight;
... ...
... ... @@ -18,7 +18,7 @@ import Immutable, {Map} from 'immutable';
import ProductListView from './ProductListView';
import TimeListView from './TimeListView';
import LoadingIndicator from '../../../common/components/LoadingIndicator';
import Toast from 'react-native-smart-toast'
import Toast from 'react-native-root-toast'
export default class Seckill extends Component {
constructor(props) {
... ... @@ -31,6 +31,7 @@ export default class Seckill extends Component {
sectionHeaderHasChanged: (s1, s2) => !Immutable.is(s1, s2),
});
this.isFetching = false;
this.tipMessage = '';
this.queryActivityInfo = Immutable.fromJS({});
}
... ... @@ -52,29 +53,29 @@ export default class Seckill extends Component {
componentWillReceiveProps(nextProps) {
if (nextProps.tipMessage && nextProps.tipMessage !== '') {
this._showToast && this._showToast(nextProps.tipMessage);
console.log(nextProps.tipMessage);
}
}
_showToast(message){
this._toast && this._toast.show({
position: Toast.constants.gravity.center,
duration: 255,
children: message,
animationEnd : () => {
this._toast._toastAnimationToggle = setTimeout(
() => {
this._toast.hide({
duration: 0,
animationEnd: () => {
this.props.onClearTipMessage && this.props.onClearTipMessage();
_showToast = (message) => {
if (this.toast) {
return;
}
})
},
1000
);
this.toast = Toast.show(message, {
duration: 3000,
position: height / 2 - 60,
shadow: false,
animation: true,
hideOnPress: true,
onHidden: () => {
if (this.toast) {
this.toast.destroy();
this.toast = null;
}
})
this.props.onClearTipMessage && this.props.onClearTipMessage();
}
});
};
renderSectionHeader(sectionData, sectionID) {
if (this.queryActivityInfo && this.queryActivityInfo.secKillProductVoList && this.queryActivityInfo.secKillProductVoList.size > 0) {
... ... @@ -112,6 +113,7 @@ export default class Seckill extends Component {
resource={rowData}
onPressProductItem={this.props.onPressProductItem}
onPressRemindBtn={this.props.onPressRemindBtn}
tipMessage={this.tipMessage}
/>
);
}
... ... @@ -133,6 +135,7 @@ export default class Seckill extends Component {
} = this.props;
this.isFetching = isFetching;
this.queryActivityInfo = queryActivityInfo;
this.tipMessage = tipMessage;
diff = localServerTimeDiff;
let dataSource = {
ActivityProductList: [queryProductList ? queryProductList : []],
... ... @@ -207,11 +210,6 @@ export default class Seckill extends Component {
isVisible={isFetching && !ptr}
/>
<Toast
ref={ component => this._toast = component }
marginTop={64}>
</Toast>
</View>
);
}
... ...
... ... @@ -118,15 +118,13 @@ export default class SeckillTimeListView extends Component {
this.timer && clearInterval(this.timer);
}
// componentWillReceiveProps(nextProps) {
// this.curFocusActivity = nextProps.curActivity;
// if (this.curFocusActivity) {
// this._scrollToFocusActivity();
// }
// this._caculateTimerState();
// console.log('componentWillReceiveProps');
//
// }
componentWillReceiveProps(nextProps) {
this.curFocusActivity = nextProps.curActivity;
if (this.curFocusActivity) {
this._scrollToFocusActivity();
}
this._caculateTimerState();
}
_renderRow(rowData, sectionID, rowID) {
rowData = rowData.toJS();
... ...
... ... @@ -94,9 +94,6 @@ export default function seckillReducer(state=initialState, action) {
case SHOW_TIP_MESSAGE: {
return state.set('tipMessage', Immutable.fromJS(action.payload));
}
case CLEAR_TIP_MESSAGE: {
return state.set('tipMessage', '');
}
case UPDATE_SECKILL_PRODUCT_VO_LIST: {
return state.setIn(['queryActivityInfo', 'secKillProductVoList'], Immutable.fromJS(action.payload.secKillProductVoList))
.set('curActivity', Immutable.fromJS(action.payload.curActivity))
... ...
... ... @@ -20,9 +20,11 @@
"react-native-device-info": "0.9.5",
"react-native-fabric": "0.2.2",
"react-native-progress": "^3.0.1",
"react-native-root-toast": "^1.0.3",
"react-native-router-flux": "^3.32.0",
"react-native-scrollable-mixin": "^1.0.1",
"react-native-simple-store": "^1.1.0",
"react-native-smart-toast": "^1.1.1",
"react-native-swiper": "^1.4.11",
"react-redux": "^4.4.5",
"react-static-container": "^1.0.1",
... ... @@ -32,7 +34,6 @@
"redux-thunk": "^2.0.1",
"stacktrace-js": "^1.3.0",
"timeago.js": "^1.0.5",
"yh_rncamera": "0.1.0",
"react-native-smart-toast": "^1.1.1"
"yh_rncamera": "0.1.0"
}
}
... ...