|
1 | 1 | import React from 'react'; |
2 | | -import { Text as RNText, StyleSheet, View, ViewPropTypes } from 'react-native'; |
| 2 | +import { |
| 3 | + Text as RNText, |
| 4 | + StyleSheet, |
| 5 | + View, |
| 6 | + TouchableOpacity, |
| 7 | + ViewPropTypes, |
| 8 | +} from 'react-native'; |
3 | 9 | import PropTypes from 'prop-types'; |
4 | 10 | import { createStyles, maxWidth } from './media-query'; |
5 | 11 | import Text from './text'; |
| 12 | +import ArrowDownIcon from '../asset/icon/arrow-down'; |
6 | 13 | import { TextInput, HorizontalExpandingTextInput } from './input'; |
7 | 14 | import { color, font, breakWidth } from './style'; |
8 | 15 |
|
@@ -100,6 +107,43 @@ NamedField.propTypes = { |
100 | 107 | style: ViewPropTypes.style, |
101 | 108 | }; |
102 | 109 |
|
| 110 | +// |
| 111 | +// Named Field Select |
| 112 | +// |
| 113 | + |
| 114 | +const namedSelectStyles = StyleSheet.create({ |
| 115 | + touchable: { |
| 116 | + flexDirection: 'row', |
| 117 | + alignItems: 'center', |
| 118 | + marginRight: 15, |
| 119 | + }, |
| 120 | + name: { |
| 121 | + color: color.blackText, |
| 122 | + fontSize: font.sizeM, |
| 123 | + lineHeight: font.lineHeightM + 2 * 12, |
| 124 | + marginRight: 3, |
| 125 | + }, |
| 126 | +}); |
| 127 | + |
| 128 | +export const NamedFieldSelect = ({ onPress, name, children, style }) => ( |
| 129 | + <View style={[namedStyles.content, style]}> |
| 130 | + <TouchableOpacity style={namedSelectStyles.touchable} onPress={onPress}> |
| 131 | + <Text style={namedSelectStyles.name}>{name}</Text> |
| 132 | + <ArrowDownIcon height={22} width={22} stroke="#4A4A4A" /> |
| 133 | + </TouchableOpacity> |
| 134 | + <Text style={namedStyles.text} numberOfLines={1}> |
| 135 | + {children} |
| 136 | + </Text> |
| 137 | + </View> |
| 138 | +); |
| 139 | + |
| 140 | +NamedFieldSelect.propTypes = { |
| 141 | + onPress: PropTypes.func.isRequired, |
| 142 | + name: PropTypes.string, |
| 143 | + children: PropTypes.oneOfType([PropTypes.string, PropTypes.array]), |
| 144 | + style: ViewPropTypes.style, |
| 145 | +}; |
| 146 | + |
103 | 147 | // |
104 | 148 | // Detail Field |
105 | 149 | // |
|
0 commit comments