import React, { Component } from "react"; import { Platform, StyleSheet, Text, View, Image, TouchableOpacity, ImageBackground, Button, Dimensions, DeviceEventEmitter } from "react-native"; 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" }); /** 因没有图,所以Image先用颜色代替,有图可替换 */ type Props = {}; var width = Dimensions.get("window").width; var height = Dimensions.get("window").height; export default class RevisionAge extends Component<Props> { render() { return ( <TouchableOpacity activeOpacity={1} onPress={this.props.onPress}> <View style={{ width: this.props.width, height: this.props.height, flexDirection: "row", backgroundColor: "white", alignItems: "center", justifyContent: "center", borderRadius: 30 }} > <View style={{ flex: 1 }} /> <View style={{ flex: 4, flexDirection: "row", alignItems: "center", justifyContent: "center" }} > <Image // source={{ // uri: // "https://ss1.bdstatic.com/70cFvXSh_Q1YnxGkpoWK1HF6hhy/it/u=1295208965,3056573814&fm=26&gp=0.jpg" // }} style={{ width: 20, height: 20, backgroundColor: "blue" }} /> <Text style={{ fontSize: 18, marginLeft: 10, fontWeight: "bold", color: "#151515" }} > {this.props.textss} </Text> </View> </View> </TouchableOpacity> ); } } /** 使用方法 <RevisionAge width={150} height={50} textss="学前" onPress={() => this.toWebPage("这里写json......")} /> */