index.js 1.7 KB
Newer Older
ItbGcthate's avatar
ItbGcthate 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79
import React, {Component} from 'react';
import {View, StyleSheet} from 'react-native';
import MyTitle from '../MyTitle';
import MyButton from '../MyButton';
import MyRecord from '../MyRecord';

class RangePKRecord extends Component {
  constructor() {
    super();
  }

  componentDidMount() {
    this.props.navigation.setOptions({
      headerBackVisible: false,
    });
  }

  confirm = () => {
    this.props.navigation.navigate('联网自习');
  };

  render() {
    const {numberTop, numberCentre, numberBottom, range} =
      this.props.route.params;

    return (
      <View style={styles.container}>
        <MyTitle
          containerStyle={styles.myTitle.containerStyle}
          title="本次自习结束"
        />
        <MyRecord
          containerStyle={styles.myRecord.containerStyle}
          text={{
            textTop: '本次您总共学习了 ' + numberTop + ' 分钟',
            textCentre: '' + range + ' 区域的排名是 ' + numberCentre,
            textBottom: '获得了 ' + numberBottom + ' 点经验',
          }}
        />
        <MyButton
          title="确认"
          buttonStyle={styles.myButton.buttonStyle}
          buttonEnabled={styles.myButton.buttonEnabled}
          onPress={this.confirm}
        />
      </View>
    );
  }
}

const styles = StyleSheet.create({
  container: {
    backgroundColor: '#F2E2CE',
    flex: 1,
  },
  myTitle: {
    containerStyle: {
      flex: 1,
    },
  },
  myRecord: {
    containerStyle: {
      flex: 3,
    },
  },
  myButton: {
    buttonEnabled: {
      backgroundColor: '#e1c2a1',
      borderColor: '#bf7636',
    },
    buttonStyle: {
      width: '60%',
      borderRadius: 10,
      borderWidth: 3,
    },
  },
});

export default RangePKRecord;