Advertisement
Guest User

Untitled

a guest
Oct 15th, 2019
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.63 KB | None | 0 0
  1. import React, { Component } from 'react';
  2. import { StyleSheet, FlatList, View, Text, TouchableHighlight } from 'react-native';
  3.  
  4. const availableZipItems = [
  5. { select: 'pembroke' },
  6. { select: 'beagle' },
  7. { select: 'husky' },
  8. { select: 'pomeranian' },
  9. { select: 'doberman' },
  10. { select: 'pug' },
  11. { select: 'dachshund' },
  12. { select: 'mix' },
  13. { select: 'entlebucher' },
  14. { select: 'keeshond' },
  15. ]
  16. const ZipItem = ({ select, navigate }) => (
  17. <TouchableHighlight onPress={() => navigate('Data', { selects: select })}>
  18. <View style={styles.backgrund}>
  19. <Text style={styles.select}>{select}</Text>
  20. </View>
  21. </TouchableHighlight>
  22. )
  23. const _keyExtractor = item => item.select
  24.  
  25. export default class SelectScreen extends Component {
  26. static navigationOptions = ({ navigation }) => {
  27. return {
  28. headerTitle: (
  29. <Text>
  30. Choose a zip code
  31. </Text>),
  32. }
  33. }
  34. render() {
  35. const { navigate } = this.props.navigation;
  36. return (
  37. <View>
  38. <FlatList
  39. data={availableZipItems}
  40. keyExtractor={_keyExtractor}
  41. renderItem={({ item }) => <ZipItem {...item} navigate={navigate} />}
  42. />
  43. </View>
  44. );
  45. }
  46. }
  47.  
  48. const styles = StyleSheet.create({
  49. select: {
  50. fontSize: 20,
  51. fontWeight: 'bold',
  52. textAlign: 'center'
  53. },
  54. backgrund:{
  55. backgroundColor: '#0099FF',
  56. borderRadius: 10,
  57. marginTop:20,
  58. marginLeft: 80,
  59. marginRight:80,
  60. padding: 10
  61.  
  62. }
  63. })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement