EChartsPage.js 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. import React, { Component } from 'react';
  2. import {
  3. StyleSheet,
  4. View,
  5. FlatList, Image,
  6. } from 'react-native';
  7. import BIChartsItem from "../commons/bi/BIChartsItem";
  8. export default class EChartsPage extends Component {
  9. static navigationOptions = {
  10. headerBackImage:(
  11. <View style={{marginLeft:18}}>
  12. <Image
  13. source={{uri: 'uu_back-icon'}}
  14. style={{ width: 12, height: 20,marginRight:6}}
  15. />
  16. </View>
  17. ), //使用组件
  18. }
  19. constructor(props){
  20. super(props);
  21. this.state={
  22. dataArray:['line','bar','line'],
  23. }
  24. }
  25. renderItem(data){
  26. return <BIChartsItem
  27. typeTitle = {data.item}
  28. />
  29. }
  30. render() {
  31. return (
  32. <View style={styles.container}>
  33. <FlatList
  34. data={this.state.dataArray}
  35. renderItem = {data=>this.renderItem(data)}
  36. />
  37. </View>
  38. );
  39. }
  40. }
  41. const styles = StyleSheet.create({
  42. container: {
  43. flex:1,
  44. backgroundColor: '#efefef',
  45. },
  46. title:{
  47. color:'white',
  48. fontSize:20,
  49. textAlign:'center',
  50. },
  51. });