-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathApp.js
More file actions
115 lines (107 loc) · 3.01 KB
/
App.js
File metadata and controls
115 lines (107 loc) · 3.01 KB
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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
import React, { Component, StyleSheet } from "react";
import {
TouchableOpacity,
Text,
View,
TextInput,
KeyboardAvoidingView
} from "react-native";
import Tags from "react-native-tags";
import { HeaderScreen } from "./screens/header";
import { KeyboardAwareScrollView } from "react-native-keyboard-aware-scroll-view";
class App extends Component {
constructor(props) {
super(props);
this.state = {
text: "",
mytags: []
};
}
getTags = () => {
const question = this.state.text;
this.setState({
mytags: []
});
// fetch("https://api.myjson.com/bins/129gwo")
fetch("https://overcode-tag-ml-api.herokuapp.com/?q=" + question)
.then(response => response.json())
.then(json => {
console.log("Question: ", question);
this.setState({
mytags: [...this.state.mytags, ...json.tags]
});
})
.catch(e => console.log("error" + e));
};
render() {
return (
<View style={{ flex: 1 }}>
<KeyboardAwareScrollView
enableOnAndroid={true}
enableAutomaticScroll={true}
>
<HeaderScreen />
<View style={{ paddingTop: 50, margin: 15 }}>
<TextInput
placeholder="Title"
style={{
borderColor: "#7B8788",
padding: 10,
borderWidth: 1,
borderRadius: 5,
height: 40,
margin: 10
}}
autoCorrect={false}
autoCapitalize="none"
keyboardType="default"
onChangeText={text => {
this.setState({ text });
}}
onEndEditing={text => this.getTags()}
value={this.state.text}
/>
<TextInput
placeholder="Description"
style={{
borderColor: "#7B8788",
padding: 10,
borderWidth: 1,
borderRadius: 5,
height: 100,
margin: 8
}}
multiline={true}
autoCorrect={false}
autoCapitalize="none"
keyboardType="default"
/>
<Tags
initialText=""
initialTags={this.state.mytags}
onChangeTags={tags => console.log(tags)}
onTagPress={(index, tagLabel, event) =>
console.log(index, tagLabel, event)
}
inputStyle={{
backgroundColor: "#EAF0F1",
color: "#2F363F",
borderRadius: 10
}}
/>
</View>
</KeyboardAwareScrollView>
</View>
);
}
}
// const UselessComponent = () => (
// <Tags
// initialText="monkey"
// initialTags={['js']}
// onChangeTags={tags => console.log(tags)}
// onTagPress={(index, tagLabel, event) => console.log(index, tagLabel, event)}
// inputStyle={{ backgroundColor: "white" }}
// />
// );
export default App;