Advertisement
Guest User

Untitled

a guest
Jul 16th, 2019
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.80 KB | None | 0 0
  1. import React, { Component } from 'react';
  2. import {
  3. StyleSheet,
  4. View,
  5. FlatList,
  6. Text,
  7. Platform,
  8. Alert,
  9. } from 'react-native';
  10. import { Container,Header,Left,Right,Icon, Title, Body } from 'native-base';
  11. import GlobalStyle from '../component/style/GlobalStyle';
  12. import ScheduleListRow from '../component/ScheduleListRow';
  13. import Button from '../component/common/Button';
  14.  
  15. class ScheduleScreen extends Component{
  16. constructor(props) {
  17. super(props);
  18. this.state = {
  19. scheduleData : [
  20. {
  21. dateTrans : 'April 22, 2019',
  22. scheduleContent : [
  23. {
  24. name : 'Andika',
  25. description : 'Meeting 16:30',
  26. },
  27. {
  28. name : 'BI Team',
  29. description : 'Meeting 19:30',
  30. },
  31. ]
  32. },
  33. ]
  34.  
  35. // scheduleData : [
  36. // {
  37. // name : 'Andika',
  38. // description : 'Meeting 16:30',
  39. // },
  40. // {
  41. // name : 'BI Team',
  42. // description : 'Meeting 19:30',
  43. // },
  44. // ]
  45. };
  46. }
  47.  
  48. _keyApprovalExtractor = (item, index) => item.scheduleContent.name;
  49. _renderItem = ({item, scheduleContent}) => (
  50. <ScheduleListRow
  51. xDateTrans={item.dateTrans}
  52. xName={item.scheduleContent.name}
  53. xDescription={item.scheduleContent.description}
  54. onPressItem={this._onPressItem}
  55. />
  56. );
  57.  
  58. _onPressItem = (name) => {
  59. Alert.alert(name);
  60. };
  61.  
  62. render(){
  63. return(
  64. <Container>
  65. <Header style={{ backgroundColor: 'white' }}>
  66. <Left style={{ flexDirection: 'row'}}>
  67. <Icon onPress={() => this.props.navigation.openDrawer()} name="md-menu" style={{ color: 'black', marginRight: 15 }} />
  68. </Left>
  69. <Body>
  70. <Title style={{color:'black'}}>Schedule</Title>
  71. </Body>
  72. <Right>
  73. <Icon name="ios-arrow-down" style={{ color: 'black'}} />
  74. </Right>
  75. </Header>
  76. <View style={styles.container}>
  77. <FlatList
  78. style={GlobalStyle.listContainer}
  79. data={this.state.scheduleData}
  80. renderItem={this._renderItem}
  81. keyExtractor={this._keyApprovalExtractor}
  82. />
  83. <View style={styles.bottomContainer}>
  84. <Button>NEW SCHEDULE</Button>
  85. </View>
  86. </View>
  87. </Container>
  88. );
  89. }
  90. }
  91.  
  92. const styles = StyleSheet.create({
  93. container : {
  94. flex: 1,
  95. flexDirection : 'column',
  96. backgroundColor:'#FFFFFF',
  97. },
  98. dateText : {
  99. marginTop : Platform.OS === 'ios' ? 8 : 0,
  100. padding : 5,
  101. fontSize:14,
  102. color:'#000000'
  103. },
  104. bottomContainer : {
  105. justifyContent : "flex-end",
  106. alignItems : "center",
  107. marginBottom : 10
  108. }
  109. });
  110.  
  111.  
  112. export default ScheduleScreen;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement