Skip to content
This repository was archived by the owner on Feb 23, 2021. It is now read-only.

Commit 2663c66

Browse files
committed
Implement Named Field Select
1 parent 6f89cac commit 2663c66

File tree

1 file changed

+45
-1
lines changed

1 file changed

+45
-1
lines changed

src/component/field.js

Lines changed: 45 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,15 @@
11
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';
39
import PropTypes from 'prop-types';
410
import { createStyles, maxWidth } from './media-query';
511
import Text from './text';
12+
import ArrowDownIcon from '../asset/icon/arrow-down';
613
import { TextInput, HorizontalExpandingTextInput } from './input';
714
import { color, font, breakWidth } from './style';
815

@@ -100,6 +107,43 @@ NamedField.propTypes = {
100107
style: ViewPropTypes.style,
101108
};
102109

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+
103147
//
104148
// Detail Field
105149
//

0 commit comments

Comments
 (0)