|
@@ -1,259 +1,269 @@
|
1
|
1
|
// @flow
|
2
|
2
|
|
3
|
3
|
import * as React from 'react';
|
4
|
|
-import * as Animatable from "react-native-animatable";
|
5
|
|
-import {Image, TouchableWithoutFeedback, View} from "react-native";
|
6
|
|
-import type {ViewStyle} from "react-native/Libraries/StyleSheet/StyleSheet";
|
|
4
|
+import * as Animatable from 'react-native-animatable';
|
|
5
|
+import {Image, TouchableWithoutFeedback, View} from 'react-native';
|
|
6
|
+import type {ViewStyle} from 'react-native/Libraries/StyleSheet/StyleSheet';
|
7
|
7
|
|
8
|
|
-type Props = {
|
9
|
|
- style?: ViewStyle,
|
10
|
|
- emotion: number,
|
11
|
|
- animated: boolean,
|
12
|
|
- entryAnimation: Animatable.AnimatableProperties | null,
|
13
|
|
- loopAnimation: Animatable.AnimatableProperties | null,
|
14
|
|
- onPress?: (viewRef: AnimatableViewRef) => null,
|
15
|
|
- onLongPress?: (viewRef: AnimatableViewRef) => null,
|
16
|
|
-}
|
|
8
|
+export type AnimatableViewRefType = {current: null | Animatable.View};
|
17
|
9
|
|
18
|
|
-type State = {
|
19
|
|
- currentEmotion: number,
|
20
|
|
-}
|
|
10
|
+type PropsType = {
|
|
11
|
+ emotion?: number,
|
|
12
|
+ animated?: boolean,
|
|
13
|
+ style?: ViewStyle | null,
|
|
14
|
+ entryAnimation?: Animatable.AnimatableProperties | null,
|
|
15
|
+ loopAnimation?: Animatable.AnimatableProperties | null,
|
|
16
|
+ onPress?: null | ((viewRef: AnimatableViewRefType) => void),
|
|
17
|
+ onLongPress?: null | ((viewRef: AnimatableViewRefType) => void),
|
|
18
|
+};
|
21
|
19
|
|
22
|
|
-export type AnimatableViewRef = {current: null | Animatable.View};
|
|
20
|
+type StateType = {
|
|
21
|
+ currentEmotion: number,
|
|
22
|
+};
|
23
|
23
|
|
24
|
|
-const MASCOT_IMAGE = require("../../../assets/mascot/mascot.png");
|
25
|
|
-const MASCOT_EYES_NORMAL = require("../../../assets/mascot/mascot_eyes_normal.png");
|
26
|
|
-const MASCOT_EYES_GIRLY = require("../../../assets/mascot/mascot_eyes_girly.png");
|
27
|
|
-const MASCOT_EYES_CUTE = require("../../../assets/mascot/mascot_eyes_cute.png");
|
28
|
|
-const MASCOT_EYES_WINK = require("../../../assets/mascot/mascot_eyes_wink.png");
|
29
|
|
-const MASCOT_EYES_HEART = require("../../../assets/mascot/mascot_eyes_heart.png");
|
30
|
|
-const MASCOT_EYES_ANGRY = require("../../../assets/mascot/mascot_eyes_angry.png");
|
31
|
|
-const MASCOT_GLASSES = require("../../../assets/mascot/mascot_glasses.png");
|
32
|
|
-const MASCOT_SUNGLASSES = require("../../../assets/mascot/mascot_sunglasses.png");
|
|
24
|
+const MASCOT_IMAGE = require('../../../assets/mascot/mascot.png');
|
|
25
|
+const MASCOT_EYES_NORMAL = require('../../../assets/mascot/mascot_eyes_normal.png');
|
|
26
|
+const MASCOT_EYES_GIRLY = require('../../../assets/mascot/mascot_eyes_girly.png');
|
|
27
|
+const MASCOT_EYES_CUTE = require('../../../assets/mascot/mascot_eyes_cute.png');
|
|
28
|
+const MASCOT_EYES_WINK = require('../../../assets/mascot/mascot_eyes_wink.png');
|
|
29
|
+const MASCOT_EYES_HEART = require('../../../assets/mascot/mascot_eyes_heart.png');
|
|
30
|
+const MASCOT_EYES_ANGRY = require('../../../assets/mascot/mascot_eyes_angry.png');
|
|
31
|
+const MASCOT_GLASSES = require('../../../assets/mascot/mascot_glasses.png');
|
|
32
|
+const MASCOT_SUNGLASSES = require('../../../assets/mascot/mascot_sunglasses.png');
|
33
|
33
|
|
34
|
34
|
export const EYE_STYLE = {
|
35
|
|
- NORMAL: 0,
|
36
|
|
- GIRLY: 2,
|
37
|
|
- CUTE: 3,
|
38
|
|
- WINK: 4,
|
39
|
|
- HEART: 5,
|
40
|
|
- ANGRY: 6,
|
41
|
|
-}
|
|
35
|
+ NORMAL: 0,
|
|
36
|
+ GIRLY: 2,
|
|
37
|
+ CUTE: 3,
|
|
38
|
+ WINK: 4,
|
|
39
|
+ HEART: 5,
|
|
40
|
+ ANGRY: 6,
|
|
41
|
+};
|
42
|
42
|
|
43
|
43
|
const GLASSES_STYLE = {
|
44
|
|
- NORMAL: 0,
|
45
|
|
- COOl: 1
|
46
|
|
-}
|
|
44
|
+ NORMAL: 0,
|
|
45
|
+ COOl: 1,
|
|
46
|
+};
|
47
|
47
|
|
48
|
48
|
export const MASCOT_STYLE = {
|
49
|
|
- NORMAL: 0,
|
50
|
|
- HAPPY: 1,
|
51
|
|
- GIRLY: 2,
|
52
|
|
- WINK: 3,
|
53
|
|
- CUTE: 4,
|
54
|
|
- INTELLO: 5,
|
55
|
|
- LOVE: 6,
|
56
|
|
- COOL: 7,
|
57
|
|
- ANGRY: 8,
|
58
|
|
- RANDOM: 999,
|
|
49
|
+ NORMAL: 0,
|
|
50
|
+ HAPPY: 1,
|
|
51
|
+ GIRLY: 2,
|
|
52
|
+ WINK: 3,
|
|
53
|
+ CUTE: 4,
|
|
54
|
+ INTELLO: 5,
|
|
55
|
+ LOVE: 6,
|
|
56
|
+ COOL: 7,
|
|
57
|
+ ANGRY: 8,
|
|
58
|
+ RANDOM: 999,
|
59
|
59
|
};
|
60
|
60
|
|
|
61
|
+class Mascot extends React.Component<PropsType, StateType> {
|
|
62
|
+ static defaultProps = {
|
|
63
|
+ emotion: MASCOT_STYLE.NORMAL,
|
|
64
|
+ animated: false,
|
|
65
|
+ style: null,
|
|
66
|
+ entryAnimation: {
|
|
67
|
+ useNativeDriver: true,
|
|
68
|
+ animation: 'rubberBand',
|
|
69
|
+ duration: 2000,
|
|
70
|
+ },
|
|
71
|
+ loopAnimation: {
|
|
72
|
+ useNativeDriver: true,
|
|
73
|
+ animation: 'swing',
|
|
74
|
+ duration: 2000,
|
|
75
|
+ iterationDelay: 250,
|
|
76
|
+ iterationCount: 'infinite',
|
|
77
|
+ },
|
|
78
|
+ onPress: null,
|
|
79
|
+ onLongPress: null,
|
|
80
|
+ };
|
61
|
81
|
|
62
|
|
-class Mascot extends React.Component<Props, State> {
|
63
|
|
-
|
64
|
|
- static defaultProps = {
|
65
|
|
- animated: false,
|
66
|
|
- entryAnimation: {
|
67
|
|
- useNativeDriver: true,
|
68
|
|
- animation: "rubberBand",
|
69
|
|
- duration: 2000,
|
70
|
|
- },
|
71
|
|
- loopAnimation: {
|
72
|
|
- useNativeDriver: true,
|
73
|
|
- animation: "swing",
|
74
|
|
- duration: 2000,
|
75
|
|
- iterationDelay: 250,
|
76
|
|
- iterationCount: "infinite",
|
77
|
|
- },
|
78
|
|
- clickAnimation: {
|
79
|
|
- useNativeDriver: true,
|
80
|
|
- animation: "rubberBand",
|
81
|
|
- duration: 2000,
|
82
|
|
- },
|
83
|
|
- }
|
|
82
|
+ viewRef: AnimatableViewRefType;
|
84
|
83
|
|
85
|
|
- viewRef: AnimatableViewRef;
|
86
|
|
- eyeList: { [key: number]: number | string };
|
87
|
|
- glassesList: { [key: number]: number | string };
|
|
84
|
+ eyeList: {[key: number]: number | string};
|
88
|
85
|
|
89
|
|
- onPress: (viewRef: AnimatableViewRef) => null;
|
90
|
|
- onLongPress: (viewRef: AnimatableViewRef) => null;
|
|
86
|
+ glassesList: {[key: number]: number | string};
|
91
|
87
|
|
92
|
|
- initialEmotion: number;
|
|
88
|
+ onPress: (viewRef: AnimatableViewRefType) => void;
|
93
|
89
|
|
94
|
|
- constructor(props: Props) {
|
95
|
|
- super(props);
|
96
|
|
- this.viewRef = React.createRef();
|
97
|
|
- this.eyeList = {};
|
98
|
|
- this.glassesList = {};
|
99
|
|
- this.eyeList[EYE_STYLE.NORMAL] = MASCOT_EYES_NORMAL;
|
100
|
|
- this.eyeList[EYE_STYLE.GIRLY] = MASCOT_EYES_GIRLY;
|
101
|
|
- this.eyeList[EYE_STYLE.CUTE] = MASCOT_EYES_CUTE;
|
102
|
|
- this.eyeList[EYE_STYLE.WINK] = MASCOT_EYES_WINK;
|
103
|
|
- this.eyeList[EYE_STYLE.HEART] = MASCOT_EYES_HEART;
|
104
|
|
- this.eyeList[EYE_STYLE.ANGRY] = MASCOT_EYES_ANGRY;
|
|
90
|
+ onLongPress: (viewRef: AnimatableViewRefType) => void;
|
105
|
91
|
|
106
|
|
- this.glassesList[GLASSES_STYLE.NORMAL] = MASCOT_GLASSES;
|
107
|
|
- this.glassesList[GLASSES_STYLE.COOl] = MASCOT_SUNGLASSES;
|
|
92
|
+ initialEmotion: number;
|
108
|
93
|
|
109
|
|
- this.initialEmotion = this.props.emotion;
|
|
94
|
+ constructor(props: PropsType) {
|
|
95
|
+ super(props);
|
|
96
|
+ this.viewRef = React.createRef();
|
|
97
|
+ this.eyeList = {};
|
|
98
|
+ this.glassesList = {};
|
|
99
|
+ this.eyeList[EYE_STYLE.NORMAL] = MASCOT_EYES_NORMAL;
|
|
100
|
+ this.eyeList[EYE_STYLE.GIRLY] = MASCOT_EYES_GIRLY;
|
|
101
|
+ this.eyeList[EYE_STYLE.CUTE] = MASCOT_EYES_CUTE;
|
|
102
|
+ this.eyeList[EYE_STYLE.WINK] = MASCOT_EYES_WINK;
|
|
103
|
+ this.eyeList[EYE_STYLE.HEART] = MASCOT_EYES_HEART;
|
|
104
|
+ this.eyeList[EYE_STYLE.ANGRY] = MASCOT_EYES_ANGRY;
|
110
|
105
|
|
111
|
|
- if (this.initialEmotion === MASCOT_STYLE.RANDOM)
|
112
|
|
- this.initialEmotion = Math.floor(Math.random() * MASCOT_STYLE.ANGRY) + 1;
|
|
106
|
+ this.glassesList[GLASSES_STYLE.NORMAL] = MASCOT_GLASSES;
|
|
107
|
+ this.glassesList[GLASSES_STYLE.COOl] = MASCOT_SUNGLASSES;
|
113
|
108
|
|
114
|
|
- this.state = {
|
115
|
|
- currentEmotion: this.initialEmotion
|
116
|
|
- }
|
|
109
|
+ this.initialEmotion =
|
|
110
|
+ props.emotion != null ? props.emotion : Mascot.defaultProps.emotion;
|
117
|
111
|
|
118
|
|
- if (this.props.onPress == null) {
|
119
|
|
- this.onPress = (viewRef: AnimatableViewRef) => {
|
120
|
|
- let ref = viewRef.current;
|
121
|
|
- if (ref != null) {
|
122
|
|
- this.setState({currentEmotion: MASCOT_STYLE.LOVE});
|
123
|
|
- ref.rubberBand(1500).then(() => {
|
124
|
|
- this.setState({currentEmotion: this.initialEmotion});
|
125
|
|
- });
|
|
112
|
+ if (this.initialEmotion === MASCOT_STYLE.RANDOM)
|
|
113
|
+ this.initialEmotion = Math.floor(Math.random() * MASCOT_STYLE.ANGRY) + 1;
|
126
|
114
|
|
127
|
|
- }
|
128
|
|
- return null;
|
129
|
|
- }
|
130
|
|
- } else
|
131
|
|
- this.onPress = this.props.onPress;
|
|
115
|
+ this.state = {
|
|
116
|
+ currentEmotion: this.initialEmotion,
|
|
117
|
+ };
|
132
|
118
|
|
133
|
|
- if (this.props.onLongPress == null) {
|
134
|
|
- this.onLongPress = (viewRef: AnimatableViewRef) => {
|
135
|
|
- let ref = viewRef.current;
|
136
|
|
- if (ref != null) {
|
137
|
|
- this.setState({currentEmotion: MASCOT_STYLE.ANGRY});
|
138
|
|
- ref.tada(1000).then(() => {
|
139
|
|
- this.setState({currentEmotion: this.initialEmotion});
|
140
|
|
- });
|
|
119
|
+ if (props.onPress == null) {
|
|
120
|
+ this.onPress = (viewRef: AnimatableViewRefType) => {
|
|
121
|
+ const ref = viewRef.current;
|
|
122
|
+ if (ref != null) {
|
|
123
|
+ this.setState({currentEmotion: MASCOT_STYLE.LOVE});
|
|
124
|
+ ref.rubberBand(1500).then(() => {
|
|
125
|
+ this.setState({currentEmotion: this.initialEmotion});
|
|
126
|
+ });
|
|
127
|
+ }
|
|
128
|
+ };
|
|
129
|
+ } else this.onPress = props.onPress;
|
141
|
130
|
|
142
|
|
- }
|
143
|
|
- return null;
|
144
|
|
- }
|
145
|
|
- } else
|
146
|
|
- this.onLongPress = this.props.onLongPress;
|
|
131
|
+ if (props.onLongPress == null) {
|
|
132
|
+ this.onLongPress = (viewRef: AnimatableViewRefType) => {
|
|
133
|
+ const ref = viewRef.current;
|
|
134
|
+ if (ref != null) {
|
|
135
|
+ this.setState({currentEmotion: MASCOT_STYLE.ANGRY});
|
|
136
|
+ ref.tada(1000).then(() => {
|
|
137
|
+ this.setState({currentEmotion: this.initialEmotion});
|
|
138
|
+ });
|
|
139
|
+ }
|
|
140
|
+ };
|
|
141
|
+ } else this.onLongPress = props.onLongPress;
|
|
142
|
+ }
|
147
|
143
|
|
148
|
|
- }
|
|
144
|
+ getGlasses(style: number): React.Node {
|
|
145
|
+ const glasses = this.glassesList[style];
|
|
146
|
+ return (
|
|
147
|
+ <Image
|
|
148
|
+ key="glasses"
|
|
149
|
+ source={
|
|
150
|
+ glasses != null ? glasses : this.glassesList[GLASSES_STYLE.NORMAL]
|
|
151
|
+ }
|
|
152
|
+ style={{
|
|
153
|
+ position: 'absolute',
|
|
154
|
+ top: '15%',
|
|
155
|
+ left: 0,
|
|
156
|
+ width: '100%',
|
|
157
|
+ height: '100%',
|
|
158
|
+ }}
|
|
159
|
+ />
|
|
160
|
+ );
|
|
161
|
+ }
|
149
|
162
|
|
150
|
|
- getGlasses(style: number) {
|
151
|
|
- const glasses = this.glassesList[style];
|
152
|
|
- return <Image
|
153
|
|
- key={"glasses"}
|
154
|
|
- source={glasses != null ? glasses : this.glassesList[GLASSES_STYLE.NORMAL]}
|
155
|
|
- style={{
|
156
|
|
- position: "absolute",
|
157
|
|
- top: "15%",
|
158
|
|
- left: 0,
|
159
|
|
- width: "100%",
|
160
|
|
- height: "100%",
|
161
|
|
- }}
|
162
|
|
- />
|
163
|
|
- }
|
|
163
|
+ getEye(
|
|
164
|
+ style: number,
|
|
165
|
+ isRight: boolean,
|
|
166
|
+ rotation: string = '0deg',
|
|
167
|
+ ): React.Node {
|
|
168
|
+ const eye = this.eyeList[style];
|
|
169
|
+ return (
|
|
170
|
+ <Image
|
|
171
|
+ key={isRight ? 'right' : 'left'}
|
|
172
|
+ source={eye != null ? eye : this.eyeList[EYE_STYLE.NORMAL]}
|
|
173
|
+ style={{
|
|
174
|
+ position: 'absolute',
|
|
175
|
+ top: '15%',
|
|
176
|
+ left: isRight ? '-11%' : '11%',
|
|
177
|
+ width: '100%',
|
|
178
|
+ height: '100%',
|
|
179
|
+ transform: [{rotateY: rotation}],
|
|
180
|
+ }}
|
|
181
|
+ />
|
|
182
|
+ );
|
|
183
|
+ }
|
164
|
184
|
|
165
|
|
- getEye(style: number, isRight: boolean, rotation: string="0deg") {
|
166
|
|
- const eye = this.eyeList[style];
|
167
|
|
- return <Image
|
168
|
|
- key={isRight ? "right" : "left"}
|
169
|
|
- source={eye != null ? eye : this.eyeList[EYE_STYLE.NORMAL]}
|
170
|
|
- style={{
|
171
|
|
- position: "absolute",
|
172
|
|
- top: "15%",
|
173
|
|
- left: isRight ? "-11%" : "11%",
|
174
|
|
- width: "100%",
|
175
|
|
- height: "100%",
|
176
|
|
- transform: [{rotateY: rotation}]
|
177
|
|
- }}
|
178
|
|
- />
|
|
185
|
+ getEyes(emotion: number): React.Node {
|
|
186
|
+ const final = [];
|
|
187
|
+ final.push(
|
|
188
|
+ <View
|
|
189
|
+ key="container"
|
|
190
|
+ style={{
|
|
191
|
+ position: 'absolute',
|
|
192
|
+ width: '100%',
|
|
193
|
+ height: '100%',
|
|
194
|
+ }}
|
|
195
|
+ />,
|
|
196
|
+ );
|
|
197
|
+ if (emotion === MASCOT_STYLE.CUTE) {
|
|
198
|
+ final.push(this.getEye(EYE_STYLE.CUTE, true));
|
|
199
|
+ final.push(this.getEye(EYE_STYLE.CUTE, false));
|
|
200
|
+ } else if (emotion === MASCOT_STYLE.GIRLY) {
|
|
201
|
+ final.push(this.getEye(EYE_STYLE.GIRLY, true));
|
|
202
|
+ final.push(this.getEye(EYE_STYLE.GIRLY, false));
|
|
203
|
+ } else if (emotion === MASCOT_STYLE.HAPPY) {
|
|
204
|
+ final.push(this.getEye(EYE_STYLE.WINK, true));
|
|
205
|
+ final.push(this.getEye(EYE_STYLE.WINK, false));
|
|
206
|
+ } else if (emotion === MASCOT_STYLE.WINK) {
|
|
207
|
+ final.push(this.getEye(EYE_STYLE.WINK, true));
|
|
208
|
+ final.push(this.getEye(EYE_STYLE.NORMAL, false));
|
|
209
|
+ } else if (emotion === MASCOT_STYLE.LOVE) {
|
|
210
|
+ final.push(this.getEye(EYE_STYLE.HEART, true));
|
|
211
|
+ final.push(this.getEye(EYE_STYLE.HEART, false));
|
|
212
|
+ } else if (emotion === MASCOT_STYLE.ANGRY) {
|
|
213
|
+ final.push(this.getEye(EYE_STYLE.ANGRY, true));
|
|
214
|
+ final.push(this.getEye(EYE_STYLE.ANGRY, false, '180deg'));
|
|
215
|
+ } else if (emotion === MASCOT_STYLE.COOL) {
|
|
216
|
+ final.push(this.getGlasses(GLASSES_STYLE.COOl));
|
|
217
|
+ } else {
|
|
218
|
+ final.push(this.getEye(EYE_STYLE.NORMAL, true));
|
|
219
|
+ final.push(this.getEye(EYE_STYLE.NORMAL, false));
|
179
|
220
|
}
|
180
|
221
|
|
181
|
|
- getEyes(emotion: number) {
|
182
|
|
- let final = [];
|
183
|
|
- final.push(<View
|
184
|
|
- key={"container"}
|
185
|
|
- style={{
|
186
|
|
- position: "absolute",
|
187
|
|
- width: "100%",
|
188
|
|
- height: "100%",
|
189
|
|
- }}/>);
|
190
|
|
- if (emotion === MASCOT_STYLE.CUTE) {
|
191
|
|
- final.push(this.getEye(EYE_STYLE.CUTE, true));
|
192
|
|
- final.push(this.getEye(EYE_STYLE.CUTE, false));
|
193
|
|
- } else if (emotion === MASCOT_STYLE.GIRLY) {
|
194
|
|
- final.push(this.getEye(EYE_STYLE.GIRLY, true));
|
195
|
|
- final.push(this.getEye(EYE_STYLE.GIRLY, false));
|
196
|
|
- } else if (emotion === MASCOT_STYLE.HAPPY) {
|
197
|
|
- final.push(this.getEye(EYE_STYLE.WINK, true));
|
198
|
|
- final.push(this.getEye(EYE_STYLE.WINK, false));
|
199
|
|
- } else if (emotion === MASCOT_STYLE.WINK) {
|
200
|
|
- final.push(this.getEye(EYE_STYLE.WINK, true));
|
201
|
|
- final.push(this.getEye(EYE_STYLE.NORMAL, false));
|
202
|
|
- } else if (emotion === MASCOT_STYLE.LOVE) {
|
203
|
|
- final.push(this.getEye(EYE_STYLE.HEART, true));
|
204
|
|
- final.push(this.getEye(EYE_STYLE.HEART, false));
|
205
|
|
- } else if (emotion === MASCOT_STYLE.ANGRY) {
|
206
|
|
- final.push(this.getEye(EYE_STYLE.ANGRY, true));
|
207
|
|
- final.push(this.getEye(EYE_STYLE.ANGRY, false, "180deg"));
|
208
|
|
- } else if (emotion === MASCOT_STYLE.COOL) {
|
209
|
|
- final.push(this.getGlasses(GLASSES_STYLE.COOl));
|
210
|
|
- } else {
|
211
|
|
- final.push(this.getEye(EYE_STYLE.NORMAL, true));
|
212
|
|
- final.push(this.getEye(EYE_STYLE.NORMAL, false));
|
213
|
|
- }
|
214
|
|
-
|
215
|
|
- if (emotion === MASCOT_STYLE.INTELLO) { // Needs to have normal eyes behind the glasses
|
216
|
|
- final.push(this.getGlasses(GLASSES_STYLE.NORMAL));
|
217
|
|
- }
|
218
|
|
- final.push(<View key={"container2"}/>);
|
219
|
|
- return final;
|
|
222
|
+ if (emotion === MASCOT_STYLE.INTELLO) {
|
|
223
|
+ // Needs to have normal eyes behind the glasses
|
|
224
|
+ final.push(this.getGlasses(GLASSES_STYLE.NORMAL));
|
220
|
225
|
}
|
|
226
|
+ final.push(<View key="container2" />);
|
|
227
|
+ return final;
|
|
228
|
+ }
|
221
|
229
|
|
222
|
|
- render() {
|
223
|
|
- const entryAnimation = this.props.animated ? this.props.entryAnimation : null;
|
224
|
|
- const loopAnimation = this.props.animated ? this.props.loopAnimation : null;
|
225
|
|
- return (
|
|
230
|
+ render(): React.Node {
|
|
231
|
+ const {props, state} = this;
|
|
232
|
+ const entryAnimation = props.animated ? props.entryAnimation : null;
|
|
233
|
+ const loopAnimation = props.animated ? props.loopAnimation : null;
|
|
234
|
+ return (
|
|
235
|
+ <Animatable.View
|
|
236
|
+ style={{
|
|
237
|
+ aspectRatio: 1,
|
|
238
|
+ ...props.style,
|
|
239
|
+ }}
|
|
240
|
+ // eslint-disable-next-line react/jsx-props-no-spreading
|
|
241
|
+ {...entryAnimation}>
|
|
242
|
+ <TouchableWithoutFeedback
|
|
243
|
+ onPress={() => {
|
|
244
|
+ this.onPress(this.viewRef);
|
|
245
|
+ }}
|
|
246
|
+ onLongPress={() => {
|
|
247
|
+ this.onLongPress(this.viewRef);
|
|
248
|
+ }}>
|
|
249
|
+ <Animatable.View ref={this.viewRef}>
|
226
|
250
|
<Animatable.View
|
|
251
|
+ // eslint-disable-next-line react/jsx-props-no-spreading
|
|
252
|
+ {...loopAnimation}>
|
|
253
|
+ <Image
|
|
254
|
+ source={MASCOT_IMAGE}
|
227
|
255
|
style={{
|
228
|
|
- aspectRatio: 1,
|
229
|
|
- ...this.props.style
|
|
256
|
+ width: '100%',
|
|
257
|
+ height: '100%',
|
230
|
258
|
}}
|
231
|
|
- {...entryAnimation}
|
232
|
|
- >
|
233
|
|
- <TouchableWithoutFeedback
|
234
|
|
- onPress={() => this.onPress(this.viewRef)}
|
235
|
|
- onLongPress={() => this.onLongPress(this.viewRef)}
|
236
|
|
- >
|
237
|
|
- <Animatable.View
|
238
|
|
- ref={this.viewRef}
|
239
|
|
- >
|
240
|
|
- <Animatable.View
|
241
|
|
- {...loopAnimation}
|
242
|
|
- >
|
243
|
|
- <Image
|
244
|
|
- source={MASCOT_IMAGE}
|
245
|
|
- style={{
|
246
|
|
- width: "100%",
|
247
|
|
- height:"100%",
|
248
|
|
- }}
|
249
|
|
- />
|
250
|
|
- {this.getEyes(this.state.currentEmotion)}
|
251
|
|
- </Animatable.View>
|
252
|
|
- </Animatable.View>
|
253
|
|
- </TouchableWithoutFeedback>
|
|
259
|
+ />
|
|
260
|
+ {this.getEyes(state.currentEmotion)}
|
254
|
261
|
</Animatable.View>
|
255
|
|
- );
|
256
|
|
- }
|
|
262
|
+ </Animatable.View>
|
|
263
|
+ </TouchableWithoutFeedback>
|
|
264
|
+ </Animatable.View>
|
|
265
|
+ );
|
|
266
|
+ }
|
257
|
267
|
}
|
258
|
268
|
|
259
|
269
|
export default Mascot;
|