Advertisement
Guest User

Untitled

a guest
Jul 16th, 2018
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.16 KB | None | 0 0
  1. import React, { Component } from 'react';
  2. import {
  3. StyleSheet,
  4. View,
  5. TextInput,
  6. TouchableHighlight,
  7. Alert,
  8. Image,
  9. ListView,
  10. TouchableOpacity
  11. } from 'react-native';
  12.  
  13. import { Container, Header, Content, Form, Item, Input,
  14. Label, Button, Text, Icon, Toast, Card, CardItem, Body,
  15. Right, Left, Title, Footer, FooterTab
  16. } from 'native-base';
  17.  
  18.  
  19. export default class Search extends Component {
  20.  
  21. constructor(props) {
  22. super(props);
  23. const ds = new ListView.DataSource({rowHasChanged: (r1, r2) => r1 !== r2});
  24. this.state = {
  25. dataSource: ds.cloneWithRows([
  26. {image: "https://bootdey.com/img/Content/avatar/avatar1.png"},
  27. {image: "https://bootdey.com/img/Content/avatar/avatar6.png"},
  28. {image: "https://bootdey.com/img/Content/avatar/avatar2.png"},
  29. {image: "https://bootdey.com/img/Content/avatar/avatar3.png"},
  30. {image: "https://bootdey.com/img/Content/avatar/avatar4.png"},
  31. ]),
  32. };
  33. }
  34.  
  35. eventClickLister = (viewId) => {
  36. Alert.alert("Alert", "Item selected");
  37. }
  38.  
  39. openDrawer(){
  40. this.props.navigation.openDrawer();
  41. }
  42.  
  43. render() {
  44. return (
  45. <Container>
  46. <Header style={{backgroundColor:'#092948'}}>
  47. <Left style={{flex: 1}}>
  48. <Button transparent onPress={() => this.openDrawer()}>
  49. <Icon name='menu' />
  50. </Button>
  51. </Left>
  52. <Body style={{flex: 1}}>
  53. <Title> Pencarian</Title>
  54. </Body>
  55. <Right style={{flex: 1}}/>
  56. </Header>
  57.  
  58. <View>
  59. <Form>
  60. <Item last regular full style={{backgroundColor:'#fff', elevation:2}}>
  61. <Input placeholder={'Pencarian...'}/>
  62. </Item>
  63. </Form>
  64. </View>
  65.  
  66. <Content padder>
  67. <ListView enableEmptySections={true}
  68. dataSource={this.state.dataSource}
  69. renderRow={(service) => {
  70. return (
  71. <View>
  72. <TouchableOpacity onPress={() => this.props.navigation.navigate('Detail')}>
  73. <View style={styles.box}>
  74. <Image style={styles.image} source={{uri: service.image}} />
  75. <View style={styles.boxContent}>
  76. <Text style={styles.title}>John Cold / 160002</Text>
  77. <Text style={styles.description}>Lorem ipsum dolor sit amet, elit consectetur</Text>
  78. </View>
  79. </View>
  80. </TouchableOpacity>
  81. </View>
  82. )
  83. }}
  84. />
  85. </Content>
  86. </Container>
  87. );
  88. }
  89. }
  90.  
  91. const styles = StyleSheet.create({
  92. image: {
  93. width: 100,
  94. height:100,
  95. },
  96. box: {
  97. padding:20,
  98. marginTop:5,
  99. marginBottom:5,
  100. borderRadius:5,
  101. backgroundColor: 'white',
  102. flexDirection: 'row',
  103. elevation:3
  104. },
  105. boxContent: {
  106. flex:1,
  107. flexDirection: 'column',
  108. alignItems: 'flex-start',
  109. marginLeft:10,
  110. },
  111. description:{
  112. fontSize:15,
  113. color: "#646464",
  114. },
  115. title:{
  116. fontSize:18,
  117. color:"#151515",
  118. }
  119. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement