/**
* Sample React Native App
* https://github.com/facebook/react-native
*
* @format
* @flow
*/
import React, { Component } from "react";
import {
Platform,
StyleSheet,
Text,
View,
Image,
TouchableOpacity,
ImageBackground,
Button,
StatusBar,
Modal,
TouchableHighlight,
DeviceEventEmitter
} from "react-native";
import AndroidUtil from "../../util/AndroidUtil";
import BasePage from "../BasePage";
import CourseTitle from "./CourseTitle";
import Header from "./Header";
import PersonalInfoDialog from "./PersonalInfoDialog";
type Props = {};
export default class PersonalInfo extends BasePage {
state = {
nickName: "初始昵称",
schoolName: "未设置"
};
updateState(data) {
this.setState(data);
}
render() {
return (
(this.dialog = view)}
updateParentState={this.updateState.bind(this)}
/>
this.goBack()}
lefttype={2}
textcolor={"white"}
backPress={() => this.goBack()}
/>
this.toNextPage("MainActivity")}
/>
{this.userInfo123()}
{this.userInfo456()}
this.logout()}
>
退出登录
);
}
userInfo123() {
return (
{this.choseheadericon(0)}
头像
{this.getArraowImg(0)}
{this.choseheadericon(1)}
{this.state.nickName}
{this.getArraowImg(1)}
{this.choseheadericon(2)}
生日
{this.getArraowImg(2)}
);
}
userInfo456() {
return (
{this.choseheadericon(3)}
所在地区
{this.getArraowImg(3)}
{this.choseheadericon(4)}
{this.state.schoolName}
{this.getArraowImg(4)}
{this.choseheadericon(5)}
我的年级
{this.getArraowImg(5)}
);
}
getArraowImg(type) {
return (
this.arrowpress(type)}
>
);
}
choseheadericon(type) {
let headerpath;
switch (type) {
case 0:
headerpath = require("../images/userInfo/headportrait.png");
break;
case 1:
headerpath = require("../images/userInfo/nickname.png");
break;
case 2:
headerpath = require("../images/userInfo/birthday.png");
break;
case 3:
headerpath = require("../images/userInfo/location.png");
break;
case 4:
headerpath = require("../images/userInfo/school.png");
break;
case 5:
headerpath = require("../images/userInfo/grade.png");
break;
}
// alert(headerpath);
return (
);
}
arrowpress(type) {
switch (type) {
case 0:
alert("点击头像");
break;
case 1:
this.dialog.setInfo("修改昵称", "昵称");
this.dialog.setModalVisible(true, 1);
break;
case 2:
alert("生日");
break;
case 3:
alert("所在地区");
break;
case 4:
this.dialog.setInfo("我的学校", "学校名称");
this.dialog.setModalVisible(true, 2);
break;
case 5:
alert("我的年级");
break;
}
}
logout() {
alert("点击退出了");
}
}
const styles = StyleSheet.create({
item: {
flex: 1,
width: "100%",
flexDirection: "row",
backgroundColor: "white"
},
item_text: {
flex: 10,
marginLeft: 10,
textAlignVertical: "center",
color: "black",
fontSize: 20
}
});