-
Notifications
You must be signed in to change notification settings - Fork 1
/
KeywordsPage.js
115 lines (93 loc) · 3.19 KB
/
KeywordsPage.js
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 from 'react';
import { View, Text, Button, TextInput, StyleSheet, ScrollView } from 'react-native';
import { StackActions, NavigationActions } from 'react-navigation';
import * as constants from "./CONSTANTS"
import AsyncStorage from '@react-native-community/async-storage';
import * as arrayMaker from './getstrings'
export default class KeywordsPage extends React.Component {
state = {input1: "", input2: ""}
constructor(props) {
super(props);
this.storeData = this.storeData.bind(this);
}
render() {
return (
<ScrollView style={styles.scrollView}>
<View style={{ flex: 1, alignItems: 'center', justifyContent: 'center' }}>
<Text style ={{marginBottom: 10, fontSize: 40}}>
PreCursor
</Text>
<Text style ={{marginBottom: 40}}>
Please select two keywords that make you uncomfortable
</Text>
<Text style ={{marginBottom: 10}}>
One Concept
</Text>
<TextInput
style = {{borderRadius: 4,borderWidth: 0.5, borderColor: '#d6d7da', width: "80%", marginBottom: 30}}
multiline
numberOfLines={6}
editable
value = {this.state.input1}
onChangeText={(text) => this.setState(previousState => (
{input1: text }))}
/>
<Text style ={{marginBottom: 10}}>
One Specific Word (like a names)
</Text>
<TextInput
style = {{borderRadius: 4,borderWidth: 0.5, borderColor: '#d6d7da', width: "80%", marginBottom: 30}}
multiline
numberOfLines={6}
editable
value = {this.state.input2}
onChangeText={(text) => this.setState(previousState => (
{input2: text }))}
/>
<Button
style = {{marginBottom: 30}}
title="Next"
color = {constants.mainButtonColor}
onPress={ this.storeData }
/>
<Button
title="Skip"
color = {constants.mainButtonColor}
onPress={() => this.props.navigation.navigate("SamplePages") }
/>
</View>
</ScrollView>
);
}
async storeData () {
var nameobjectlist = []
var singularConcept = this.state.input1.split("\n")[0];
var i;
let stringList = []
let weightList = []
await arrayMaker.getString(singularConcept, "words")
.then(res => {
stringList = res
})
await arrayMaker.getString(singularConcept, "weights")
.then(res => {
weightList = res;
})
for (var ii = 0; ii < stringList.length; ii++) {
nameobjectlist.push({word: stringList[ii], weight: weightList[ii]})
}
var specificwordlist = this.state.input2.split("\n")[0]
stringList.push(specificwordlist[i])
stringList.push(singularConcept)
nameobjectlist.push({word: specificwordlist[i], weight: 100})
this.props.navigation.navigate("SamplePages", {words: stringList})
}
}
const styles = StyleSheet.create({
scrollView: {
marginHorizontal: 10,
},
text: {
fontSize: 42,
},
});