MainActivity.js 2.4 KB

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