-
Notifications
You must be signed in to change notification settings - Fork 8
/
demo.tsx
66 lines (59 loc) · 1.68 KB
/
demo.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
import React, { useState } from 'react';
import { SafeAreaView, StyleSheet, View, Text } from 'react-native';
// import AutocompleteTags from 'react-native-autocomplete-tags';
import AutocompleteTags from '../index';
type Suggestion = {
name: string;
email: string;
};
const suggestions = [
{ name: 'Boris Yeltsin', email: 'boris.yeltsin@abc.com ' },
{ name: 'Tom Boboby', email: 'tom.boboy@abc.com' },
];
const Demo = () => {
const [tags, setTags] = useState<Suggestion[]>([
{ name: 'Fred Hendriks', email: 'fred.hendricks@abc.com' },
]);
const onAddNewTag = (input: string) => {
setTags((tags) => [...tags, { name: input, email: input }]);
};
return (
<SafeAreaView style={styles.container}>
<View style={styles.rowContainer}>
<Text>Subject: DEMO</Text>
</View>
<View style={[styles.rowContainer, { zIndex: 2000 }]}>
<Text>To: </Text>
<AutocompleteTags
tags={tags}
suggestions={suggestions}
labelExtractor={(item) => item.name}
suggestionExtractor={(item) => item.email}
onChangeTags={(tags) => setTags(tags)}
onAddNewTag={onAddNewTag}
inputProps={{
autoCapitalize: 'none',
autoCorrect: false,
}}
containerStyle={{ backgroundColor: 'yellow' }}
/>
</View>
<View style={styles.rowContainer}>
<Text>Body:</Text>
</View>
</SafeAreaView>
);
};
const styles = StyleSheet.create({
container: {
flex: 1,
},
rowContainer: {
flexDirection: 'row',
alignItems: 'flex-start',
borderBottomColor: '#262626',
borderBottomWidth: 0.5,
padding: 8,
},
});
export default Demo;