SchedulePage.js 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  1. /**
  2. * Sample React Native App
  3. * https://github.com/facebook/react-native
  4. *
  5. * @format
  6. * @flow
  7. */
  8. import React, { Component } from "react";
  9. import {
  10. Platform,
  11. StyleSheet,
  12. Text,
  13. View,
  14. Image,
  15. TouchableOpacity,
  16. ImageBackground,
  17. FlatList,
  18. Button,
  19. DeviceEventEmitter
  20. } from "react-native";
  21. import AndroidUtil from "../../util/AndroidUtil";
  22. import BasePage from "../BasePage";
  23. import CourseTitle from "./CourseTitle";
  24. import ScheduleFlatItem from "./ScheduleFlatItem";
  25. const instructions = Platform.select({
  26. ios: "Press Cmd+R to reload,\n" + "Cmd+D or shake for dev menu",
  27. android:
  28. "Double tap R on your keyboard to reload,\n" +
  29. "Shake or press menu button for dev menu"
  30. });
  31. type Props = {};
  32. export default class SchedulePage extends BasePage {
  33. render() {
  34. return (
  35. <View
  36. style={{
  37. flex: 1,
  38. backgroundColor: "#F3F3F3",
  39. justifyContent: "center",
  40. alignItems: "center"
  41. }}
  42. >
  43. <View style={{ flex: 50 }}>
  44. <CourseTitle
  45. width={this.getWindowWidth()}
  46. title="第12周 爱上幼儿园"
  47. // backPress={() => this.goBack()}
  48. backPress={() => alert("点击返回")}
  49. sharedpress={() => alert("点击分享")}
  50. />
  51. </View>
  52. <View
  53. style={{
  54. flex: 281,
  55. width: "100%",
  56. justifyContent: "center",
  57. alignItems: "center"
  58. }}
  59. >
  60. <Image
  61. source={{
  62. uri:
  63. "https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1556277324856&di=dc1548a0c5ba10481af922e174912937&imgtype=0&src=http%3A%2F%2Fwww.51pptmoban.com%2Fd%2Ffile%2F2012%2F05%2F12%2F82c4568a90055adcf8fbb896f0841c69.jpg"
  64. }}
  65. style={{
  66. flex: 1,
  67. width: "100%",
  68. height: "100%"
  69. }}
  70. />
  71. </View>
  72. <View style={{ flex: 10 }} />
  73. <View
  74. style={{
  75. flex: 505,
  76. justifyContent: "center",
  77. alignItems: "center",
  78. width: "100%"
  79. }}
  80. >
  81. <FlatList
  82. ItemSeparatorComponent={() => (
  83. <View
  84. style={{
  85. height: 10
  86. }}
  87. />
  88. )}
  89. renderItem={({ item }) => {
  90. return this.loadFlatItem(item);
  91. }}
  92. keyExtractor={(item, index) => item.key.toString()}
  93. horizontal={false}
  94. data={[
  95. {
  96. key: 1,
  97. typecolor: "#74E0FF",
  98. typename: "习惯养成",
  99. videoname: "碗里不剩一粒米",
  100. videourl: "xxxx"
  101. },
  102. {
  103. key: 2,
  104. typecolor: "#FB5B76",
  105. typename: "品格礼仪",
  106. videoname: "我有很多朋友",
  107. videourl: "xxxx"
  108. },
  109. {
  110. key: 3,
  111. typecolor: "#EC48E1",
  112. typename: "自我保护",
  113. videoname: "小猫喵喵叫",
  114. videourl: "xxxx"
  115. },
  116. {
  117. key: 4,
  118. typecolor: "#39D6B9",
  119. typename: "亲子游戏",
  120. videoname: "安静的睡前游戏-全家人都睡了",
  121. videourl: "xxxx"
  122. },
  123. {
  124. key: 5,
  125. typecolor: "#3397F0",
  126. typename: "欢乐音乐",
  127. videoname: "小鸡捉虫子",
  128. videourl: "xxxx"
  129. }
  130. ]}
  131. />
  132. </View>
  133. </View>
  134. );
  135. }
  136. loadFlatItem(data) {
  137. return (
  138. <ScheduleFlatItem
  139. width={this.getWindowWidth() * 0.95}
  140. height={60}
  141. data={data}
  142. />
  143. );
  144. }
  145. }