Skip to content

Commit de5f4fe

Browse files
committed
WIP
1 parent 6d99c0e commit de5f4fe

File tree

22 files changed

+879
-771
lines changed

22 files changed

+879
-771
lines changed
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
import React from 'react';
2+
import { View, TextInput, TouchableOpacity, Platform, Text } from 'react-native';
3+
import Ionicons from "react-native-vector-icons/Ionicons";
4+
import { SearchIcon } from '../search-icon';
5+
import { ColorsPack } from '../../styles/colors.enum';
6+
import styles from './styles';
7+
8+
interface Props {
9+
searchTerm: string;
10+
hideSubmitButton: boolean;
11+
singleSelection: boolean;
12+
onChangeSearchTerm: (searchTerm: string) => void;
13+
onSubmitEditing: () => void;
14+
onSubmitButtonPress: () => void;
15+
children: React.ReactElement;
16+
}
17+
18+
export class ExpandedMultiSelectView extends React.Component<Props> {
19+
render() {
20+
const {
21+
searchTerm,
22+
hideSubmitButton,
23+
singleSelection,
24+
onChangeSearchTerm,
25+
onSubmitEditing,
26+
onSubmitButtonPress,
27+
children
28+
} = this.props;
29+
return (
30+
<View style={styles.container}>
31+
<View style={styles.inputGroup}>
32+
<SearchIcon />
33+
<TextInput
34+
autoFocus
35+
onChangeText={(searchTerm: string) => onChangeSearchTerm(searchTerm)}
36+
onSubmitEditing={() => onSubmitEditing()}
37+
placeholder="Search"
38+
placeholderTextColor={ColorsPack.placeholderTextColor}
39+
underlineColorAndroid="transparent"
40+
style={styles.searchInput}
41+
value={searchTerm}
42+
/>
43+
{hideSubmitButton && (
44+
<TouchableOpacity onPress={onSubmitButtonPress}>
45+
<Ionicons
46+
name={Platform.OS === 'ios' ? 'ios-caret-down-outline' : 'md-caret-down-outline'}
47+
style={styles.indicator}
48+
/>
49+
</TouchableOpacity>
50+
)}
51+
</View>
52+
<View style={styles.expandedItemsContainer}>
53+
{children}
54+
{!singleSelection && !hideSubmitButton && (
55+
<TouchableOpacity onPress={onSubmitButtonPress} style={styles.submitButton}>
56+
<Text style={styles.submitButtonText}>
57+
Submit
58+
</Text>
59+
</TouchableOpacity>
60+
)}
61+
</View>
62+
</View>
63+
);
64+
}
65+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export * from './ExpandedMultiSelectView';
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
import { StyleSheet } from 'react-native';
2+
import { ColorsPack } from '../../styles/colors.enum';
3+
4+
export default StyleSheet.create({
5+
container: {
6+
height: 250,
7+
marginBottom: 10,
8+
elevation: 2
9+
},
10+
inputGroup: {
11+
flexDirection: 'row',
12+
alignItems: 'center',
13+
paddingLeft: 16,
14+
backgroundColor: ColorsPack.backgroundColor
15+
},
16+
searchInput: {
17+
flex: 1
18+
},
19+
indicator: {
20+
fontSize: 30,
21+
color: ColorsPack.placeholderTextColor,
22+
},
23+
expandedItemsContainer: {
24+
flexDirection: 'column',
25+
backgroundColor: '#fafafa'
26+
},
27+
submitButton: {
28+
height: 40,
29+
flexDirection: 'row',
30+
justifyContent: 'center',
31+
alignItems: 'center',
32+
backgroundColor: ColorsPack.primary
33+
},
34+
submitButtonText: {
35+
color: ColorsPack.light,
36+
fontSize: 14,
37+
},
38+
});

0 commit comments

Comments
 (0)