Advertisement
Guest User

Untitled

a guest
Oct 20th, 2019
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.83 KB | None | 0 0
  1. import React from 'react';
  2. import {Image} from 'react-native';
  3. import {RecyclerListView, DataProvider, LayoutProvider} from 'recyclerlistview';
  4. import { createDrawerNavigator } from 'react-navigation-drawer';
  5.  
  6. import {
  7. View,
  8. List,
  9. Container,
  10. Header,
  11. Content,
  12. Left,
  13. Right,
  14. Button,
  15. Icon,
  16. Body,
  17. Title,
  18. Text,
  19. Card,
  20. CardItem,
  21. Fab,
  22. Toast,
  23. Footer,
  24. H1,
  25. Root,
  26. Drawer,
  27. } from 'native-base';
  28.  
  29. export default class FetchProducts extends React.Component {
  30. constructor(props) {
  31. super(props);
  32. this.state = {isLoading: true};
  33. }
  34.  
  35. // componentDidMount() {
  36. // return fetch('http://167.99.3.52/products/')
  37. // .then(response => response.json())
  38. // .then(responseJson => {
  39. // this.setState(
  40. // {
  41. // isLoading: false,
  42. // dataSource: responseJson,
  43. // },
  44. // function() {},
  45. // );
  46. // })
  47. // .catch(error => {
  48. // console.error(error);
  49. // });
  50. // }
  51.  
  52. render() {
  53. return (
  54. <Root>
  55. <Container>
  56. <Header>
  57. <Left>
  58. <Button transparent>
  59. <Icon name="menu" />
  60. </Button>
  61. </Left>
  62. <Body>
  63. <Title>Home</Title>
  64. </Body>
  65. <Right>
  66. <Button transparent>
  67. <Icon name="search" />
  68. </Button>
  69. </Right>
  70. </Header>
  71.  
  72. <Content padder>
  73. <H1>Products</H1>
  74. <List>
  75. <ProductItem title="Morning Free" price="5775" />
  76. <ProductItem title="Development Onto" price="7334" />
  77. <ProductItem title="Mind Seek" price="5964" />
  78. </List>
  79. </Content>
  80. <Fab
  81. active={this.state.active}
  82. direction="up"
  83. containerStyle={{}}
  84. position="bottomRight"
  85. onPress={() =>
  86. Toast.show({
  87. text: 'Going to Cart!',
  88. buttonText: 'Okay',
  89. })
  90. }>
  91. <Icon type="FontAwesome" name="shopping-cart" />
  92. </Fab>
  93. </Container>
  94. </Root>
  95. );
  96. }
  97. }
  98.  
  99. class ProductItem extends React.Component {
  100. render() {
  101. return (
  102. <Card>
  103. <CardItem cardBody>
  104. <Image
  105. style={{width: 300, height: 300, flex: 1}}
  106. source={{
  107. uri:
  108. 'https://images.pexels.com/photos/67636/rose-blue-flower-rose-blooms-67636.jpeg?auto=compress&cs=tinysrgb&dpr=1&w=500',
  109. }}
  110. />
  111. </CardItem>
  112. <CardItem>
  113. <Body>
  114. <Text>{this.props.price}</Text>
  115. <Text>{this.props.title}</Text>
  116. </Body>
  117. </CardItem>
  118. </Card>
  119. );
  120. }
  121. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement