SchoolAge.js 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  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. StatusBar,
  17. ImageBackground,
  18. Button,
  19. DeviceEventEmitter
  20. } from 'react-native';
  21. import BasePage from './BasePage';
  22. type Props = {};
  23. export default class SchoolAge extends BasePage {
  24. render() {
  25. return (
  26. <ImageBackground
  27. // source={{
  28. // uri:
  29. // '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'
  30. // }}
  31. style={{
  32. flex: 1,
  33. width: '100%',
  34. height: '100%',
  35. backgroundColor: 'white'
  36. }}
  37. >
  38. <StatusBar backgroundColor={'transparent'} translucent={true} barStyle={'dark-content'} />
  39. <View style={{ flex: 0.5 }} />
  40. <Text style={styles.title_text}>请选择孩子所在的学龄段</Text>
  41. <View style={{ flex: 0.1 }} />
  42. <View
  43. style={{
  44. flex: 5,
  45. flexDirection: 'column',
  46. justifyContent: 'center',
  47. alignItems: 'center'
  48. }}
  49. >
  50. <View style={styles.view_flex} />
  51. <TouchableOpacity activeOpacity={1} onPress={this.pres.bind(this)} style={styles.touchable_item}>
  52. <Image source={require('./images/schoolAge/preschool.png')} style={styles.image_item} />
  53. </TouchableOpacity>
  54. <View style={styles.view_flex} />
  55. <TouchableOpacity activeOpacity={1} onPress={this.primary.bind(this)} style={styles.touchable_item}>
  56. <Image source={require('./images/schoolAge/primary.png')} style={styles.image_item} />
  57. </TouchableOpacity>
  58. <View style={styles.view_flex} />
  59. <TouchableOpacity activeOpacity={1} onPress={this.middle.bind(this)} style={styles.touchable_item}>
  60. <Image source={require('./images/schoolAge/middle.png')} style={styles.image_item} />
  61. </TouchableOpacity>
  62. <View style={styles.view_flex} />
  63. </View>
  64. </ImageBackground>
  65. );
  66. }
  67. pres() {
  68. this.clearPageToNext('MainPage', { index: 0 });
  69. }
  70. primary() {
  71. this.clearPageToNext('MainPage', { index: 1 });
  72. }
  73. middle() {
  74. this.clearPageToNext('MainPage', { index: 2 });
  75. }
  76. }
  77. const styles = StyleSheet.create({
  78. title_text: {
  79. justifyContent: 'center',
  80. alignItems: 'center',
  81. color: 'black',
  82. fontSize: 20,
  83. fontWeight: '300',
  84. textAlign: 'center'
  85. },
  86. view_flex: { flex: 0.1 },
  87. touchable_item: {
  88. flex: 1,
  89. width: '90%',
  90. justifyContent: 'center',
  91. alignItems: 'center'
  92. },
  93. image_item: {
  94. width: '100%',
  95. height: '95%',
  96. resizeMode: 'contain'
  97. }
  98. });