GameHome.js 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  1. import React, { Component } from "react"
  2. import { StyleSheet, Text, View, Image, ImageBackground, ScrollView, TouchableOpacity } from "react-native"
  3. import { unitWidth, unitHeight } from "../utils/AdapterUtil";
  4. import Ionicons from "react-native-vector-icons/Ionicons"
  5. import FontAwesome5 from "react-native-vector-icons/FontAwesome5"
  6. export default class GameHome extends Component {
  7. toGamer = () => {
  8. const { navigation } = this.props;
  9. navigation.navigate("RecommendGamer")
  10. }
  11. render() {
  12. return (
  13. <ScrollView>
  14. <View style={styles.container}>
  15. <Image
  16. source={require("../../static/bannerBgc.png")}
  17. style={styles.bannerBgc}
  18. />
  19. <View style={styles.centerTab}>
  20. <TouchableOpacity onPress={this.toGamer}>
  21. <ImageBackground source={require('../../static/tabBgc1.png')}
  22. style={styles.tabBgc}
  23. >
  24. <Text style={styles.tabText}>闯关游戏</Text>
  25. </ImageBackground>
  26. </TouchableOpacity>
  27. <ImageBackground source={require('../../static/tabBgc2.png')}
  28. style={styles.tabBgc}
  29. >
  30. <Text style={styles.tabText}>谁是卧底</Text>
  31. </ImageBackground>
  32. </View>
  33. <View style={styles.cardList}>
  34. <View style={styles.cardItem}>
  35. <View style={styles.cardTit}>
  36. <Ionicons
  37. name={"ios-radio-button-on"}
  38. size={20}
  39. style={{ color: "#FB788A" }}
  40. />
  41. <Text style={{ fontSize: unitWidth * 28, color: "#333333", marginLeft: unitWidth * 20 }}>推荐关卡</Text>
  42. </View>
  43. <Text style={{ fontSize: unitWidth * 28, color: "#333333", marginBottom: unitHeight * 24 }}>关卡关卡关卡关卡关卡关卡关卡关卡关卡关卡关卡关卡关卡</Text>
  44. <Image
  45. source={require("../../static/bannerBgc.png")}
  46. style={styles.cardBgc}
  47. />
  48. <View style={styles.cardBottom}>
  49. <View style={styles.cardBottomItem}>
  50. <FontAwesome5
  51. name={"crown"}
  52. size={20}
  53. style={{ color: "orange" }}
  54. />
  55. <Text style={{ fontSize: unitWidth * 28, color: "#333333", marginLeft: unitWidth * 20 }}>关主:明明</Text>
  56. </View>
  57. <View style={styles.cardBottomItem}>
  58. <FontAwesome5
  59. name={"heartbeat"}
  60. size={20}
  61. style={{ color: "#FB788A" }}
  62. />
  63. <Text style={{ fontSize: unitWidth * 28, color: "#333333", marginLeft: unitWidth * 20 }}>魅力值:90</Text>
  64. </View>
  65. </View>
  66. </View>
  67. </View>
  68. </View>
  69. </ScrollView>
  70. )
  71. }
  72. }
  73. const styles = StyleSheet.create({
  74. container: {
  75. flex: 1,
  76. alignItems: "center",
  77. paddingLeft: unitWidth * 23,
  78. paddingRight: unitWidth * 23
  79. },
  80. bannerBgc: {
  81. height: unitHeight * 300,
  82. width: "100%",
  83. marginTop: unitHeight * 10
  84. },
  85. centerTab: {
  86. width: "100%",
  87. height: unitHeight * 200,
  88. marginTop: unitHeight * 30,
  89. marginBottom: unitHeight * 30,
  90. flexDirection: "row",
  91. justifyContent: "space-between"
  92. },
  93. tabBgc: {
  94. width: unitWidth * 342,
  95. height: unitHeight * 200,
  96. justifyContent: "center",
  97. paddingLeft: unitWidth * 42,
  98. },
  99. tabText: {
  100. fontSize: unitWidth * 32,
  101. color: "#FFFFFF",
  102. fontWeight: "bold"
  103. },
  104. cardList: {
  105. width: "100%"
  106. },
  107. cardItem: {
  108. width: "100%",
  109. height: unitHeight * 880
  110. },
  111. cardTit: {
  112. flexDirection: "row",
  113. alignItems: "center",
  114. marginBottom: unitHeight * 23
  115. },
  116. cardBgc: {
  117. width: "100%",
  118. height: unitHeight * 650,
  119. borderRadius: unitHeight * 20
  120. },
  121. cardBottom: {
  122. flexDirection: "row",
  123. justifyContent: "space-between",
  124. paddingLeft: unitWidth * 30,
  125. paddingRight: unitWidth * 30,
  126. marginTop: unitHeight * 30
  127. },
  128. cardBottomItem: {
  129. flexDirection: "row",
  130. alignItems: "center"
  131. }
  132. })