MainActivity.js 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  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. Button,
  15. DeviceEventEmitter
  16. } from "react-native";
  17. import AndroidUtil from "../util/AndroidUtil";
  18. import BasePage from "./BasePage";
  19. import Header from "./components/Header";
  20. import RevisionAge from "./components/RevisionAge";
  21. import CourseTitle from "./components/CourseTitle";
  22. import ScheduleFlatItem from "./components/ScheduleFlatItem";
  23. const instructions = Platform.select({
  24. ios: "Press Cmd+R to reload,\n" + "Cmd+D or shake for dev menu",
  25. android:
  26. "Double tap R on your keyboard to reload,\n" +
  27. "Shake or press menu button for dev menu"
  28. });
  29. type Props = {};
  30. export default class MainActivity extends BasePage {
  31. render() {
  32. return (
  33. <View style={styles.container}>
  34. <Text style={styles.welcome}>Welcome to React Native!</Text>
  35. <Text style={styles.instructions}>To get started, edit App.js</Text>
  36. <Button title="toast" onPress={() => this.Toast("Main")} />
  37. <Text style={styles.instructions}>To get started, edit App.js</Text>
  38. <Button
  39. title="toWebActivity"
  40. onPress={() => this.toWebPage("这里写json......")}
  41. />
  42. <Text style={styles.instructions}>To get started, edit App.js</Text>
  43. <Button title="testJssssss" onPress={() => this.testJssss()} />
  44. <Text style={styles.instructions}>To get started, edit App.js</Text>
  45. <Button title="back" onPress={() => this.backSchoolAge()} />
  46. <Header
  47. uri="https://ss1.bdstatic.com/70cFvXSh_Q1YnxGkpoWK1HF6hhy/it/u=1295208965,3056573814&amp;fm=26&amp;gp=0.jpg"
  48. width={200}
  49. height={150}
  50. username="卡通笨笨熊"
  51. flowerNumber="123234"
  52. onPress={() => this.toWebPage("这里写json......")}
  53. />
  54. <RevisionAge
  55. width={150}
  56. height={50}
  57. textss="学前"
  58. onPress={() => this.toWebPage("这里写json......")}
  59. />
  60. <Text style={styles.instructions}>To get started, edit App.js</Text>
  61. <Text style={styles.instructions}>To get started, edit App.js</Text>
  62. <ScheduleFlatItem width={this.getWindowWidth()} height={30} />
  63. </View>
  64. );
  65. }
  66. }
  67. const styles = StyleSheet.create({
  68. container: {
  69. flex: 1,
  70. justifyContent: "center",
  71. alignItems: "center",
  72. backgroundColor: "black"
  73. },
  74. welcome: {
  75. fontSize: 20,
  76. textAlign: "center",
  77. margin: 10
  78. },
  79. instructions: {
  80. textAlign: "center",
  81. color: "#333333",
  82. marginBottom: 5
  83. }
  84. });