-
Notifications
You must be signed in to change notification settings - Fork 3.6k
/
SurveyScreen.tsx
93 lines (84 loc) · 2.41 KB
/
SurveyScreen.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
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
/**
* This is roughly based off Superhuman's PMF survey.
*/
import React from "react";
import {
MediumHeader,
HintHeader,
RoundedSelectorButton,
SubHeader,
} from "../../ui";
import ScreenProps from "../../ScreenProps";
import Constants from "expo-constants";
import { KeyboardAvoidingView, ScrollView, StatusBar } from "react-native";
import theme from "../../theme";
import haptic from "../../haptic";
import * as Haptic from "expo-haptics";
import { THOUGHT_SCREEN } from "../screens";
import { addTagsToUser } from "../../id";
import { userRecordedDisappointedSurvey } from "../../stats";
import { resetNavigationTo } from "../../resetNavigationTo";
export default class SurveyScreen extends React.Component<ScreenProps> {
static navigationOptions = {
header: null,
};
onChange = async (answer: string) => {
haptic.impact(Haptic.ImpactFeedbackStyle.Light);
// Record over time
userRecordedDisappointedSurvey(answer);
await addTagsToUser({
disappointedAnswer: answer,
});
resetNavigationTo(this.props.navigation, THOUGHT_SCREEN);
};
// From editing
onFinish = async () => {
haptic.impact(Haptic.ImpactFeedbackStyle.Light);
};
render() {
return (
<ScrollView
style={{
paddingTop: Constants.statusBarHeight + 24,
paddingHorizontal: 24,
backgroundColor: theme.lightOffwhite,
flex: 1,
}}
>
<KeyboardAvoidingView
behavior="position"
style={{
paddingBottom: 24,
}}
>
<StatusBar hidden={false} />
<MediumHeader
style={{
marginBottom: 24,
}}
>
One last thing...
</MediumHeader>
<SubHeader>
How would you feel if you could no longer use Quirk?
</SubHeader>
<HintHeader>
This is just for feedback purposes; Quirk isn't going anywhere.
</HintHeader>
<RoundedSelectorButton
title="Very Disappointed"
onPress={() => this.onChange("very")}
/>
<RoundedSelectorButton
title="Somewhat Disappointed"
onPress={() => this.onChange("somewhat")}
/>
<RoundedSelectorButton
title="Not Disappointed"
onPress={() => this.onChange("not")}
/>
</KeyboardAvoidingView>
</ScrollView>
);
}
}