@coorpacademy/components 11.0.0 → 11.0.2-alpha.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es/atom/picture/index.js +5 -8
- package/es/atom/picture/index.js.map +1 -1
- package/es/molecule/card-congrats/index.native.d.ts.map +1 -1
- package/es/molecule/card-congrats/index.native.js.map +1 -1
- package/es/molecule/discipline-partners/index.js +2 -1
- package/es/molecule/discipline-partners/index.js.map +1 -1
- package/es/molecule/discipline-scope/index.d.ts +1 -0
- package/es/molecule/forum/forum-comment/index.d.ts +1 -0
- package/es/molecule/forum/forum-comment/index.d.ts.map +1 -1
- package/es/molecule/forum/forum-comment/index.js +5 -2
- package/es/molecule/forum/forum-comment/index.js.map +1 -1
- package/es/molecule/forum/forum-post/index.d.ts +2 -0
- package/es/molecule/forum/forum-post/index.d.ts.map +1 -1
- package/es/molecule/forum/forum-post/index.js +8 -1
- package/es/molecule/forum/forum-post/index.js.map +1 -1
- package/es/molecule/review-correction-popin/index.native.d.ts.map +1 -1
- package/es/molecule/review-correction-popin/index.native.js +8 -9
- package/es/molecule/review-correction-popin/index.native.js.map +1 -1
- package/es/molecule/scope-content/index.d.ts +1 -0
- package/es/organism/discussion/index.d.ts +1 -0
- package/es/organism/discussion/index.d.ts.map +1 -1
- package/es/organism/discussion/index.js +4 -1
- package/es/organism/discussion/index.js.map +1 -1
- package/es/organism/review-congrats/index.native.d.ts.map +1 -1
- package/es/organism/review-congrats/index.native.js +60 -67
- package/es/organism/review-congrats/index.native.js.map +1 -1
- package/es/organism/review-slide/index.native.d.ts.map +1 -1
- package/es/organism/review-slide/index.native.js +4 -3
- package/es/organism/review-slide/index.native.js.map +1 -1
- package/es/organism/review-stacked-slides/index.native.d.ts.map +1 -1
- package/es/organism/review-stacked-slides/index.native.js +4 -7
- package/es/organism/review-stacked-slides/index.native.js.map +1 -1
- package/es/template/app-player/popin-end/index.d.ts +1 -0
- package/es/template/app-player/popin-end/summary.d.ts +1 -0
- package/es/template/common/discipline/index.d.ts +1 -0
- package/lib/atom/picture/index.js +5 -8
- package/lib/atom/picture/index.js.map +1 -1
- package/lib/molecule/card-congrats/index.native.d.ts.map +1 -1
- package/lib/molecule/card-congrats/index.native.js.map +1 -1
- package/lib/molecule/discipline-partners/index.js +2 -1
- package/lib/molecule/discipline-partners/index.js.map +1 -1
- package/lib/molecule/discipline-scope/index.d.ts +1 -0
- package/lib/molecule/forum/forum-comment/index.d.ts +1 -0
- package/lib/molecule/forum/forum-comment/index.d.ts.map +1 -1
- package/lib/molecule/forum/forum-comment/index.js +5 -2
- package/lib/molecule/forum/forum-comment/index.js.map +1 -1
- package/lib/molecule/forum/forum-post/index.d.ts +2 -0
- package/lib/molecule/forum/forum-post/index.d.ts.map +1 -1
- package/lib/molecule/forum/forum-post/index.js +8 -1
- package/lib/molecule/forum/forum-post/index.js.map +1 -1
- package/lib/molecule/review-correction-popin/index.native.d.ts.map +1 -1
- package/lib/molecule/review-correction-popin/index.native.js +9 -10
- package/lib/molecule/review-correction-popin/index.native.js.map +1 -1
- package/lib/molecule/scope-content/index.d.ts +1 -0
- package/lib/organism/discussion/index.d.ts +1 -0
- package/lib/organism/discussion/index.d.ts.map +1 -1
- package/lib/organism/discussion/index.js +4 -1
- package/lib/organism/discussion/index.js.map +1 -1
- package/lib/organism/review-congrats/index.native.d.ts.map +1 -1
- package/lib/organism/review-congrats/index.native.js +60 -68
- package/lib/organism/review-congrats/index.native.js.map +1 -1
- package/lib/organism/review-slide/index.native.d.ts.map +1 -1
- package/lib/organism/review-slide/index.native.js +5 -4
- package/lib/organism/review-slide/index.native.js.map +1 -1
- package/lib/organism/review-stacked-slides/index.native.d.ts.map +1 -1
- package/lib/organism/review-stacked-slides/index.native.js +5 -8
- package/lib/organism/review-stacked-slides/index.native.js.map +1 -1
- package/lib/template/app-player/popin-end/index.d.ts +1 -0
- package/lib/template/app-player/popin-end/summary.d.ts +1 -0
- package/lib/template/common/discipline/index.d.ts +1 -0
- package/package.json +3 -2
- package/es/behaviours/use-translate-vertically.native.d.ts +0 -16
- package/es/behaviours/use-translate-vertically.native.d.ts.map +0 -1
- package/es/behaviours/use-translate-vertically.native.js +0 -44
- package/es/behaviours/use-translate-vertically.native.js.map +0 -1
- package/es/behaviours/use-update-opacity.native.d.ts +0 -14
- package/es/behaviours/use-update-opacity.native.d.ts.map +0 -1
- package/es/behaviours/use-update-opacity.native.js +0 -55
- package/es/behaviours/use-update-opacity.native.js.map +0 -1
- package/lib/behaviours/use-translate-vertically.native.d.ts +0 -16
- package/lib/behaviours/use-translate-vertically.native.d.ts.map +0 -1
- package/lib/behaviours/use-translate-vertically.native.js +0 -51
- package/lib/behaviours/use-translate-vertically.native.js.map +0 -1
- package/lib/behaviours/use-update-opacity.native.d.ts +0 -14
- package/lib/behaviours/use-update-opacity.native.d.ts.map +0 -1
- package/lib/behaviours/use-update-opacity.native.js +0 -62
- package/lib/behaviours/use-update-opacity.native.js.map +0 -1
|
@@ -13,6 +13,8 @@ var _lottieReactNative = _interopRequireDefault(require("lottie-react-native"));
|
|
|
13
13
|
|
|
14
14
|
var _novaIcons = require("@coorpacademy/nova-icons");
|
|
15
15
|
|
|
16
|
+
var _reactNativeAnimation = require("@coorpacademy/react-native-animation");
|
|
17
|
+
|
|
16
18
|
var _templateContext = require("../../template/app-review/template-context");
|
|
17
19
|
|
|
18
20
|
var _index = _interopRequireDefault(require("../../atom/button/index.native"));
|
|
@@ -21,10 +23,6 @@ var _shadow = require("../../variables/shadow");
|
|
|
21
23
|
|
|
22
24
|
var _index2 = _interopRequireDefault(require("../../molecule/card-congrats/index.native"));
|
|
23
25
|
|
|
24
|
-
var _useTranslateVertically = _interopRequireDefault(require("../../behaviours/use-translate-vertically.native"));
|
|
25
|
-
|
|
26
|
-
var _useUpdateOpacity = _interopRequireDefault(require("../../behaviours/use-update-opacity.native"));
|
|
27
|
-
|
|
28
26
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
29
27
|
|
|
30
28
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
@@ -73,6 +71,19 @@ const createStyleSheet = theme => _reactNative.StyleSheet.create({
|
|
|
73
71
|
}
|
|
74
72
|
});
|
|
75
73
|
|
|
74
|
+
const fadeIn = {
|
|
75
|
+
property: 'opacity',
|
|
76
|
+
fromValue: 0,
|
|
77
|
+
toValue: 1,
|
|
78
|
+
duration: 350
|
|
79
|
+
};
|
|
80
|
+
const translateHorizontally = {
|
|
81
|
+
property: 'translateX',
|
|
82
|
+
fromValue: 180,
|
|
83
|
+
toValue: 0,
|
|
84
|
+
duration: 800
|
|
85
|
+
};
|
|
86
|
+
|
|
76
87
|
const ReviewCongrats = props => {
|
|
77
88
|
const {
|
|
78
89
|
'aria-label': ariaLabel,
|
|
@@ -86,76 +97,53 @@ const ReviewCongrats = props => {
|
|
|
86
97
|
const {
|
|
87
98
|
theme
|
|
88
99
|
} = (0, _templateContext.useTemplateContext)();
|
|
89
|
-
const {
|
|
90
|
-
height: windowHeight
|
|
91
|
-
} = (0, _reactNative.useWindowDimensions)();
|
|
92
100
|
const [styleSheet, setStylesheet] = (0, _react.useState)(null);
|
|
93
101
|
const [isCongratsTranslationDone, setCongratsTranslationDone] = (0, _react.useState)(false);
|
|
94
102
|
const [isRankShown, setRankShown] = (0, _react.useState)(false);
|
|
95
|
-
const
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
onFinished: () => {
|
|
103
|
+
const scrollViewRef = (0, _react.useRef)(null);
|
|
104
|
+
const showCongrats = (0, _reactNativeAnimation.useAnimateProp)({
|
|
105
|
+
property: 'opacity',
|
|
106
|
+
fromValue: 0,
|
|
107
|
+
toValue: 1,
|
|
108
|
+
duration: 950,
|
|
109
|
+
onComplete: () => {
|
|
103
110
|
setCongratsTranslationDone(true);
|
|
104
111
|
}
|
|
105
112
|
});
|
|
106
|
-
const {
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
fromValue: 150,
|
|
111
|
-
duration: 750,
|
|
112
|
-
toValue: 0
|
|
113
|
+
const translateCongrats = (0, _reactNativeAnimation.useTranslateY)({
|
|
114
|
+
fromValue: 100,
|
|
115
|
+
toValue: 0,
|
|
116
|
+
duration: 550
|
|
113
117
|
});
|
|
114
|
-
const
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
onFadeInFinished: () => {
|
|
118
|
+
const showConfettis = (0, _reactNativeAnimation.useAnimateProp)(fadeIn);
|
|
119
|
+
const fadeInRank = (0, _reactNativeAnimation.useAnimateProp)(fadeIn);
|
|
120
|
+
const translateRank = (0, _reactNativeAnimation.useTranslateX)(_extends({}, translateHorizontally, {
|
|
121
|
+
onComplete: () => {
|
|
119
122
|
setRankShown(true);
|
|
123
|
+
setTimeout(() => {
|
|
124
|
+
scrollViewRef?.current?.scrollToEnd();
|
|
125
|
+
}, 700);
|
|
120
126
|
}
|
|
121
|
-
});
|
|
122
|
-
const
|
|
123
|
-
const {
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
}
|
|
136
|
-
delay: 250
|
|
137
|
-
});
|
|
127
|
+
}));
|
|
128
|
+
const animatedRank = [fadeInRank.animatedStyle, translateRank.animatedStyle];
|
|
129
|
+
const fadeInStars = (0, _reactNativeAnimation.useAnimateProp)(_extends({}, fadeIn, {
|
|
130
|
+
delay: 1000
|
|
131
|
+
}));
|
|
132
|
+
const translateStars = (0, _reactNativeAnimation.useTranslateX)(_extends({}, translateHorizontally, {
|
|
133
|
+
delay: 1000
|
|
134
|
+
}));
|
|
135
|
+
const showButton1 = (0, _reactNativeAnimation.useAnimateProp)(fadeIn);
|
|
136
|
+
const showButton2 = (0, _reactNativeAnimation.useAnimateProp)(fadeIn);
|
|
137
|
+
const congratsSequence = (0, _reactNativeAnimation.sequence)([(0, _reactNativeAnimation.parallel)([showCongrats, translateCongrats]), (0, _reactNativeAnimation.parallel)([showConfettis, fadeInRank, translateRank]), (0, _reactNativeAnimation.parallel)([fadeInStars, translateStars]), (0, _reactNativeAnimation.sequence)([showButton1, showButton2])]);
|
|
138
|
+
(0, _react.useEffect)(() => {
|
|
139
|
+
congratsSequence.start(); // (required only once on mount)
|
|
140
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
141
|
+
}, []);
|
|
138
142
|
(0, _react.useEffect)(() => {
|
|
139
143
|
const _stylesheet = createStyleSheet(theme);
|
|
140
144
|
|
|
141
145
|
setStylesheet(_stylesheet);
|
|
142
146
|
}, [theme]);
|
|
143
|
-
(0, _react.useEffect)(() => {
|
|
144
|
-
translateCongratsUp();
|
|
145
|
-
}, []);
|
|
146
|
-
(0, _react.useEffect)(() => {
|
|
147
|
-
if (isCongratsTranslationDone) {
|
|
148
|
-
showRank();
|
|
149
|
-
translateRankUp();
|
|
150
|
-
}
|
|
151
|
-
}, [isCongratsTranslationDone, showRank, translateRankUp]);
|
|
152
|
-
(0, _react.useEffect)(() => {
|
|
153
|
-
if (isRankShown) {
|
|
154
|
-
scrollViewRef?.current?.scrollToEnd();
|
|
155
|
-
translateStarsUp();
|
|
156
|
-
showStars();
|
|
157
|
-
}
|
|
158
|
-
}, [isRankShown, translateStarsUp, showStars]);
|
|
159
147
|
|
|
160
148
|
if (!styleSheet) {
|
|
161
149
|
return null;
|
|
@@ -164,7 +152,7 @@ const ReviewCongrats = props => {
|
|
|
164
152
|
const handleContinueRevisingPress = buttonRevising?.onClick || _noop2.default;
|
|
165
153
|
const handleReviseAnotherSkillPress = buttonRevisingSkill?.onClick || _noop2.default;
|
|
166
154
|
return /*#__PURE__*/_react.default.createElement(_reactNative.Animated.View, {
|
|
167
|
-
style: [styleSheet.congrats,
|
|
155
|
+
style: [styleSheet.congrats, translateCongrats.animatedStyle, showCongrats.animatedStyle],
|
|
168
156
|
accessibilityLabel: ariaLabel
|
|
169
157
|
}, /*#__PURE__*/_react.default.createElement(_reactNative.Text, {
|
|
170
158
|
style: styleSheet.title
|
|
@@ -175,7 +163,7 @@ const ReviewCongrats = props => {
|
|
|
175
163
|
style: styleSheet.scrollView,
|
|
176
164
|
contentContainerStyle: styleSheet.scrollViewContent
|
|
177
165
|
}, cardCongratsRank ? /*#__PURE__*/_react.default.createElement(_reactNative.Animated.View, {
|
|
178
|
-
style:
|
|
166
|
+
style: animatedRank
|
|
179
167
|
}, /*#__PURE__*/_react.default.createElement(_index2.default, {
|
|
180
168
|
animationUri: cardCongratsRank.animationLottie.animationSrc,
|
|
181
169
|
text: cardCongratsRank.reviewCardTitle,
|
|
@@ -185,7 +173,7 @@ const ReviewCongrats = props => {
|
|
|
185
173
|
textColor: theme.colors.text.primary,
|
|
186
174
|
direction: "row-reverse"
|
|
187
175
|
})) : null, /*#__PURE__*/_react.default.createElement(_reactNative.Animated.View, {
|
|
188
|
-
style: [
|
|
176
|
+
style: [fadeInStars.animatedStyle, translateStars.animatedStyle]
|
|
189
177
|
}, /*#__PURE__*/_react.default.createElement(_index2.default, {
|
|
190
178
|
animationUri: isRankShown ? cardCongratsStar.animationLottie.animationSrc : null,
|
|
191
179
|
Icon: _novaIcons.NovaCompositionCoorpacademyStar,
|
|
@@ -194,9 +182,11 @@ const ReviewCongrats = props => {
|
|
|
194
182
|
iconColor: theme.colors.battle,
|
|
195
183
|
textColor: theme.colors.battle,
|
|
196
184
|
direction: "row"
|
|
197
|
-
}))), /*#__PURE__*/_react.default.createElement(_reactNative.View, {
|
|
185
|
+
}))), /*#__PURE__*/_react.default.createElement(_reactNative.Animated.View, {
|
|
198
186
|
style: styleSheet.buttons
|
|
199
|
-
}, buttonRevisingSkill ? /*#__PURE__*/_react.default.createElement(
|
|
187
|
+
}, buttonRevisingSkill ? /*#__PURE__*/_react.default.createElement(_reactNative.Animated.View, {
|
|
188
|
+
style: showButton1.animatedStyle
|
|
189
|
+
}, /*#__PURE__*/_react.default.createElement(_index.default, {
|
|
200
190
|
onPress: handleReviseAnotherSkillPress,
|
|
201
191
|
accessibilityLabel: buttonRevisingSkill['aria-label'],
|
|
202
192
|
submitValue: buttonRevisingSkill.label,
|
|
@@ -206,13 +196,15 @@ const ReviewCongrats = props => {
|
|
|
206
196
|
textStyle: {
|
|
207
197
|
color: '#123'
|
|
208
198
|
}
|
|
209
|
-
}) : null, buttonRevising ? /*#__PURE__*/_react.default.createElement(
|
|
199
|
+
})) : null, buttonRevising ? /*#__PURE__*/_react.default.createElement(_reactNative.Animated.View, {
|
|
200
|
+
style: showButton2.animatedStyle
|
|
201
|
+
}, /*#__PURE__*/_react.default.createElement(_index.default, {
|
|
210
202
|
onPress: handleContinueRevisingPress,
|
|
211
203
|
accessibilityLabel: buttonRevising['aria-label'],
|
|
212
204
|
submitValue: buttonRevising.label
|
|
213
|
-
}) : null), isCongratsTranslationDone ? /*#__PURE__*/_react.default.createElement(_reactNative.View, {
|
|
205
|
+
})) : null), isCongratsTranslationDone ? /*#__PURE__*/_react.default.createElement(_reactNative.Animated.View, {
|
|
214
206
|
pointerEvents: "none",
|
|
215
|
-
style: styleSheet.confettis
|
|
207
|
+
style: [styleSheet.confettis, showConfettis.animatedStyle]
|
|
216
208
|
}, /*#__PURE__*/_react.default.createElement(_lottieReactNative.default, {
|
|
217
209
|
source: {
|
|
218
210
|
uri: animationLottie.animationSrc
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.native.js","names":["createStyleSheet","theme","StyleSheet","create","congrats","position","width","height","flexDirection","alignItems","paddingVertical","flex","buttons","paddingHorizontal","justifyContent","title","fontWeight","fontSize","lineHeight","marginVertical","color","colors","text","primary","confettis","flexGrow","pointerEvents","scrollView","scrollViewContent","ReviewCongrats","props","ariaLabel","animationLottie","cardCongratsStar","cardCongratsRank","buttonRevising","buttonRevisingSkill","useTemplateContext","windowHeight","useWindowDimensions","styleSheet","setStylesheet","useState","isCongratsTranslationDone","setCongratsTranslationDone","isRankShown","setRankShown","translate","translateCongratsUp","animatedY","animatedCongratsY","useTranslateVertically","fromValue","toValue","delay","onFinished","translateRankUp","animatedRankY","duration","fadeIn","showRank","animatedOpacity","animatedRankOpacity","useUpdateOpacity","onFadeInFinished","scrollViewRef","useRef","translateStarsUp","animatedStarsY","showStars","animatedStarsOpacity","useEffect","_stylesheet","current","scrollToEnd","handleContinueRevisingPress","onClick","handleReviseAnotherSkillPress","animationSrc","reviewCardTitle","reviewCardValue","rankSuffix","RankIcon","positive","StarIcon","battle","label","BOX_STYLE","backgroundColor","uri"],"sources":["../../../src/organism/review-congrats/index.native.tsx"],"sourcesContent":["import React, {useEffect, useRef, useState} from 'react';\nimport {\n Animated,\n ScrollView,\n StyleSheet,\n Text,\n TextStyle,\n useWindowDimensions,\n View,\n ViewStyle\n} from 'react-native';\nimport LottieView from 'lottie-react-native';\nimport {noop} from 'lodash/fp';\nimport {\n NovaCompositionCoorpacademyStar as StarIcon,\n NovaSolidVoteRewardsRewardsBadge5 as RankIcon\n} from '@coorpacademy/nova-icons';\n\nimport {useTemplateContext} from '../../template/app-review/template-context';\nimport {Theme} from '../../variables/theme.native';\nimport Button from '../../atom/button/index.native';\nimport {BOX_STYLE} from '../../variables/shadow';\nimport CardCongrats from '../../molecule/card-congrats/index.native';\nimport useTranslateVertically from '../../behaviours/use-translate-vertically.native';\nimport useUpdateOpacity from '../../behaviours/use-update-opacity.native';\nimport {ReviewCongratsProps} from './prop-types';\n\ntype StyleSheetType = {\n buttons: ViewStyle;\n congrats: ViewStyle;\n confettis: ViewStyle;\n scrollView: ViewStyle;\n scrollViewContent: ViewStyle;\n title: TextStyle;\n};\n\nconst createStyleSheet = (theme: Theme): StyleSheetType =>\n StyleSheet.create({\n congrats: {\n position: 'absolute',\n width: '100%',\n height: '100%',\n flexDirection: 'column',\n alignItems: 'center',\n paddingVertical: 90,\n flex: 1\n },\n buttons: {\n width: '100%',\n paddingHorizontal: 20,\n flexDirection: 'column',\n justifyContent: 'space-between',\n flex: 1\n },\n title: {\n fontWeight: '400',\n fontSize: 32,\n lineHeight: 40,\n marginVertical: 20,\n color: theme.colors.text.primary\n },\n confettis: {\n flexGrow: 1,\n position: 'absolute',\n width: '100%',\n height: '100%',\n pointerEvents: 'box-none'\n },\n scrollView: {\n height: 300\n },\n scrollViewContent: {\n alignItems: 'center',\n paddingHorizontal: 40\n }\n });\n\nconst ReviewCongrats = (props: ReviewCongratsProps) => {\n const {\n 'aria-label': ariaLabel,\n animationLottie,\n title,\n cardCongratsStar,\n cardCongratsRank,\n buttonRevising,\n buttonRevisingSkill\n } = props;\n\n const {theme} = useTemplateContext();\n const {height: windowHeight} = useWindowDimensions();\n\n const [styleSheet, setStylesheet] = useState<StyleSheetType | null>(null);\n const [isCongratsTranslationDone, setCongratsTranslationDone] = useState<boolean>(false);\n const [isRankShown, setRankShown] = useState<boolean>(false);\n\n const {translate: translateCongratsUp, animatedY: animatedCongratsY} = useTranslateVertically({\n fromValue: windowHeight,\n toValue: 0,\n delay: 750,\n onFinished: () => {\n setCongratsTranslationDone(true);\n }\n });\n\n const {translate: translateRankUp, animatedY: animatedRankY} = useTranslateVertically({\n fromValue: 150,\n duration: 750,\n toValue: 0\n });\n\n const {fadeIn: showRank, animatedOpacity: animatedRankOpacity} = useUpdateOpacity({\n onFadeInFinished: () => {\n setRankShown(true);\n }\n });\n\n const scrollViewRef = useRef<ScrollView>(null);\n\n const {translate: translateStarsUp, animatedY: animatedStarsY} = useTranslateVertically({\n fromValue: 150,\n toValue: 0,\n duration: 750,\n delay: 250\n });\n\n const {fadeIn: showStars, animatedOpacity: animatedStarsOpacity} = useUpdateOpacity({\n delay: 250\n });\n\n useEffect(() => {\n const _stylesheet = createStyleSheet(theme);\n setStylesheet(_stylesheet);\n }, [theme]);\n\n useEffect(() => {\n translateCongratsUp();\n }, []);\n\n useEffect(() => {\n if (isCongratsTranslationDone) {\n showRank();\n translateRankUp();\n }\n }, [isCongratsTranslationDone, showRank, translateRankUp]);\n\n useEffect(() => {\n if (isRankShown) {\n scrollViewRef?.current?.scrollToEnd();\n translateStarsUp();\n showStars();\n }\n }, [isRankShown, translateStarsUp, showStars]);\n\n if (!styleSheet) {\n return null;\n }\n\n const handleContinueRevisingPress = buttonRevising?.onClick || noop;\n const handleReviseAnotherSkillPress = buttonRevisingSkill?.onClick || noop;\n\n return (\n <Animated.View style={[styleSheet.congrats, animatedCongratsY]} accessibilityLabel={ariaLabel}>\n <Text style={styleSheet.title}>{title}</Text>\n <ScrollView\n ref={scrollViewRef}\n horizontal\n showsHorizontalScrollIndicator={false}\n style={styleSheet.scrollView}\n contentContainerStyle={styleSheet.scrollViewContent}\n >\n {cardCongratsRank ? (\n <Animated.View style={[animatedRankOpacity, animatedRankY]}>\n <CardCongrats\n animationUri={cardCongratsRank.animationLottie.animationSrc}\n text={cardCongratsRank.reviewCardTitle}\n value={`${cardCongratsRank.reviewCardValue} ${cardCongratsRank.rankSuffix}`}\n Icon={RankIcon}\n iconColor={theme.colors.positive}\n textColor={theme.colors.text.primary}\n direction=\"row-reverse\"\n />\n </Animated.View>\n ) : null}\n <Animated.View style={[animatedStarsOpacity, animatedStarsY]}>\n <CardCongrats\n animationUri={isRankShown ? cardCongratsStar.animationLottie.animationSrc : null}\n Icon={StarIcon}\n text={cardCongratsStar.reviewCardTitle}\n value={cardCongratsStar.reviewCardValue}\n iconColor={theme.colors.battle}\n textColor={theme.colors.battle}\n direction=\"row\"\n />\n </Animated.View>\n </ScrollView>\n\n <View style={styleSheet.buttons}>\n {buttonRevisingSkill ? (\n <Button\n onPress={handleReviseAnotherSkillPress}\n accessibilityLabel={buttonRevisingSkill['aria-label']}\n submitValue={buttonRevisingSkill.label}\n style={{...BOX_STYLE, backgroundColor: '#fff'}}\n textStyle={{color: '#123'}}\n />\n ) : null}\n {buttonRevising ? (\n <Button\n onPress={handleContinueRevisingPress}\n accessibilityLabel={buttonRevising['aria-label']}\n submitValue={buttonRevising.label}\n />\n ) : null}\n </View>\n\n {isCongratsTranslationDone ? (\n <View pointerEvents=\"none\" style={styleSheet.confettis}>\n <LottieView source={{uri: animationLottie.animationSrc}} autoPlay loop={false} />\n </View>\n ) : null}\n </Animated.View>\n );\n};\n\nexport default ReviewCongrats;\n"],"mappings":";;;;;;;AAAA;;AACA;;AAUA;;AAEA;;AAKA;;AAEA;;AACA;;AACA;;AACA;;AACA;;;;;;;;;;AAYA,MAAMA,gBAAgB,GAAIC,KAAD,IACvBC,uBAAA,CAAWC,MAAX,CAAkB;EAChBC,QAAQ,EAAE;IACRC,QAAQ,EAAE,UADF;IAERC,KAAK,EAAE,MAFC;IAGRC,MAAM,EAAE,MAHA;IAIRC,aAAa,EAAE,QAJP;IAKRC,UAAU,EAAE,QALJ;IAMRC,eAAe,EAAE,EANT;IAORC,IAAI,EAAE;EAPE,CADM;EAUhBC,OAAO,EAAE;IACPN,KAAK,EAAE,MADA;IAEPO,iBAAiB,EAAE,EAFZ;IAGPL,aAAa,EAAE,QAHR;IAIPM,cAAc,EAAE,eAJT;IAKPH,IAAI,EAAE;EALC,CAVO;EAiBhBI,KAAK,EAAE;IACLC,UAAU,EAA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AkE,IAAI,EAAE;EAAxE,EADF,CADwB,GAItB,IA1DN,CADF;AA8DD,CAjJD;;eAmJejD,c"}
|
|
1
|
+
{"version":3,"file":"index.native.js","names":["createStyleSheet","theme","StyleSheet","create","congrats","position","width","height","flexDirection","alignItems","paddingVertical","flex","buttons","paddingHorizontal","justifyContent","title","fontWeight","fontSize","lineHeight","marginVertical","color","colors","text","primary","confettis","flexGrow","pointerEvents","scrollView","scrollViewContent","fadeIn","property","fromValue","toValue","duration","translateHorizontally","ReviewCongrats","props","ariaLabel","animationLottie","cardCongratsStar","cardCongratsRank","buttonRevising","buttonRevisingSkill","useTemplateContext","styleSheet","setStylesheet","useState","isCongratsTranslationDone","setCongratsTranslationDone","isRankShown","setRankShown","scrollViewRef","useRef","showCongrats","useAnimateProp","onComplete","translateCongrats","useTranslateY","showConfettis","fadeInRank","translateRank","useTranslateX","setTimeout","current","scrollToEnd","animatedRank","animatedStyle","fadeInStars","delay","translateStars","showButton1","showButton2","congratsSequence","sequence","parallel","useEffect","start","_stylesheet","handleContinueRevisingPress","onClick","handleReviseAnotherSkillPress","animationSrc","reviewCardTitle","reviewCardValue","rankSuffix","RankIcon","positive","StarIcon","battle","label","BOX_STYLE","backgroundColor","uri"],"sources":["../../../src/organism/review-congrats/index.native.tsx"],"sourcesContent":["import React, {useEffect, useRef, useState} from 'react';\nimport {Animated, ScrollView, StyleSheet, Text, TextStyle, ViewStyle} from 'react-native';\nimport LottieView from 'lottie-react-native';\nimport {noop} from 'lodash/fp';\nimport {\n NovaCompositionCoorpacademyStar as StarIcon,\n NovaSolidVoteRewardsRewardsBadge5 as RankIcon\n} from '@coorpacademy/nova-icons';\nimport {\n sequence,\n parallel,\n useAnimateProp,\n useTranslateY,\n useTranslateX\n} from '@coorpacademy/react-native-animation';\nimport type {AnimatePropParams} from '@coorpacademy/react-native-animation/es/use-animate-prop';\n\nimport {useTemplateContext} from '../../template/app-review/template-context';\nimport {Theme} from '../../variables/theme.native';\nimport Button from '../../atom/button/index.native';\nimport {BOX_STYLE} from '../../variables/shadow';\nimport CardCongrats from '../../molecule/card-congrats/index.native';\nimport {ReviewCongratsProps} from './prop-types';\n\ntype StyleSheetType = {\n buttons: ViewStyle;\n congrats: ViewStyle;\n confettis: ViewStyle;\n scrollView: ViewStyle;\n scrollViewContent: ViewStyle;\n title: TextStyle;\n};\n\nconst createStyleSheet = (theme: Theme): StyleSheetType =>\n StyleSheet.create({\n congrats: {\n position: 'absolute',\n width: '100%',\n height: '100%',\n flexDirection: 'column',\n alignItems: 'center',\n paddingVertical: 90,\n flex: 1\n },\n buttons: {\n width: '100%',\n paddingHorizontal: 20,\n flexDirection: 'column',\n justifyContent: 'space-between',\n flex: 1\n },\n title: {\n fontWeight: '400',\n fontSize: 32,\n lineHeight: 40,\n marginVertical: 20,\n color: theme.colors.text.primary\n },\n confettis: {\n flexGrow: 1,\n position: 'absolute',\n width: '100%',\n height: '100%',\n pointerEvents: 'box-none'\n },\n scrollView: {\n height: 300\n },\n scrollViewContent: {\n alignItems: 'center',\n paddingHorizontal: 40\n }\n });\n\nconst fadeIn: AnimatePropParams = {\n property: 'opacity',\n fromValue: 0,\n toValue: 1,\n duration: 350\n};\n\nconst translateHorizontally = {\n property: 'translateX',\n fromValue: 180,\n toValue: 0,\n duration: 800\n};\n\nconst ReviewCongrats = (props: ReviewCongratsProps) => {\n const {\n 'aria-label': ariaLabel,\n animationLottie,\n title,\n cardCongratsStar,\n cardCongratsRank,\n buttonRevising,\n buttonRevisingSkill\n } = props;\n\n const {theme} = useTemplateContext();\n\n const [styleSheet, setStylesheet] = useState<StyleSheetType | null>(null);\n const [isCongratsTranslationDone, setCongratsTranslationDone] = useState<boolean>(false);\n const [isRankShown, setRankShown] = useState<boolean>(false);\n\n const scrollViewRef = useRef<ScrollView>(null);\n\n const showCongrats = useAnimateProp({\n property: 'opacity',\n fromValue: 0,\n toValue: 1,\n duration: 950,\n onComplete: () => {\n setCongratsTranslationDone(true);\n }\n });\n\n const translateCongrats = useTranslateY({\n fromValue: 100,\n toValue: 0,\n duration: 550\n });\n\n const showConfettis = useAnimateProp(fadeIn);\n const fadeInRank = useAnimateProp(fadeIn);\n const translateRank = useTranslateX({\n ...translateHorizontally,\n onComplete: () => {\n setRankShown(true);\n setTimeout(() => {\n scrollViewRef?.current?.scrollToEnd();\n }, 700);\n }\n });\n\n const animatedRank = [fadeInRank.animatedStyle, translateRank.animatedStyle];\n\n const fadeInStars = useAnimateProp({\n ...fadeIn,\n delay: 1000\n });\n\n const translateStars = useTranslateX({\n ...translateHorizontally,\n delay: 1000\n });\n\n const showButton1 = useAnimateProp(fadeIn);\n const showButton2 = useAnimateProp(fadeIn);\n\n const congratsSequence = sequence([\n parallel([showCongrats, translateCongrats]),\n parallel([showConfettis, fadeInRank, translateRank]),\n parallel([fadeInStars, translateStars]),\n sequence([showButton1, showButton2])\n ]);\n\n useEffect(() => {\n congratsSequence.start();\n // (required only once on mount)\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n useEffect(() => {\n const _stylesheet = createStyleSheet(theme);\n setStylesheet(_stylesheet);\n }, [theme]);\n\n if (!styleSheet) {\n return null;\n }\n\n const handleContinueRevisingPress = buttonRevising?.onClick || noop;\n const handleReviseAnotherSkillPress = buttonRevisingSkill?.onClick || noop;\n\n return (\n <Animated.View\n style={[styleSheet.congrats, translateCongrats.animatedStyle, showCongrats.animatedStyle]}\n accessibilityLabel={ariaLabel}\n >\n <Text style={styleSheet.title}>{title}</Text>\n <ScrollView\n ref={scrollViewRef}\n horizontal\n showsHorizontalScrollIndicator={false}\n style={styleSheet.scrollView}\n contentContainerStyle={styleSheet.scrollViewContent}\n >\n {cardCongratsRank ? (\n <Animated.View style={animatedRank}>\n <CardCongrats\n animationUri={cardCongratsRank.animationLottie.animationSrc}\n text={cardCongratsRank.reviewCardTitle}\n value={`${cardCongratsRank.reviewCardValue} ${cardCongratsRank.rankSuffix}`}\n Icon={RankIcon}\n iconColor={theme.colors.positive}\n textColor={theme.colors.text.primary}\n direction=\"row-reverse\"\n />\n </Animated.View>\n ) : null}\n <Animated.View style={[fadeInStars.animatedStyle, translateStars.animatedStyle]}>\n <CardCongrats\n animationUri={isRankShown ? cardCongratsStar.animationLottie.animationSrc : null}\n Icon={StarIcon}\n text={cardCongratsStar.reviewCardTitle}\n value={cardCongratsStar.reviewCardValue}\n iconColor={theme.colors.battle}\n textColor={theme.colors.battle}\n direction=\"row\"\n />\n </Animated.View>\n </ScrollView>\n\n <Animated.View style={styleSheet.buttons}>\n {buttonRevisingSkill ? (\n <Animated.View style={showButton1.animatedStyle}>\n <Button\n onPress={handleReviseAnotherSkillPress}\n accessibilityLabel={buttonRevisingSkill['aria-label']}\n submitValue={buttonRevisingSkill.label}\n style={{...BOX_STYLE, backgroundColor: '#fff'}}\n textStyle={{color: '#123'}}\n />\n </Animated.View>\n ) : null}\n {buttonRevising ? (\n <Animated.View style={showButton2.animatedStyle}>\n <Button\n onPress={handleContinueRevisingPress}\n accessibilityLabel={buttonRevising['aria-label']}\n submitValue={buttonRevising.label}\n />\n </Animated.View>\n ) : null}\n </Animated.View>\n\n {isCongratsTranslationDone ? (\n <Animated.View\n pointerEvents=\"none\"\n style={[styleSheet.confettis, showConfettis.animatedStyle]}\n >\n <LottieView source={{uri: animationLottie.animationSrc}} autoPlay loop={false} />\n </Animated.View>\n ) : null}\n </Animated.View>\n );\n};\n\nexport default ReviewCongrats;\n"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;AAEA;;AAIA;;AASA;;AAEA;;AACA;;AACA;;;;;;;;;;AAYA,MAAMA,gBAAgB,GAAIC,KAAD,IACvBC,uBAAA,CAAWC,MAAX,CAAkB;EAChBC,QAAQ,EAAE;IACRC,QAAQ,EAAE,UADF;IAERC,KAAK,EAAE,MAFC;IAGRC,MAAM,EAAE,MAHA;IAIRC,aAAa,EAAE,QAJP;IAKRC,UAAU,EAAE,QALJ;IAMRC,eAAe,EAAE,EANT;IAORC,IAAI,EAAE;EAPE,CADM;EAUhBC,O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AAD;IACE,OAAO,EAAEc,6BADX;IAEE,kBAAkB,EAAEtC,mBAAmB,CAAC,YAAD,CAFzC;IAGE,WAAW,EAAEA,mBAAmB,CAAC+C,KAHnC;IAIE,KAAK,eAAMC,iBAAN;MAAiBC,eAAe,EAAE;IAAlC,EAJP;IAKE,SAAS,EAAE;MAACvE,KAAK,EAAE;IAAR;EALb,EADF,CADkB,GAUhB,IAXN,EAYGqB,cAAc,gBACb,6BAAC,qBAAD,CAAU,IAAV;IAAe,KAAK,EAAE8B,WAAW,CAACL;EAAlC,gBACE,6BAAC,cAAD;IACE,OAAO,EAAEY,2BADX;IAEE,kBAAkB,EAAErC,cAAc,CAAC,YAAD,CAFpC;IAGE,WAAW,EAAEA,cAAc,CAACgD;EAH9B,EADF,CADa,GAQX,IApBN,CAtCF,EA6DG1C,yBAAyB,gBACxB,6BAAC,qBAAD,CAAU,IAAV;IACE,aAAa,EAAC,MADhB;IAEE,KAAK,EAAE,CAACH,UAAU,CAACpB,SAAZ,EAAuBkC,aAAa,CAACQ,aAArC;EAFT,gBAIE,6BAAC,0BAAD;IAAY,MAAM,EAAE;MAAC0B,GAAG,EAAEtD,eAAe,CAAC2C;IAAtB,CAApB;IAAyD,QAAQ,MAAjE;IAAkE,IAAI,EAAE;EAAxE,EAJF,CADwB,GAOtB,IApEN,CADF;AAwED,CA/JD;;eAiKe9C,c"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.native.d.ts","sourceRoot":"","sources":["../../../src/organism/review-slide/index.native.tsx"],"names":[],"mappings":";AAmBA,OAAO,EAAa,gBAAgB,EAAa,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"index.native.d.ts","sourceRoot":"","sources":["../../../src/organism/review-slide/index.native.tsx"],"names":[],"mappings":";AAmBA,OAAO,EAAa,gBAAgB,EAAa,MAAM,cAAc,CAAC;AA+JtE,QAAA,MAAM,KAAK,UAAW,gBAAgB,gBA8CrC,CAAC;AAEF,eAAe,KAAK,CAAC"}
|
|
@@ -11,6 +11,8 @@ var _get = _interopRequireDefault(require("lodash/fp/get"));
|
|
|
11
11
|
|
|
12
12
|
var _getOr = _interopRequireDefault(require("lodash/fp/getOr"));
|
|
13
13
|
|
|
14
|
+
var _reactNativeAnimation = require("@coorpacademy/react-native-animation");
|
|
15
|
+
|
|
14
16
|
var _index = _interopRequireDefault(require("../../atom/text/index.native"));
|
|
15
17
|
|
|
16
18
|
var _index2 = _interopRequireDefault(require("../../molecule/answer/index.native"));
|
|
@@ -21,8 +23,6 @@ var _templateContext = require("../../template/app-review/template-context");
|
|
|
21
23
|
|
|
22
24
|
var _index4 = _interopRequireDefault(require("../../atom/button/index.native"));
|
|
23
25
|
|
|
24
|
-
var _useTranslateVertically = _interopRequireDefault(require("../../behaviours/use-translate-vertically.native"));
|
|
25
|
-
|
|
26
26
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
27
27
|
|
|
28
28
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
@@ -43,12 +43,13 @@ const CorrectionPopin = ({
|
|
|
43
43
|
showCorrectionPopin,
|
|
44
44
|
animateCorrectionPopin
|
|
45
45
|
}) => {
|
|
46
|
-
const translateUp = (0,
|
|
46
|
+
const translateUp = (0, _reactNativeAnimation.useTranslateY)({
|
|
47
47
|
fromValue: 1000,
|
|
48
48
|
toValue: 0,
|
|
49
49
|
duration: 800,
|
|
50
50
|
easing: _reactNative.Easing.bezier(0.37, 0, 0.63, 1)
|
|
51
51
|
});
|
|
52
|
+
(0, _react.useEffect)(() => translateUp.start(), []);
|
|
52
53
|
if (!showCorrectionPopin) return null;
|
|
53
54
|
const klf = (0, _getOr.default)(undefined, 'klf', correctionPopinProps);
|
|
54
55
|
const information = (0, _getOr.default)({
|
|
@@ -69,7 +70,7 @@ const CorrectionPopin = ({
|
|
|
69
70
|
type: correctionPopinProps.type,
|
|
70
71
|
resultLabel: correctionPopinProps.resultLabel
|
|
71
72
|
};
|
|
72
|
-
const style = animateCorrectionPopin ? [styles.correctionPopinWrapper, translateUp.
|
|
73
|
+
const style = animateCorrectionPopin ? [styles.correctionPopinWrapper, translateUp.animatedStyle] : styles.correctionPopinWrapper;
|
|
73
74
|
return /*#__PURE__*/_react.default.createElement(_reactNative.Animated.View, {
|
|
74
75
|
style: style
|
|
75
76
|
}, /*#__PURE__*/_react.default.createElement(_index3.default, _correctionPopinProps));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.native.js","names":["styles","StyleSheet","create","correctionPopinWrapper","position","bottom","width","CorrectionPopin","correctionPopinProps","slideIndex","showCorrectionPopin","animateCorrectionPopin","translateUp","useTranslateVertically","fromValue","toValue","duration","easing","Easing","bezier","klf","getOr","undefined","information","label","message","next","get","onClick","_correctionPopinProps","type","resultLabel","style","animatedY","createQuestionStyle","theme","questionHeading","justifyContent","questionOrigin","fontSize","lineHeight","color","colors","text","primary","marginBottom","spacing","tiny","marginTop","small","textAlign","questionText","fontWeight","questionHelp","gray","medium","choicesContainer","flex","Question","props","answerUI","useTemplateContext","setStyle","useState","useEffect","questionStyle","createSlideStyle","num","screenWidth","slideWidth","slide","left","backgroundColor","height","alignItems","padding","shadowColor","shadowOffset","shadowOpacity","shadowRadius","elevation","borderRadius","Slide","validateButton","useWindowDimensions","slideStyle","loading","parentContentTitle","handleValidatePress","disabled"],"sources":["../../../src/organism/review-slide/index.native.tsx"],"sourcesContent":["import React, {useEffect, useState} from 'react';\nimport {\n Animated,\n Easing,\n StyleSheet,\n TextStyle,\n useWindowDimensions,\n View,\n ViewStyle\n} from 'react-native';\nimport get from 'lodash/fp/get';\nimport getOr from 'lodash/fp/getOr';\nimport Text from '../../atom/text/index.native';\nimport Answer from '../../molecule/answer/index.native';\nimport ReviewCorrectionPopin from '../../molecule/review-correction-popin/index.native';\nimport {useTemplateContext} from '../../template/app-review/template-context';\nimport {Theme} from '../../variables/theme.native';\nimport Button from '../../atom/button/index.native';\nimport useTranslateVertically from '../../behaviours/use-translate-vertically.native';\nimport {PopinProps, ReviewSlideProps, SlideProps} from './prop-types';\n\nconst styles = StyleSheet.create({\n correctionPopinWrapper: {\n position: 'absolute',\n bottom: 16,\n width: '105%'\n }\n});\n\nconst CorrectionPopin = ({\n correctionPopinProps,\n slideIndex,\n showCorrectionPopin,\n animateCorrectionPopin\n}: PopinProps) => {\n const translateUp = useTranslateVertically({\n fromValue: 1000,\n toValue: 0,\n duration: 800,\n easing: Easing.bezier(0.37, 0, 0.63, 1)\n });\n\n if (!showCorrectionPopin) return null;\n\n const klf = getOr(undefined, 'klf', correctionPopinProps);\n const information = getOr({label: '', message: ''}, 'information', correctionPopinProps);\n const next = get('next', correctionPopinProps);\n const onClick = get(['next', 'onClick'], correctionPopinProps);\n\n const _correctionPopinProps = {\n next: {\n onClick,\n label: next && next.label,\n 'data-name': `next-question-button-${slideIndex}`,\n 'aria-label': next && next['aria-label']\n },\n klf,\n information,\n type: correctionPopinProps.type,\n resultLabel: correctionPopinProps.resultLabel\n };\n\n const style = animateCorrectionPopin\n ? [styles.correctionPopinWrapper, translateUp.animatedY]\n : styles.correctionPopinWrapper;\n\n return (\n <Animated.View style={style}>\n <ReviewCorrectionPopin {..._correctionPopinProps} />\n </Animated.View>\n );\n};\n\ntype StyleSheetType = {\n questionHeading: ViewStyle;\n questionOrigin: ViewStyle;\n questionText: TextStyle;\n questionHelp: ViewStyle;\n choicesContainer: ViewStyle;\n};\n\nconst createQuestionStyle = (theme: Theme): StyleSheetType =>\n StyleSheet.create({\n questionHeading: {\n justifyContent: 'space-between'\n },\n questionOrigin: {\n fontSize: 12,\n lineHeight: 16,\n color: theme.colors.text.primary,\n marginBottom: theme.spacing.tiny,\n marginTop: theme.spacing.small,\n textAlign: 'center'\n },\n questionText: {\n fontSize: 16,\n lineHeight: 22,\n fontWeight: '700',\n color: theme.colors.text.primary,\n textAlign: 'center'\n },\n questionHelp: {\n fontSize: 12,\n lineHeight: 16,\n color: theme.colors.gray.medium,\n marginBottom: 0,\n marginTop: theme.spacing.small,\n textAlign: 'center'\n },\n choicesContainer: {\n flex: 1,\n width: '100%',\n justifyContent: 'center'\n }\n });\n\ntype QuestionProps = {\n answerUI: SlideProps['answerUI'];\n questionText: SlideProps['questionText'];\n questionOrigin: SlideProps['parentContentTitle'];\n};\n\nconst Question = (props: QuestionProps) => {\n const {answerUI, questionText, questionOrigin} = props;\n const {theme} = useTemplateContext();\n const [style, setStyle] = useState<StyleSheetType>();\n\n useEffect(() => {\n const questionStyle = createQuestionStyle(theme);\n setStyle(questionStyle);\n }, [theme]);\n\n if (!answerUI || !questionText || !style) return null;\n\n return (\n <>\n <View style={style.questionHeading}>\n <Text style={style.questionOrigin}>{questionOrigin}</Text>\n <Text style={style.questionText}>{questionText}</Text>\n <Text style={style.questionHelp}>{get('help', answerUI)}</Text>\n </View>\n <View style={style.choicesContainer}>\n <Answer {...answerUI} />\n </View>\n </>\n );\n};\n\ntype SlideStyle = {\n slide: ViewStyle;\n};\n\nconst createSlideStyle = (num: number, screenWidth: number): SlideStyle => {\n const slideWidth = screenWidth - 40 - num * 8;\n\n return StyleSheet.create({\n slide: {\n position: 'absolute',\n left: 20 + num * 4,\n bottom: 34 + num * 5,\n backgroundColor: '#fff', // theme.colors.white\n height: '90%',\n width: slideWidth,\n justifyContent: 'space-between',\n alignItems: 'center',\n padding: 25,\n shadowColor: '#000',\n shadowOffset: {width: 0, height: -1},\n shadowOpacity: 0.05,\n shadowRadius: 16,\n elevation: 10 - num * 1,\n borderRadius: 16\n }\n });\n};\n\nconst Slide = (props: ReviewSlideProps) => {\n const {slide, correctionPopinProps, validateButton, num, slideIndex = '0'} = props;\n\n const {width} = useWindowDimensions();\n const slideStyle = createSlideStyle(num, width);\n\n const {\n loading,\n parentContentTitle,\n questionText,\n answerUI,\n showCorrectionPopin,\n animateCorrectionPopin\n } = slide;\n\n if (loading) {\n return <Text>@todo loader {num}</Text>;\n }\n\n const {onClick: handleValidatePress} = validateButton;\n\n return (\n <View style={slideStyle.slide}>\n <Question\n questionOrigin={parentContentTitle}\n questionText={questionText}\n answerUI={answerUI}\n key=\"question-container\"\n />\n <Button\n disabled={validateButton.disabled}\n submitValue={validateButton.label}\n onPress={handleValidatePress}\n testID={`slide-validate-button-${slideIndex}`}\n />\n {correctionPopinProps ? (\n <CorrectionPopin\n correctionPopinProps={correctionPopinProps}\n slideIndex={slideIndex}\n showCorrectionPopin={showCorrectionPopin}\n animateCorrectionPopin={animateCorrectionPopin}\n key=\"correction-popin\"\n />\n ) : null}\n </View>\n );\n};\n\nexport default Slide;\n"],"mappings":";;;;;AAAA;;AACA;;AASA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAEA;;AACA;;;;;;;;AAGA,MAAMA,MAAM,GAAGC,uBAAA,CAAWC,MAAX,CAAkB;EAC/BC,sBAAsB,EAAE;IACtBC,QAAQ,EAAE,UADY;IAEtBC,MAAM,EAAE,EAFc;IAGtBC,KAAK,EAAE;EAHe;AADO,CAAlB,CAAf;;AAQA,MAAMC,eAAe,GAAG,CAAC;EACvBC,oBADuB;EAEvBC,UAFuB;EAGvBC,mBAHuB;EAIvBC;AAJuB,CAAD,KAKN;EAChB,MAAMC,WAAW,GAAG,IAAAC,+BAAA,EAAuB;IACzCC,SAAS,EAAE,IAD8B;IAEzCC,OAAO,EAAE,CAFgC;IAGzCC,QAAQ,EAAE,GAH+B;IAIzCC,MAAM,EAAEC,mBAAA,CAAOC,MAAP,CAAc,IAAd,EAAoB,CAApB,EAAuB,IAAvB,EAA6B,CAA7B;EAJiC,CAAvB,CAApB;EAOA,IAAI,CAACT,mBAAL,EAA0B,OAAO,IAAP;EAE1B,MAAMU,GAAG,GAAG,IAAAC,cAAA,EAAMC,SAAN,EAAiB,KAAjB,EAAwBd,oBAAxB,CAAZ;EAC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,IAAuEkD,KAA7E;EAEA,MAAM;IAACrD;EAAD,IAAU,IAAA8E,gCAAA,GAAhB;EACA,MAAMC,UAAU,GAAGnB,gBAAgB,CAACC,GAAD,EAAM7D,KAAN,CAAnC;EAEA,MAAM;IACJgF,OADI;IAEJC,kBAFI;IAGJpC,YAHI;IAIJS,QAJI;IAKJlD,mBALI;IAMJC;EANI,IAOF2D,KAPJ;;EASA,IAAIgB,OAAJ,EAAa;IACX,oBAAO,6BAAC,cAAD,yBAAoBnB,GAApB,CAAP;EACD;;EAED,MAAM;IAACvC,OAAO,EAAE4D;EAAV,IAAiCL,cAAvC;EAEA,oBACE,6BAAC,iBAAD;IAAM,KAAK,EAAEE,UAAU,CAACf;EAAxB,gBACE,6BAAC,QAAD;IACE,cAAc,EAAEiB,kBADlB;IAEE,YAAY,EAAEpC,YAFhB;IAGE,QAAQ,EAAES,QAHZ;IAIE,GAAG,EAAC;EAJN,EADF,eAOE,6BAAC,eAAD;IACE,QAAQ,EAAEuB,cAAc,CAACM,QAD3B;IAEE,WAAW,EAAEN,cAAc,CAAC3D,KAF9B;IAGE,OAAO,EAAEgE,mBAHX;IAIE,MAAM,EAAG,yBAAwB/E,UAAW;EAJ9C,EAPF,EAaGD,oBAAoB,gBACnB,6BAAC,eAAD;IACE,oBAAoB,EAAEA,oBADxB;IAEE,UAAU,EAAEC,UAFd;IAGE,mBAAmB,EAAEC,mBAHvB;IAIE,sBAAsB,EAAEC,sBAJ1B;IAKE,GAAG,EAAC;EALN,EADmB,GAQjB,IArBN,CADF;AAyBD,CA9CD;;eAgDeuE,K"}
|
|
1
|
+
{"version":3,"file":"index.native.js","names":["styles","StyleSheet","create","correctionPopinWrapper","position","bottom","width","CorrectionPopin","correctionPopinProps","slideIndex","showCorrectionPopin","animateCorrectionPopin","translateUp","useTranslateY","fromValue","toValue","duration","easing","Easing","bezier","useEffect","start","klf","getOr","undefined","information","label","message","next","get","onClick","_correctionPopinProps","type","resultLabel","style","animatedStyle","createQuestionStyle","theme","questionHeading","justifyContent","questionOrigin","fontSize","lineHeight","color","colors","text","primary","marginBottom","spacing","tiny","marginTop","small","textAlign","questionText","fontWeight","questionHelp","gray","medium","choicesContainer","flex","Question","props","answerUI","useTemplateContext","setStyle","useState","questionStyle","createSlideStyle","num","screenWidth","slideWidth","slide","left","backgroundColor","height","alignItems","padding","shadowColor","shadowOffset","shadowOpacity","shadowRadius","elevation","borderRadius","Slide","validateButton","useWindowDimensions","slideStyle","loading","parentContentTitle","handleValidatePress","disabled"],"sources":["../../../src/organism/review-slide/index.native.tsx"],"sourcesContent":["import React, {useEffect, useState} from 'react';\nimport {\n Animated,\n Easing,\n StyleSheet,\n TextStyle,\n useWindowDimensions,\n View,\n ViewStyle\n} from 'react-native';\nimport get from 'lodash/fp/get';\nimport getOr from 'lodash/fp/getOr';\nimport {useTranslateY} from '@coorpacademy/react-native-animation';\nimport Text from '../../atom/text/index.native';\nimport Answer from '../../molecule/answer/index.native';\nimport ReviewCorrectionPopin from '../../molecule/review-correction-popin/index.native';\nimport {useTemplateContext} from '../../template/app-review/template-context';\nimport {Theme} from '../../variables/theme.native';\nimport Button from '../../atom/button/index.native';\nimport {PopinProps, ReviewSlideProps, SlideProps} from './prop-types';\n\nconst styles = StyleSheet.create({\n correctionPopinWrapper: {\n position: 'absolute',\n bottom: 16,\n width: '105%'\n }\n});\n\nconst CorrectionPopin = ({\n correctionPopinProps,\n slideIndex,\n showCorrectionPopin,\n animateCorrectionPopin\n}: PopinProps) => {\n const translateUp = useTranslateY({\n fromValue: 1000,\n toValue: 0,\n duration: 800,\n easing: Easing.bezier(0.37, 0, 0.63, 1)\n });\n\n useEffect(() => translateUp.start(), []);\n\n if (!showCorrectionPopin) return null;\n\n const klf = getOr(undefined, 'klf', correctionPopinProps);\n const information = getOr({label: '', message: ''}, 'information', correctionPopinProps);\n const next = get('next', correctionPopinProps);\n const onClick = get(['next', 'onClick'], correctionPopinProps);\n\n const _correctionPopinProps = {\n next: {\n onClick,\n label: next && next.label,\n 'data-name': `next-question-button-${slideIndex}`,\n 'aria-label': next && next['aria-label']\n },\n klf,\n information,\n type: correctionPopinProps.type,\n resultLabel: correctionPopinProps.resultLabel\n };\n\n const style = animateCorrectionPopin\n ? [styles.correctionPopinWrapper, translateUp.animatedStyle]\n : styles.correctionPopinWrapper;\n\n return (\n <Animated.View style={style}>\n <ReviewCorrectionPopin {..._correctionPopinProps} />\n </Animated.View>\n );\n};\n\ntype StyleSheetType = {\n questionHeading: ViewStyle;\n questionOrigin: ViewStyle;\n questionText: TextStyle;\n questionHelp: ViewStyle;\n choicesContainer: ViewStyle;\n};\n\nconst createQuestionStyle = (theme: Theme): StyleSheetType =>\n StyleSheet.create({\n questionHeading: {\n justifyContent: 'space-between'\n },\n questionOrigin: {\n fontSize: 12,\n lineHeight: 16,\n color: theme.colors.text.primary,\n marginBottom: theme.spacing.tiny,\n marginTop: theme.spacing.small,\n textAlign: 'center'\n },\n questionText: {\n fontSize: 16,\n lineHeight: 22,\n fontWeight: '700',\n color: theme.colors.text.primary,\n textAlign: 'center'\n },\n questionHelp: {\n fontSize: 12,\n lineHeight: 16,\n color: theme.colors.gray.medium,\n marginBottom: 0,\n marginTop: theme.spacing.small,\n textAlign: 'center'\n },\n choicesContainer: {\n flex: 1,\n width: '100%',\n justifyContent: 'center'\n }\n });\n\ntype QuestionProps = {\n answerUI: SlideProps['answerUI'];\n questionText: SlideProps['questionText'];\n questionOrigin: SlideProps['parentContentTitle'];\n};\n\nconst Question = (props: QuestionProps) => {\n const {answerUI, questionText, questionOrigin} = props;\n const {theme} = useTemplateContext();\n const [style, setStyle] = useState<StyleSheetType>();\n\n useEffect(() => {\n const questionStyle = createQuestionStyle(theme);\n setStyle(questionStyle);\n }, [theme]);\n\n if (!answerUI || !questionText || !style) return null;\n\n return (\n <>\n <View style={style.questionHeading}>\n <Text style={style.questionOrigin}>{questionOrigin}</Text>\n <Text style={style.questionText}>{questionText}</Text>\n <Text style={style.questionHelp}>{get('help', answerUI)}</Text>\n </View>\n <View style={style.choicesContainer}>\n <Answer {...answerUI} />\n </View>\n </>\n );\n};\n\ntype SlideStyle = {\n slide: ViewStyle;\n};\n\nconst createSlideStyle = (num: number, screenWidth: number): SlideStyle => {\n const slideWidth = screenWidth - 40 - num * 8;\n\n return StyleSheet.create({\n slide: {\n position: 'absolute',\n left: 20 + num * 4,\n bottom: 34 + num * 5,\n backgroundColor: '#fff', // theme.colors.white\n height: '90%',\n width: slideWidth,\n justifyContent: 'space-between',\n alignItems: 'center',\n padding: 25,\n shadowColor: '#000',\n shadowOffset: {width: 0, height: -1},\n shadowOpacity: 0.05,\n shadowRadius: 16,\n elevation: 10 - num * 1,\n borderRadius: 16\n }\n });\n};\n\nconst Slide = (props: ReviewSlideProps) => {\n const {slide, correctionPopinProps, validateButton, num, slideIndex = '0'} = props;\n\n const {width} = useWindowDimensions();\n const slideStyle = createSlideStyle(num, width);\n\n const {\n loading,\n parentContentTitle,\n questionText,\n answerUI,\n showCorrectionPopin,\n animateCorrectionPopin\n } = slide;\n\n if (loading) {\n return <Text>@todo loader {num}</Text>;\n }\n\n const {onClick: handleValidatePress} = validateButton;\n\n return (\n <View style={slideStyle.slide}>\n <Question\n questionOrigin={parentContentTitle}\n questionText={questionText}\n answerUI={answerUI}\n key=\"question-container\"\n />\n <Button\n disabled={validateButton.disabled}\n submitValue={validateButton.label}\n onPress={handleValidatePress}\n testID={`slide-validate-button-${slideIndex}`}\n />\n {correctionPopinProps ? (\n <CorrectionPopin\n correctionPopinProps={correctionPopinProps}\n slideIndex={slideIndex}\n showCorrectionPopin={showCorrectionPopin}\n animateCorrectionPopin={animateCorrectionPopin}\n key=\"correction-popin\"\n />\n ) : null}\n </View>\n );\n};\n\nexport default Slide;\n"],"mappings":";;;;;AAAA;;AACA;;AASA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAEA;;;;;;;;AAGA,MAAMA,MAAM,GAAGC,uBAAA,CAAWC,MAAX,CAAkB;EAC/BC,sBAAsB,EAAE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EAJN,EADF,eAOE,6BAAC,eAAD;IACE,QAAQ,EAAEsB,cAAc,CAACM,QAD3B;IAEE,WAAW,EAAEN,cAAc,CAAC1D,KAF9B;IAGE,OAAO,EAAE+D,mBAHX;IAIE,MAAM,EAAG,yBAAwBhF,UAAW;EAJ9C,EAPF,EAaGD,oBAAoB,gBACnB,6BAAC,eAAD;IACE,oBAAoB,EAAEA,oBADxB;IAEE,UAAU,EAAEC,UAFd;IAGE,mBAAmB,EAAEC,mBAHvB;IAIE,sBAAsB,EAAEC,sBAJ1B;IAKE,GAAG,EAAC;EALN,EADmB,GAQjB,IArBN,CADF;AAyBD,CA9CD;;eAgDewE,K"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.native.d.ts","sourceRoot":"","sources":["../../../src/organism/review-stacked-slides/index.native.tsx"],"names":[],"mappings":";AAKA,OAAO,EAAC,gBAAgB,EAAC,MAAM,cAAc,CAAC;AAE9C,eAAO,MAAM,kBAAkB,IAAI,CAAC;AAUpC,QAAA,MAAM,aAAa,UAAW,gBAAgB,
|
|
1
|
+
{"version":3,"file":"index.native.d.ts","sourceRoot":"","sources":["../../../src/organism/review-stacked-slides/index.native.tsx"],"names":[],"mappings":";AAKA,OAAO,EAAC,gBAAgB,EAAC,MAAM,cAAc,CAAC;AAE9C,eAAO,MAAM,kBAAkB,IAAI,CAAC;AAUpC,QAAA,MAAM,aAAa,UAAW,gBAAgB,gBAiC7C,CAAC;AAEF,eAAe,aAAa,CAAC"}
|
|
@@ -9,9 +9,9 @@ var _reactNative = require("react-native");
|
|
|
9
9
|
|
|
10
10
|
var _keys = _interopRequireDefault(require("lodash/fp/keys"));
|
|
11
11
|
|
|
12
|
-
var
|
|
12
|
+
var _reactNativeAnimation = require("@coorpacademy/react-native-animation");
|
|
13
13
|
|
|
14
|
-
var
|
|
14
|
+
var _index = _interopRequireDefault(require("../review-slide/index.native"));
|
|
15
15
|
|
|
16
16
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
17
17
|
|
|
@@ -39,15 +39,12 @@ const StackedSlides = props => {
|
|
|
39
39
|
validateButton,
|
|
40
40
|
correctionPopinProps
|
|
41
41
|
} = props;
|
|
42
|
-
const {
|
|
43
|
-
translate,
|
|
44
|
-
animatedY
|
|
45
|
-
} = (0, _useTranslateVertically.default)({
|
|
42
|
+
const hideSlides = (0, _reactNativeAnimation.useTranslateY)({
|
|
46
43
|
fromValue: 0,
|
|
47
44
|
toValue: windowHeight,
|
|
48
45
|
duration: 800
|
|
49
46
|
});
|
|
50
|
-
(0, _react.useEffect)(
|
|
47
|
+
(0, _react.useEffect)(() => hideSlides.start(), []);
|
|
51
48
|
const indexes = (0, _keys.default)(slides).reverse();
|
|
52
49
|
const stackedSlides = indexes.map(slideIndex => {
|
|
53
50
|
const slide = slides[slideIndex];
|
|
@@ -61,7 +58,7 @@ const StackedSlides = props => {
|
|
|
61
58
|
});
|
|
62
59
|
});
|
|
63
60
|
return /*#__PURE__*/_react.default.createElement(_reactNative.Animated.View, {
|
|
64
|
-
style: [style.slides,
|
|
61
|
+
style: [style.slides, hideSlides.animatedStyle]
|
|
65
62
|
}, stackedSlides);
|
|
66
63
|
};
|
|
67
64
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.native.js","names":["TOTAL_SLIDES_STACK","style","StyleSheet","create","slides","flex","height","width","StackedSlides","props","windowHeight","useWindowDimensions","validateButton","correctionPopinProps","
|
|
1
|
+
{"version":3,"file":"index.native.js","names":["TOTAL_SLIDES_STACK","style","StyleSheet","create","slides","flex","height","width","StackedSlides","props","windowHeight","useWindowDimensions","validateButton","correctionPopinProps","hideSlides","useTranslateY","fromValue","toValue","duration","useEffect","start","indexes","keys","reverse","stackedSlides","map","slideIndex","slide","num","Number","parseInt","animatedStyle"],"sources":["../../../src/organism/review-stacked-slides/index.native.tsx"],"sourcesContent":["import React, {useEffect} from 'react';\nimport {Animated, StyleSheet, useWindowDimensions} from 'react-native';\nimport keys from 'lodash/fp/keys';\nimport {useTranslateY} from '@coorpacademy/react-native-animation';\nimport Slide from '../review-slide/index.native';\nimport {ReviewStackProps} from './prop-types';\n\nexport const TOTAL_SLIDES_STACK = 5;\n\nconst style = StyleSheet.create({\n slides: {\n flex: 1,\n height: '100%',\n width: '100%'\n }\n});\n\nconst StackedSlides = (props: ReviewStackProps) => {\n const {height: windowHeight} = useWindowDimensions();\n const {slides, validateButton, correctionPopinProps} = props;\n\n const hideSlides = useTranslateY({\n fromValue: 0,\n toValue: windowHeight,\n duration: 800\n });\n\n useEffect(() => hideSlides.start(), []);\n\n const indexes = keys(slides).reverse();\n const stackedSlides = indexes.map(slideIndex => {\n const slide = slides[slideIndex];\n\n return (\n <Slide\n {...{\n num: Number.parseInt(slideIndex),\n slideIndex,\n slide,\n validateButton,\n correctionPopinProps\n }}\n key={slideIndex}\n />\n );\n });\n\n return (\n <Animated.View style={[style.slides, hideSlides.animatedStyle]}>{stackedSlides}</Animated.View>\n );\n};\n\nexport default StackedSlides;\n"],"mappings":";;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;;;;;;;AAGO,MAAMA,kBAAkB,GAAG,CAA3B;;;AAEP,MAAMC,KAAK,GAAGC,uBAAA,CAAWC,MAAX,CAAkB;EAC9BC,MAAM,EAAE;IACNC,IAAI,EAAE,CADA;IAENC,MAAM,EAAE,MAFF;IAGNC,KAAK,EAAE;EAHD;AADsB,CAAlB,CAAd;;AAQA,MAAMC,aAAa,GAAIC,KAAD,IAA6B;EACjD,MAAM;IAACH,MAAM,EAAEI;EAAT,IAAyB,IAAAC,gCAAA,GAA/B;EACA,MAAM;IAACP,MAAD;IAASQ,cAAT;IAAyBC;EAAzB,IAAiDJ,KAAvD;EAEA,MAAMK,UAAU,GAAG,IAAAC,mCAAA,EAAc;IAC/BC,SAAS,EAAE,CADoB;IAE/BC,OAAO,EAAEP,YAFsB;IAG/BQ,QAAQ,EAAE;EAHqB,CAAd,CAAnB;EAMA,IAAAC,gBAAA,EAAU,MAAML,UAAU,CAACM,KAAX,EAAhB,EAAoC,EAApC;EAEA,MAAMC,OAAO,GAAG,IAAAC,aAAA,EAAKlB,MAAL,EAAamB,OAAb,EAAhB;EACA,MAAMC,aAAa,GAAGH,OAAO,CAACI,GAAR,CAAYC,UAAU,IAAI;IAC9C,MAAMC,KAAK,GAAGvB,MAAM,CAACsB,UAAD,CAApB;IAEA,oBACE,6BAAC,cAAD;MAEIE,GAAG,EAAEC,MAAM,CAACC,QAAP,CAAgBJ,UAAhB,CAFT;MAGIA,UAHJ;MAIIC,KAJJ;MAKIf,cALJ;MAMIC,oBANJ;MAQE,GAAG,EAAEa;IARP,EADF;EAYD,CAfqB,CAAtB;EAiBA,oBACE,6BAAC,qBAAD,CAAU,IAAV;IAAe,KAAK,EAAE,CAACzB,KAAK,CAACG,MAAP,EAAeU,UAAU,CAACiB,aAA1B;EAAtB,GAAiEP,aAAjE,CADF;AAGD,CAjCD;;eAmCehB,a"}
|
|
@@ -65,6 +65,7 @@ declare namespace PopinEnd {
|
|
|
65
65
|
avatar: PropTypes.Requireable<any>;
|
|
66
66
|
loading: PropTypes.Requireable<boolean>;
|
|
67
67
|
value: PropTypes.Requireable<string>;
|
|
68
|
+
profileAvatarAlt: PropTypes.Requireable<string>;
|
|
68
69
|
title: PropTypes.Requireable<string>;
|
|
69
70
|
onPost: PropTypes.Requireable<(...args: any[]) => any>;
|
|
70
71
|
onChange: PropTypes.Requireable<(...args: any[]) => any>;
|
|
@@ -71,6 +71,7 @@ declare namespace Summary {
|
|
|
71
71
|
avatar: PropTypes.Requireable<any>;
|
|
72
72
|
loading: PropTypes.Requireable<boolean>;
|
|
73
73
|
value: PropTypes.Requireable<string>;
|
|
74
|
+
profileAvatarAlt: PropTypes.Requireable<string>;
|
|
74
75
|
title: PropTypes.Requireable<string>;
|
|
75
76
|
onPost: PropTypes.Requireable<(...args: any[]) => any>;
|
|
76
77
|
onChange: PropTypes.Requireable<(...args: any[]) => any>;
|
|
@@ -78,6 +78,7 @@ declare namespace Discipline {
|
|
|
78
78
|
avatar: PropTypes.Requireable<any>;
|
|
79
79
|
loading: PropTypes.Requireable<boolean>;
|
|
80
80
|
value: PropTypes.Requireable<string>;
|
|
81
|
+
profileAvatarAlt: PropTypes.Requireable<string>;
|
|
81
82
|
title: PropTypes.Requireable<string>;
|
|
82
83
|
onPost: PropTypes.Requireable<(...args: any[]) => any>;
|
|
83
84
|
onChange: PropTypes.Requireable<(...args: any[]) => any>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@coorpacademy/components",
|
|
3
|
-
"version": "11.0.
|
|
3
|
+
"version": "11.0.2-alpha.3+43e62ce70",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"module": "es/index.js",
|
|
@@ -57,6 +57,7 @@
|
|
|
57
57
|
],
|
|
58
58
|
"dependencies": {
|
|
59
59
|
"@coorpacademy/nova-icons": "4.0.0",
|
|
60
|
+
"@coorpacademy/react-native-animation": "1.0.1",
|
|
60
61
|
"@jwplayer/jwplayer-react": "^1.1.0",
|
|
61
62
|
"@types/react": "^17.0.50",
|
|
62
63
|
"@types/react-dom": "^17.0.17",
|
|
@@ -158,5 +159,5 @@
|
|
|
158
159
|
"last 2 versions",
|
|
159
160
|
"IE 11"
|
|
160
161
|
],
|
|
161
|
-
"gitHead": "
|
|
162
|
+
"gitHead": "43e62ce70ea58c568e0c51af0306c35ca5049e9c"
|
|
162
163
|
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { Animated } from 'react-native';
|
|
2
|
-
declare type Params = Omit<Animated.TimingAnimationConfig, 'useNativeDriver' | 'toValue'> & {
|
|
3
|
-
onFinished?: () => void;
|
|
4
|
-
fromValue?: number;
|
|
5
|
-
toValue?: Animated.TimingAnimationConfig['toValue'];
|
|
6
|
-
};
|
|
7
|
-
declare const useTranslateVertically: (params?: Params) => {
|
|
8
|
-
translate: () => void;
|
|
9
|
-
animatedY: {
|
|
10
|
-
transform: {
|
|
11
|
-
translateY: Animated.Value;
|
|
12
|
-
}[];
|
|
13
|
-
};
|
|
14
|
-
};
|
|
15
|
-
export default useTranslateVertically;
|
|
16
|
-
//# sourceMappingURL=use-translate-vertically.native.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"use-translate-vertically.native.d.ts","sourceRoot":"","sources":["../../src/behaviours/use-translate-vertically.native.tsx"],"names":[],"mappings":"AACA,OAAO,EAAC,QAAQ,EAAC,MAAM,cAAc,CAAC;AAEtC,aAAK,MAAM,GAAG,IAAI,CAAC,QAAQ,CAAC,qBAAqB,EAAE,iBAAiB,GAAG,SAAS,CAAC,GAAG;IAClF,UAAU,CAAC,EAAE,MAAM,IAAI,CAAC;IACxB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,QAAQ,CAAC,qBAAqB,CAAC,SAAS,CAAC,CAAC;CACrD,CAAC;AAEF,QAAA,MAAM,sBAAsB,YAAY,MAAM;;;;;;;CAkB7C,CAAC;AAEF,eAAe,sBAAsB,CAAC"}
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
const _excluded = ["fromValue", "toValue", "duration", "onFinished"];
|
|
2
|
-
|
|
3
|
-
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
4
|
-
|
|
5
|
-
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
6
|
-
|
|
7
|
-
import { useCallback, useRef } from 'react';
|
|
8
|
-
import { Animated } from 'react-native';
|
|
9
|
-
|
|
10
|
-
const useTranslateVertically = (params = {}) => {
|
|
11
|
-
const {
|
|
12
|
-
fromValue = 0,
|
|
13
|
-
toValue = 100,
|
|
14
|
-
duration = 550,
|
|
15
|
-
onFinished
|
|
16
|
-
} = params,
|
|
17
|
-
othersParams = _objectWithoutPropertiesLoose(params, _excluded);
|
|
18
|
-
|
|
19
|
-
const translateY = useRef(new Animated.Value(fromValue)).current;
|
|
20
|
-
const translate = useCallback(() => {
|
|
21
|
-
Animated.timing(translateY, _extends({}, othersParams, {
|
|
22
|
-
toValue,
|
|
23
|
-
duration,
|
|
24
|
-
useNativeDriver: true
|
|
25
|
-
})).start(({
|
|
26
|
-
finished
|
|
27
|
-
}) => {
|
|
28
|
-
if (finished) {
|
|
29
|
-
onFinished?.();
|
|
30
|
-
}
|
|
31
|
-
});
|
|
32
|
-
}, [onFinished, duration, othersParams, toValue, translateY]);
|
|
33
|
-
return {
|
|
34
|
-
translate,
|
|
35
|
-
animatedY: {
|
|
36
|
-
transform: [{
|
|
37
|
-
translateY
|
|
38
|
-
}]
|
|
39
|
-
}
|
|
40
|
-
};
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
export default useTranslateVertically;
|
|
44
|
-
//# sourceMappingURL=use-translate-vertically.native.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"use-translate-vertically.native.js","names":["useCallback","useRef","Animated","useTranslateVertically","params","fromValue","toValue","duration","onFinished","othersParams","translateY","Value","current","translate","timing","useNativeDriver","start","finished","animatedY","transform"],"sources":["../../src/behaviours/use-translate-vertically.native.tsx"],"sourcesContent":["import {useCallback, useRef} from 'react';\nimport {Animated} from 'react-native';\n\ntype Params = Omit<Animated.TimingAnimationConfig, 'useNativeDriver' | 'toValue'> & {\n onFinished?: () => void;\n fromValue?: number;\n toValue?: Animated.TimingAnimationConfig['toValue'];\n};\n\nconst useTranslateVertically = (params: Params = {}) => {\n const {fromValue = 0, toValue = 100, duration = 550, onFinished, ...othersParams} = params;\n const translateY = useRef(new Animated.Value(fromValue)).current;\n\n const translate = useCallback(() => {\n Animated.timing(translateY, {\n ...othersParams,\n toValue,\n duration,\n useNativeDriver: true\n }).start(({finished}) => {\n if (finished) {\n onFinished?.();\n }\n });\n }, [onFinished, duration, othersParams, toValue, translateY]);\n\n return {translate, animatedY: {transform: [{translateY}]}};\n};\n\nexport default useTranslateVertically;\n"],"mappings":";;;;;;AAAA,SAAQA,WAAR,EAAqBC,MAArB,QAAkC,OAAlC;AACA,SAAQC,QAAR,QAAuB,cAAvB;;AAQA,MAAMC,sBAAsB,GAAG,CAACC,MAAc,GAAG,EAAlB,KAAyB;EACtD,MAAM;IAACC,SAAS,GAAG,CAAb;IAAgBC,OAAO,GAAG,GAA1B;IAA+BC,QAAQ,GAAG,GAA1C;IAA+CC;EAA/C,IAA8EJ,MAApF;EAAA,MAAoEK,YAApE,iCAAoFL,MAApF;;EACA,MAAMM,UAAU,GAAGT,MAAM,CAAC,IAAIC,QAAQ,CAACS,KAAb,CAAmBN,SAAnB,CAAD,CAAN,CAAsCO,OAAzD;EAEA,MAAMC,SAAS,GAAGb,WAAW,CAAC,MAAM;IAClCE,QAAQ,CAACY,MAAT,CAAgBJ,UAAhB,eACKD,YADL;MAEEH,OAFF;MAGEC,QAHF;MAIEQ,eAAe,EAAE;IAJnB,IAKGC,KALH,CAKS,CAAC;MAACC;IAAD,CAAD,KAAgB;MACvB,IAAIA,QAAJ,EAAc;QACZT,UAAU;MACX;IACF,CATD;EAUD,CAX4B,EAW1B,CAACA,UAAD,EAAaD,QAAb,EAAuBE,YAAvB,EAAqCH,OAArC,EAA8CI,UAA9C,CAX0B,CAA7B;EAaA,OAAO;IAACG,SAAD;IAAYK,SAAS,EAAE;MAACC,SAAS,EAAE,CAAC;QAACT;MAAD,CAAD;IAAZ;EAAvB,CAAP;AACD,CAlBD;;AAoBA,eAAeP,sBAAf"}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { Animated } from 'react-native';
|
|
2
|
-
declare type Params = Omit<Animated.TimingAnimationConfig, 'useNativeDriver' | 'toValue'> & {
|
|
3
|
-
onFadeInFinished?: () => void;
|
|
4
|
-
onFadeOutFinished?: () => void;
|
|
5
|
-
};
|
|
6
|
-
declare const useUpdateOpacity: (params?: Params) => {
|
|
7
|
-
fadeIn: () => void;
|
|
8
|
-
fadeOut: () => void;
|
|
9
|
-
animatedOpacity: {
|
|
10
|
-
opacity: Animated.Value;
|
|
11
|
-
};
|
|
12
|
-
};
|
|
13
|
-
export default useUpdateOpacity;
|
|
14
|
-
//# sourceMappingURL=use-update-opacity.native.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"use-update-opacity.native.d.ts","sourceRoot":"","sources":["../../src/behaviours/use-update-opacity.native.tsx"],"names":[],"mappings":"AACA,OAAO,EAAC,QAAQ,EAAC,MAAM,cAAc,CAAC;AAEtC,aAAK,MAAM,GAAG,IAAI,CAAC,QAAQ,CAAC,qBAAqB,EAAE,iBAAiB,GAAG,SAAS,CAAC,GAAG;IAClF,gBAAgB,CAAC,EAAE,MAAM,IAAI,CAAC;IAC9B,iBAAiB,CAAC,EAAE,MAAM,IAAI,CAAC;CAChC,CAAC;AAEF,QAAA,MAAM,gBAAgB,YAAY,MAAM;;;;;;CAgCvC,CAAC;AAEF,eAAe,gBAAgB,CAAC"}
|