/* * */ import React, { Component } from 'react'; import { Platform, StyleSheet, Text, View, Image, TouchableOpacity, StatusBar, FlatList, BackHandler, TouchableHighlight, DeviceEventEmitter, ScrollView } from 'react-native'; import BasePage from '../BasePage'; import Dimensions from '../utils/dimensions'; import TopicTitle from '../components/TopicTitle'; import CourseTitle from '../components/CourseTitle'; import NoDataView from '../components/NoDataView'; export default class Order extends BasePage { state = { data: [ // { title: '生活好榜样', time: '2019-10-01' }, // { title: '生活好榜样2', time: '2019-10-01' }, // { title: '生活好榜样3', time: '2019-10-01' }, // { title: '生活好榜样第二期', time: '2019-10-01' } ] }; renderItem = (item, index) => { return ( {/* {index === 0 ? : null} */} {item.title} 购买日期:{item.time} 去学习 ); }; render() { return ( this.goBack()} // backPress={() => alert("左侧按钮")} /> {this.state.data.length > 0 ? ( this.renderItem(item, index)} keyExtractor={(item, index) => index.toString()} /> ) : ( )} ); } componentWillMount() { BackHandler.addEventListener('hardwareBackPress', this.onBackAndroid); } componentWillUnmount() { BackHandler.removeEventListener('hardwareBackPress', this.onBackAndroid); } onBackAndroid = () => { this.goBack(); return true; }; } const styles = StyleSheet.create({ item: { width: Dimensions.width, height: Dimensions.getHeight(79), flexDirection: 'row', justifyContent: 'space-between', marginBottom: 6, alignItems: 'center', paddingHorizontal: 14, // borderTopWidth: 1, backgroundColor: 'rgba(255, 255, 255, 1)' // borderColor: '#f0f1f5' }, left: { flexDirection: 'column' }, title: { fontSize: 18, color: '#151515' }, time: { fontSize: 14, color: '#555' }, right: { width: Dimensions.getWidth(83), height: Dimensions.getHeight(27), borderRadius: 14, backgroundColor: '#ffae59', justifyContent: 'center', alignItems: 'center' }, study: { color: '#fff', fontSize: 16 } });