Guest User

Untitled

a guest
Jan 21st, 2019
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.22 KB | None | 0 0
  1. import * as React from 'react';
  2. import { Text, View, StyleSheet } from 'react-native';
  3. import { Constants } from 'expo';
  4.  
  5. export default class App extends React.Component {
  6. productsArray = [
  7. 'Cajo T-shirt',
  8. 'Geometric Skull',
  9. 'Bavaria 350 mL',
  10. 'Inflatable Alien',
  11. 'R2D2 RC Car',
  12. ];
  13. renderCategories(arrayDeProdutos) {
  14. return arrayDeProdutos.map((index) => <Text key={index}></Text>);
  15. }
  16. render() {
  17. return (
  18. <View style={styles.container}>
  19. {this.renderCategories()}
  20. </View>
  21. );
  22. }
  23. }
  24. const styles = StyleSheet.create({
  25. container: {
  26. flex: 1,
  27. justifyContent: 'center',
  28. paddingTop: Constants.statusBarHeight,
  29. backgroundColor: '#ecf0f1',
  30. padding: 8,
  31. },
  32. });
  33.  
  34. render() {
  35. return (
  36. <View style={styles.container}>
  37. {this.productsArray.map((prod, index) => <Text key={index}>{prod}</Text>)}
  38. </View>
  39. );
  40. }
  41.  
  42. <View style={styles.container}>
  43. {this.renderCategories()}
  44. </View>
  45.  
  46. renderCategories(arrayDeProdutos) {
  47. return arrayDeProdutos.map((index) => <Text key={index}></Text>);
  48. }
  49. render() {
  50. return (
  51. <View style={styles.container}>
  52. {this.renderCategories(this.productsArray)}
  53. </View>
  54. );
  55. }
Add Comment
Please, Sign In to add comment