import React, {Component} from 'react';
import MenuPopWindow from '../views/PopupWindow';
import Global from '../utils/Global';
import {
StyleSheet,
Text,
View,
Image,
Dimensions,
TouchableOpacity,
Button,
Platform
} from 'react-native';
const {width, height} = Dimensions.get('window');
export default class TitleBar extends Component {
constructor(props) {
super(props);
this.state = {
showPop: false,
}
}
renderAndroid() {
return (
RN微信
{
this.setState({showPop: show})
}}
menuIcons={[require('../../images/ic_pop_group_chat.png'), require('../../images/ic_pop_add_friends.png'), require('../../images/ic_pop_scan.png'),
require('../../images/ic_pop_pay.png'), require('../../images/ic_pop_help.png')]}
menuTexts={['发起群聊', '添加朋友', '扫一扫', '收付款', '帮助与反馈']}
/>
);
}
renderIOS() {
return (
RN微信
{
this.setState({showPop: show})
}}
menuIcons={[require('../../images/ic_pop_group_chat.png'), require('../../images/ic_pop_add_friends.png'), require('../../images/ic_pop_scan.png'),
require('../../images/ic_pop_pay.png'), require('../../images/ic_pop_help.png')]}
menuTexts={['发起群聊', '添加朋友', '扫一扫', '收付款', '帮助与反馈']}
/>
);
}
render() {
if (Platform.OS === 'ios') {
return this.renderIOS();
}
return this.renderAndroid();
}
handleSearchClick = () => {
// 跳转到SearchScreen界面
this.props.nav.navigate('Search');
}
handleAddClick = () => {
this.setState({showPop: !this.state.showPop});
}
}
class CustomModal extends Component {
constructor(props) {
super(props);
this.state = {
modalVisible: false,
}
}
render() {
return (
{
alert("Modal has been closed.")
}}>
Hello World! This is a Modal!
);
}
closeModel = () => {
this.setState({modalVisible: false});
}
openModal() {
this.setState({modalVisible: true});
}
}
const modalStyle = StyleSheet.create({
container: {
flex: 1,
flexDirection: 'column',
justifyContent: 'center',
alignItems: 'center',
backgroundColor: 'rgba(0, 0, 0, 0.5)'
},
content: {
width: width - 40,
flexDirection: 'column',
justifyContent: 'center',
alignItems: 'center',
marginLeft: 20,
marginRight: 20,
backgroundColor: '#FFFFFF',
height: 100,
borderRadius: 5,
paddingTop: 10,
paddingBottom: 10,
paddingLeft: 10,
paddingRight: 10,
}
});
const styles = StyleSheet.create({
titleBarContainer: {
flexDirection: 'row',
width: width,
height: 50,
backgroundColor: Global.titleBackgroundColor
},
titleBarTextContainer: {
flex: 1,
flexDirection: 'row',
alignItems: 'center',
paddingLeft: 10,
paddingRight: 10,
},
titleBarButtonContainer: {
alignItems: 'center',
flexDirection: 'row',
paddingLeft: 10,
paddingRight: 10,
},
title: {
color: '#FFFFFF',
fontSize: 18,
fontWeight: 'bold',
},
titleBarImg: {
width: 25,
height: 25,
marginLeft: 15,
marginRight: 15,
}
});