Authored by 孙凯

add alert review bydaiqiang

... ... @@ -13,6 +13,7 @@ import {
} from 'react-native';
import {Map} from 'immutable';
import ReceiveGiftAlert from './ReceiveGiftAlert';
export default class AssociatorGift extends Component {
constructor(props) {
... ... @@ -21,16 +22,17 @@ export default class AssociatorGift extends Component {
render() {
let {
demo,
showGiftAlert,
} = this.props;
return (
<View style={styles.container}>
<Text>aaaaaaaaaaaaa</Text>
<ReceiveGiftAlert showGiftAlert={showGiftAlert} hiddenGiftAlert={this.props.hiddenGiftAlert}/>
</View>
);
}
}
};
let {width, height} = Dimensions.get('window');
let styles = StyleSheet.create({
container: {
... ...
'use strict';
import React from 'react';
import ReactNative from 'react-native';
import Immutable, {Map} from 'immutable';
const {
AppRegistry,
StyleSheet,
Text,
View,
Image,
ListView,
Dimensions,
TouchableOpacity,
} = ReactNative;
export default class ReceiveGiftAlert extends React.Component {
constructor(props) {
super(props);
}
render() {
console.log(this.props.showGiftAlert);
if (!this.props.showGiftAlert) {
return null;
}
return (
<View style={styles.modalStyle}>
<TouchableOpacity activeOpacity={0.5} onPress={() => {
this.props.hiddenGiftAlert && this.props.hiddenGiftAlert();
}}>
<View style={styles.button}></View>
</TouchableOpacity>
</View>
);
}
};
let {width, height} = Dimensions.get('window');
let styles = StyleSheet.create({
container: {
},
modalStyle: {
position: "absolute",
top: 0,
left: 0,
width: width,
height: height,
backgroundColor: 'yellow'
},
button: {
height: 100,
width: 100,
backgroundColor: 'blue',
},
});
... ...
... ... @@ -5,6 +5,6 @@ export default keyMirror({
SET_PLATFORM: null,
SET_HOST: null,
SET_CHANNEL: null,
SHOWGIFTALERT: null,
DISMISSGIFTALERT: null,
});
... ...
... ... @@ -41,6 +41,8 @@ function mapDispatchToProps(dispatch) {
class AssociatorGiftContainer extends Component {
constructor(props) {
super(props);
this._displayGiftAlert = this._displayGiftAlert.bind(this);
this._hiddenGiftAlert = this._hiddenGiftAlert.bind(this);
}
componentDidMount() {
... ... @@ -51,14 +53,26 @@ class AssociatorGiftContainer extends Component {
}
_displayGiftAlert(){
this.props.actions.displayGiftAlert();
}
_hiddenGiftAlert(){
this.props.actions.hiddenGiftAlert();
}
render() {
let {
demo
} = this.props.associatorGift;
showGiftAlert,
} = this.props.associatorGift;
return (
<AssociatorGift />
<AssociatorGift
showGiftAlert={showGiftAlert}
displayGiftAlert={this._displayGiftAlert}
hiddenGiftAlert={this._hiddenGiftAlert}
/>
);
}
}
... ...
... ... @@ -5,5 +5,20 @@ import CouponService from '../../services/AssociatorGiftService';
const Platform = require('Platform');
const {
SET_HOST,
SHOWGIFTALERT,
DISMISSGIFTALERT,
} = require('../../constants/actionTypes').default;
export function displayGiftAlert() {
return {
type: SHOWGIFTALERT,
}
}
export function hiddenGiftAlert() {
return {
type: DISMISSGIFTALERT,
}
}
... ...
... ... @@ -3,7 +3,7 @@
import {Record, List, Map} from 'immutable';
let InitialState = Record({
demo: 1,
showGiftAlert: false,
});
export default InitialState;
... ...
... ... @@ -4,15 +4,20 @@ import InitialState from './associatorGiftInitialState';
import Immutable, {Map} from 'immutable';
const {
SET_HOST,
SHOWGIFTALERT,
DISMISSGIFTALERT,
} = require('../../constants/actionTypes').default;
const initialState = new InitialState;
export default function couponReducer(state=initialState, action) {
switch(action.type) {
case SHOWGIFTALERT: {
return state.set('showGiftAlert', true);
}
case DISMISSGIFTALERT: {
return state.set('showGiftAlert', false);
}
}
return state;
... ...