ScheduleFlatItem.js 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. import React, { Component } from "react";
  2. import {
  3. Platform,
  4. StyleSheet,
  5. Text,
  6. View,
  7. Image,
  8. TouchableOpacity,
  9. ImageBackground,
  10. Button,
  11. Dimensions,
  12. DeviceEventEmitter
  13. } from "react-native";
  14. /** 因没有图,所以Image先用颜色代替,有图可替换 */
  15. const instructions = Platform.select({
  16. ios: "Press Cmd+R to reload,\n" + "Cmd+D or shake for dev menu",
  17. android:
  18. "Double tap R on your keyboard to reload,\n" +
  19. "Shake or press menu button for dev menu"
  20. });
  21. type Props = {};
  22. var width = Dimensions.get("window").width;
  23. var height = Dimensions.get("window").height;
  24. export default class ScheduleFlatItem extends Component<Props> {
  25. render() {
  26. return (
  27. <View
  28. style={{
  29. backgroundColor: "white",
  30. width: this.props.width,
  31. height: this.props.height,
  32. alignItems: "center",
  33. justifyContent: "center",
  34. borderRadius: 30
  35. }}
  36. >
  37. <View
  38. style={{
  39. width: "95%",
  40. height: "80%",
  41. flexDirection: "row",
  42. alignItems: "center",
  43. justifyContent: "center"
  44. }}
  45. >
  46. <View
  47. style={{
  48. flex: 2.5,
  49. backgroundColor: this.props.data.typecolor,
  50. width: "95%",
  51. height: "70%",
  52. alignItems: "center",
  53. justifyContent: "center",
  54. borderRadius: 20
  55. }}
  56. >
  57. <Text style={{ color: "white" }}>{this.props.data.typename}</Text>
  58. </View>
  59. <View style={{ flex: 0.5 }} />
  60. <View
  61. style={{
  62. flex: 10,
  63. width: "100%",
  64. justifyContent: "center",
  65. height: "100%"
  66. }}
  67. >
  68. <Text style={{ textAlign: "left" }}>
  69. {this.props.data.videoname}
  70. </Text>
  71. </View>
  72. <View
  73. style={{
  74. flex: 1,
  75. width: "100%",
  76. height: "80%",
  77. alignItems: "center",
  78. justifyContent: "center",
  79. backgroundColor: "blue"
  80. }}
  81. >
  82. <Image style={{ width: 20, height: 20, backgroundColor: "blue" }} />
  83. </View>
  84. <View style={{ flex: 0.1 }} />
  85. </View>
  86. </View>
  87. );
  88. }
  89. }
  90. /**
  91. 使用方法
  92. <CourseTitle
  93. width={150}
  94. height={50}
  95. title="学前"
  96. backPress={() => this.goBack()}
  97. sharedpress={() => alert("点击分享")}
  98. />
  99. */