Authored by 孙凯

add alert review by daiqiang

... ... @@ -27,6 +27,7 @@ export default class AssociatorGift extends Component {
return (
<View style={styles.container}>
<Text>aaaaa</Text>
<ReceiveGiftAlert showGiftAlert={showGiftAlert} hiddenGiftAlert={this.props.hiddenGiftAlert}/>
</View>
);
... ...
... ... @@ -13,51 +13,139 @@ const {
ListView,
Dimensions,
TouchableOpacity,
Modal,
} = ReactNative;
export default class ReceiveGiftAlert extends React.Component {
constructor(props) {
super(props);
this._onRequestClose = this._onRequestClose.bind(this);
this.renderRow = this.renderRow.bind(this);
this.dataSource = new ListView.DataSource({
rowHasChanged: (r1, r2) => r1.key != r2.key,
});
}
_onRequestClose(){
console.log('_onRequestClose');
}
renderRow(rowData, sectionID, rowID, highlightRow) {
return(
<View style={styles.row}>
<View style={styles.rowIcon}>
</View>
</View>
);
}
render() {
console.log(this.props.showGiftAlert);
if (!this.props.showGiftAlert) {
return null;
}
let dataSource = [1,1,1,1,1,1,1,1,1,1];
return (
<View style={styles.modalStyle}>
<TouchableOpacity activeOpacity={0.5} onPress={() => {
this.props.hiddenGiftAlert && this.props.hiddenGiftAlert();
}}>
<View style={styles.button}></View>
</TouchableOpacity>
</View>
<Modal
visible={this.props.showGiftAlert}
animationType={'none'}
transparent = {true}
onRequestClose={this._onRequestClose}
>
<View style={styles.modalStyle}>
<View style={styles.container}>
<Text style={styles.title}>恭喜你领取成功</Text>
<TouchableOpacity style={styles.delete} activeOpacity={0.5} onPress={() => {
this.props.hiddenGiftAlert && this.props.hiddenGiftAlert();
}}>
</TouchableOpacity>
<View style={styles.contentContainer}>
<ListView
ref='giftList'
contentContainerStyle={styles.listContainer}
enableEmptySections={true}
dataSource={this.dataSource.cloneWithRows(dataSource)}
renderRow={this.renderRow}
/>
</View>
<View style={styles.detailView}>
<Text style={styles.detail}>查看详情</Text>
</View>
</View>
</View>
</Modal>
);
}
};
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',
},
backgroundColor: 'rgba(0, 0, 0, 0.6)',
flex: 1,
justifyContent: 'center',
alignItems: 'center',
},
container: {
height: 360,
width: 280,
alignItems: 'center',
backgroundColor: '#FFFFFF',
borderRadius: 10,
},
title: {
fontSize: 20,
color: '#A69073',
marginTop: 30,
},
delete: {
position: 'absolute',
height: 19,
width: 19,
top: 11,
right: 11,
backgroundColor: 'red',
},
contentContainer: {
height: 200,
width: 260,
marginTop: 26,
},
listContainer: {
alignItems: 'center',
},
row: {
height: 110,
width: 200,
},
rowIcon: {
height: 90,
width: 200,
backgroundColor: 'red',
},
detailView: {
marginTop: 30,
borderBottomColor: '#444444',
borderBottomWidth: 2,
},
detail: {
fontFamily: 'PingFang-SC-Medium',
fontSize: 14,
color: '#444444',
},
});
... ...