Advertisement
Guest User

Untitled

a guest
Feb 21st, 2020
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import React from 'react'
  2. import PropTypes from 'prop-types'
  3. import {
  4.   View, Text, Picker, StyleSheet, Platform
  5. } from 'react-native'
  6. import Icon from 'react-native-vector-icons/FontAwesome'
  7.  
  8. import { colors } from '../../../config'
  9.  
  10. const styles = StyleSheet.create({
  11.   selectEventsContainer: {
  12.     alignSelf: 'stretch',
  13.     marginBottom: 24,
  14.   },
  15.   selectEventsText: {
  16.     ...Platform.select({
  17.       android: {
  18.         fontFamily: 'Roboto',
  19.       },
  20.       ios: {
  21.         fontFamily: 'San Francisco',
  22.       },
  23.     }),
  24.     color: colors.greyDark,
  25.     fontSize: 14,
  26.     fontWeight: '400',
  27.     marginBottom: 12,
  28.   },
  29.   pickerContainer: {
  30.     position: 'relative',
  31.   },
  32.   pickerIcon: {
  33.     position: 'absolute',
  34.     right: 12,
  35.     top: 50 / 2 - 5,
  36.     zIndex: 9999,
  37.   },
  38.   picker: {
  39.     ...Platform.select({
  40.       android: {
  41.         fontFamily: 'Roboto',
  42.       },
  43.       ios: {
  44.         fontFamily: 'San Francisco',
  45.       },
  46.     }),
  47.     height: 50,
  48.     alignSelf: 'stretch',
  49.     backgroundColor: '#F9F9F9',
  50.     zIndex: 9998,
  51.     color: colors.greyDark,
  52.   },
  53. })
  54.  
  55. const SelectOtherEventType = ({ selectedValue, onValueChange, disabled }) => (
  56.   <View style={styles.selectEventsContainer}>
  57.     <Text style={styles.selectEventsText}>
  58.       {`Event type ${!disabled ? '*' : ''}`}
  59.     </Text>
  60.     <View style={styles.pickerContainer}>
  61.       {!disabled && (
  62.         <Icon
  63.           name="chevron-down"
  64.           size={10}
  65.           color={colors.greyDark}
  66.           style={styles.pickerIcon}
  67.         />
  68.       )}
  69.       <Picker
  70.         style={styles.picker}
  71.         selectedValue={selectedValue}
  72.         onValueChange={onValueChange}
  73.         prompt="Event types"
  74.         mode="dialog"
  75.         enabled={!disabled}
  76.       >
  77.         <Picker.Item label="Damaged container" value="Damaged container" />
  78.         <Picker.Item label="Dirty container" value="Dirty container" />
  79.         <Picker.Item label="Bad smell container" value="Bad smell container" />
  80.         <Picker.Item label="Fumigation ON" value="Fumigation ON" />
  81.         <Picker.Item label="Fumigation OFF" value="Fumigation OFF" />
  82.         <Picker.Item label="Other/Misc." value="Other/Misc." />
  83.       </Picker>
  84.     </View>
  85.   </View>
  86. )
  87.  
  88. SelectOtherEventType.propTypes = {
  89.   selectedValue: PropTypes.string,
  90.   onValueChange: PropTypes.func,
  91.   disabled: PropTypes.bool,
  92. }
  93.  
  94. SelectOtherEventType.defaultProps = {
  95.   selectedValue: null,
  96.   onValueChange: () => {},
  97.   disabled: false,
  98. }
  99.  
  100. export { SelectOtherEventType }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement