import React, { Component } from "react"; import { Platform, StyleSheet, Text, View, Image, TouchableOpacity, ImageBackground, Button, Dimensions, DeviceEventEmitter } from "react-native"; /** 因没有图,所以Image先用颜色代替,有图可替换 */ const instructions = Platform.select({ ios: "Press Cmd+R to reload,\n" + "Cmd+D or shake for dev menu", android: "Double tap R on your keyboard to reload,\n" + "Shake or press menu button for dev menu" }); type Props = {}; var width = Dimensions.get("window").width; var height = Dimensions.get("window").height; export default class CourseTitle extends Component { render() { return ( {this.selectleftIcon()} {this.props.title} {this.props.righttype ? this.selectRightIcon() : null} ); } selectleftIcon() { let type = this.props.lefttype; let back = ""; switch (type) { case 1: //左侧返回图片1 back = require("../images/schedulePage/back_black.png"); break; case 2: //左侧返回图片2 back = require("../images/userInfo/back_white.png"); break; } return ( ); } selectRightIcon() { let type = this.props.righttype; let right = ""; switch (type) { case 1: //课程表标题,右侧是分享 right = require("../images/common/share.png"); break; case 2: //个人中心,右侧是设置 right = require("../images/common/setting.png"); break; default: return true; } return ( ); } } /** this.goBack()} //左侧按钮方法 backPress={() => alert("点击返回")} //右侧按钮方法 rightPress={() => alert("点击分享")} /> */