@coorpacademy/components 11.0.0 → 11.0.2

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.
Files changed (92) hide show
  1. package/es/atom/picture/index.js +5 -8
  2. package/es/atom/picture/index.js.map +1 -1
  3. package/es/molecule/card-congrats/index.native.d.ts.map +1 -1
  4. package/es/molecule/card-congrats/index.native.js.map +1 -1
  5. package/es/molecule/discipline-scope/index.d.ts +1 -0
  6. package/es/molecule/forum/forum-comment/index.d.ts +1 -0
  7. package/es/molecule/forum/forum-comment/index.d.ts.map +1 -1
  8. package/es/molecule/forum/forum-comment/index.js +5 -2
  9. package/es/molecule/forum/forum-comment/index.js.map +1 -1
  10. package/es/molecule/forum/forum-post/index.d.ts +2 -0
  11. package/es/molecule/forum/forum-post/index.d.ts.map +1 -1
  12. package/es/molecule/forum/forum-post/index.js +8 -1
  13. package/es/molecule/forum/forum-post/index.js.map +1 -1
  14. package/es/molecule/review-correction-popin/index.native.d.ts.map +1 -1
  15. package/es/molecule/review-correction-popin/index.native.js +8 -9
  16. package/es/molecule/review-correction-popin/index.native.js.map +1 -1
  17. package/es/molecule/scope-content/index.d.ts +1 -0
  18. package/es/organism/discussion/index.d.ts +1 -0
  19. package/es/organism/discussion/index.d.ts.map +1 -1
  20. package/es/organism/discussion/index.js +4 -1
  21. package/es/organism/discussion/index.js.map +1 -1
  22. package/es/organism/review-congrats/index.native.d.ts.map +1 -1
  23. package/es/organism/review-congrats/index.native.js +60 -67
  24. package/es/organism/review-congrats/index.native.js.map +1 -1
  25. package/es/organism/review-slide/index.native.d.ts.map +1 -1
  26. package/es/organism/review-slide/index.native.js +10 -6
  27. package/es/organism/review-slide/index.native.js.map +1 -1
  28. package/es/organism/review-slide/prop-types.d.ts +2 -0
  29. package/es/organism/review-slide/prop-types.d.ts.map +1 -1
  30. package/es/organism/review-slide/prop-types.js.map +1 -1
  31. package/es/organism/review-stacked-slides/index.native.d.ts +1 -1
  32. package/es/organism/review-stacked-slides/index.native.d.ts.map +1 -1
  33. package/es/organism/review-stacked-slides/index.native.js +85 -12
  34. package/es/organism/review-stacked-slides/index.native.js.map +1 -1
  35. package/es/template/app-player/popin-end/index.d.ts +1 -0
  36. package/es/template/app-player/popin-end/summary.d.ts +1 -0
  37. package/es/template/common/discipline/index.d.ts +1 -0
  38. package/lib/atom/picture/index.js +5 -8
  39. package/lib/atom/picture/index.js.map +1 -1
  40. package/lib/molecule/card-congrats/index.native.d.ts.map +1 -1
  41. package/lib/molecule/card-congrats/index.native.js.map +1 -1
  42. package/lib/molecule/discipline-scope/index.d.ts +1 -0
  43. package/lib/molecule/forum/forum-comment/index.d.ts +1 -0
  44. package/lib/molecule/forum/forum-comment/index.d.ts.map +1 -1
  45. package/lib/molecule/forum/forum-comment/index.js +5 -2
  46. package/lib/molecule/forum/forum-comment/index.js.map +1 -1
  47. package/lib/molecule/forum/forum-post/index.d.ts +2 -0
  48. package/lib/molecule/forum/forum-post/index.d.ts.map +1 -1
  49. package/lib/molecule/forum/forum-post/index.js +8 -1
  50. package/lib/molecule/forum/forum-post/index.js.map +1 -1
  51. package/lib/molecule/review-correction-popin/index.native.d.ts.map +1 -1
  52. package/lib/molecule/review-correction-popin/index.native.js +9 -10
  53. package/lib/molecule/review-correction-popin/index.native.js.map +1 -1
  54. package/lib/molecule/scope-content/index.d.ts +1 -0
  55. package/lib/organism/discussion/index.d.ts +1 -0
  56. package/lib/organism/discussion/index.d.ts.map +1 -1
  57. package/lib/organism/discussion/index.js +4 -1
  58. package/lib/organism/discussion/index.js.map +1 -1
  59. package/lib/organism/review-congrats/index.native.d.ts.map +1 -1
  60. package/lib/organism/review-congrats/index.native.js +60 -68
  61. package/lib/organism/review-congrats/index.native.js.map +1 -1
  62. package/lib/organism/review-slide/index.native.d.ts.map +1 -1
  63. package/lib/organism/review-slide/index.native.js +11 -7
  64. package/lib/organism/review-slide/index.native.js.map +1 -1
  65. package/lib/organism/review-slide/prop-types.d.ts +2 -0
  66. package/lib/organism/review-slide/prop-types.d.ts.map +1 -1
  67. package/lib/organism/review-slide/prop-types.js.map +1 -1
  68. package/lib/organism/review-stacked-slides/index.native.d.ts +1 -1
  69. package/lib/organism/review-stacked-slides/index.native.d.ts.map +1 -1
  70. package/lib/organism/review-stacked-slides/index.native.js +85 -12
  71. package/lib/organism/review-stacked-slides/index.native.js.map +1 -1
  72. package/lib/template/app-player/popin-end/index.d.ts +1 -0
  73. package/lib/template/app-player/popin-end/summary.d.ts +1 -0
  74. package/lib/template/common/discipline/index.d.ts +1 -0
  75. package/locales/.mtslconfig.json +1 -0
  76. package/package.json +3 -2
  77. package/es/behaviours/use-translate-vertically.native.d.ts +0 -16
  78. package/es/behaviours/use-translate-vertically.native.d.ts.map +0 -1
  79. package/es/behaviours/use-translate-vertically.native.js +0 -44
  80. package/es/behaviours/use-translate-vertically.native.js.map +0 -1
  81. package/es/behaviours/use-update-opacity.native.d.ts +0 -14
  82. package/es/behaviours/use-update-opacity.native.d.ts.map +0 -1
  83. package/es/behaviours/use-update-opacity.native.js +0 -55
  84. package/es/behaviours/use-update-opacity.native.js.map +0 -1
  85. package/lib/behaviours/use-translate-vertically.native.d.ts +0 -16
  86. package/lib/behaviours/use-translate-vertically.native.d.ts.map +0 -1
  87. package/lib/behaviours/use-translate-vertically.native.js +0 -51
  88. package/lib/behaviours/use-translate-vertically.native.js.map +0 -1
  89. package/lib/behaviours/use-update-opacity.native.d.ts +0 -14
  90. package/lib/behaviours/use-update-opacity.native.d.ts.map +0 -1
  91. package/lib/behaviours/use-update-opacity.native.js +0 -62
  92. package/lib/behaviours/use-update-opacity.native.js.map +0 -1
@@ -3,15 +3,14 @@ import _noop from "lodash/fp/noop";
3
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
4
 
5
5
  import React, { useEffect, useRef, useState } from 'react';
6
- import { Animated, ScrollView, StyleSheet, Text, useWindowDimensions, View } from 'react-native';
6
+ import { Animated, ScrollView, StyleSheet, Text } from 'react-native';
7
7
  import LottieView from 'lottie-react-native';
8
8
  import { NovaCompositionCoorpacademyStar as StarIcon, NovaSolidVoteRewardsRewardsBadge5 as RankIcon } from '@coorpacademy/nova-icons';
9
+ import { sequence, parallel, useAnimateProp, useTranslateY, useTranslateX } from '@coorpacademy/react-native-animation';
9
10
  import { useTemplateContext } from '../../template/app-review/template-context';
10
11
  import Button from '../../atom/button/index.native';
11
12
  import { BOX_STYLE } from '../../variables/shadow';
12
13
  import CardCongrats from '../../molecule/card-congrats/index.native';
13
- import useTranslateVertically from '../../behaviours/use-translate-vertically.native';
14
- import useUpdateOpacity from '../../behaviours/use-update-opacity.native';
15
14
 
16
15
  const createStyleSheet = theme => StyleSheet.create({
17
16
  congrats: {
@@ -53,6 +52,19 @@ const createStyleSheet = theme => StyleSheet.create({
53
52
  }
54
53
  });
55
54
 
55
+ const fadeIn = {
56
+ property: 'opacity',
57
+ fromValue: 0,
58
+ toValue: 1,
59
+ duration: 350
60
+ };
61
+ const translateHorizontally = {
62
+ property: 'translateX',
63
+ fromValue: 180,
64
+ toValue: 0,
65
+ duration: 800
66
+ };
67
+
56
68
  const ReviewCongrats = props => {
57
69
  const {
58
70
  'aria-label': ariaLabel,
@@ -66,76 +78,53 @@ const ReviewCongrats = props => {
66
78
  const {
67
79
  theme
68
80
  } = useTemplateContext();
69
- const {
70
- height: windowHeight
71
- } = useWindowDimensions();
72
81
  const [styleSheet, setStylesheet] = useState(null);
73
82
  const [isCongratsTranslationDone, setCongratsTranslationDone] = useState(false);
74
83
  const [isRankShown, setRankShown] = useState(false);
75
- const {
76
- translate: translateCongratsUp,
77
- animatedY: animatedCongratsY
78
- } = useTranslateVertically({
79
- fromValue: windowHeight,
80
- toValue: 0,
81
- delay: 750,
82
- onFinished: () => {
84
+ const scrollViewRef = useRef(null);
85
+ const showCongrats = useAnimateProp({
86
+ property: 'opacity',
87
+ fromValue: 0,
88
+ toValue: 1,
89
+ duration: 950,
90
+ onComplete: () => {
83
91
  setCongratsTranslationDone(true);
84
92
  }
85
93
  });
86
- const {
87
- translate: translateRankUp,
88
- animatedY: animatedRankY
89
- } = useTranslateVertically({
90
- fromValue: 150,
91
- duration: 750,
92
- toValue: 0
94
+ const translateCongrats = useTranslateY({
95
+ fromValue: 100,
96
+ toValue: 0,
97
+ duration: 550
93
98
  });
94
- const {
95
- fadeIn: showRank,
96
- animatedOpacity: animatedRankOpacity
97
- } = useUpdateOpacity({
98
- onFadeInFinished: () => {
99
+ const showConfettis = useAnimateProp(fadeIn);
100
+ const fadeInRank = useAnimateProp(fadeIn);
101
+ const translateRank = useTranslateX(_extends({}, translateHorizontally, {
102
+ onComplete: () => {
99
103
  setRankShown(true);
104
+ setTimeout(() => {
105
+ scrollViewRef?.current?.scrollToEnd();
106
+ }, 700);
100
107
  }
101
- });
102
- const scrollViewRef = useRef(null);
103
- const {
104
- translate: translateStarsUp,
105
- animatedY: animatedStarsY
106
- } = useTranslateVertically({
107
- fromValue: 150,
108
- toValue: 0,
109
- duration: 750,
110
- delay: 250
111
- });
112
- const {
113
- fadeIn: showStars,
114
- animatedOpacity: animatedStarsOpacity
115
- } = useUpdateOpacity({
116
- delay: 250
117
- });
108
+ }));
109
+ const animatedRank = [fadeInRank.animatedStyle, translateRank.animatedStyle];
110
+ const fadeInStars = useAnimateProp(_extends({}, fadeIn, {
111
+ delay: 1000
112
+ }));
113
+ const translateStars = useTranslateX(_extends({}, translateHorizontally, {
114
+ delay: 1000
115
+ }));
116
+ const showButton1 = useAnimateProp(fadeIn);
117
+ const showButton2 = useAnimateProp(fadeIn);
118
+ const congratsSequence = sequence([parallel([showCongrats, translateCongrats]), parallel([showConfettis, fadeInRank, translateRank]), parallel([fadeInStars, translateStars]), sequence([showButton1, showButton2])]);
119
+ useEffect(() => {
120
+ congratsSequence.start(); // (required only once on mount)
121
+ // eslint-disable-next-line react-hooks/exhaustive-deps
122
+ }, []);
118
123
  useEffect(() => {
119
124
  const _stylesheet = createStyleSheet(theme);
120
125
 
121
126
  setStylesheet(_stylesheet);
122
127
  }, [theme]);
123
- useEffect(() => {
124
- translateCongratsUp();
125
- }, []);
126
- useEffect(() => {
127
- if (isCongratsTranslationDone) {
128
- showRank();
129
- translateRankUp();
130
- }
131
- }, [isCongratsTranslationDone, showRank, translateRankUp]);
132
- useEffect(() => {
133
- if (isRankShown) {
134
- scrollViewRef?.current?.scrollToEnd();
135
- translateStarsUp();
136
- showStars();
137
- }
138
- }, [isRankShown, translateStarsUp, showStars]);
139
128
 
140
129
  if (!styleSheet) {
141
130
  return null;
@@ -144,7 +133,7 @@ const ReviewCongrats = props => {
144
133
  const handleContinueRevisingPress = buttonRevising?.onClick || _noop;
145
134
  const handleReviseAnotherSkillPress = buttonRevisingSkill?.onClick || _noop;
146
135
  return /*#__PURE__*/React.createElement(Animated.View, {
147
- style: [styleSheet.congrats, animatedCongratsY],
136
+ style: [styleSheet.congrats, translateCongrats.animatedStyle, showCongrats.animatedStyle],
148
137
  accessibilityLabel: ariaLabel
149
138
  }, /*#__PURE__*/React.createElement(Text, {
150
139
  style: styleSheet.title
@@ -155,7 +144,7 @@ const ReviewCongrats = props => {
155
144
  style: styleSheet.scrollView,
156
145
  contentContainerStyle: styleSheet.scrollViewContent
157
146
  }, cardCongratsRank ? /*#__PURE__*/React.createElement(Animated.View, {
158
- style: [animatedRankOpacity, animatedRankY]
147
+ style: animatedRank
159
148
  }, /*#__PURE__*/React.createElement(CardCongrats, {
160
149
  animationUri: cardCongratsRank.animationLottie.animationSrc,
161
150
  text: cardCongratsRank.reviewCardTitle,
@@ -165,7 +154,7 @@ const ReviewCongrats = props => {
165
154
  textColor: theme.colors.text.primary,
166
155
  direction: "row-reverse"
167
156
  })) : null, /*#__PURE__*/React.createElement(Animated.View, {
168
- style: [animatedStarsOpacity, animatedStarsY]
157
+ style: [fadeInStars.animatedStyle, translateStars.animatedStyle]
169
158
  }, /*#__PURE__*/React.createElement(CardCongrats, {
170
159
  animationUri: isRankShown ? cardCongratsStar.animationLottie.animationSrc : null,
171
160
  Icon: StarIcon,
@@ -174,9 +163,11 @@ const ReviewCongrats = props => {
174
163
  iconColor: theme.colors.battle,
175
164
  textColor: theme.colors.battle,
176
165
  direction: "row"
177
- }))), /*#__PURE__*/React.createElement(View, {
166
+ }))), /*#__PURE__*/React.createElement(Animated.View, {
178
167
  style: styleSheet.buttons
179
- }, buttonRevisingSkill ? /*#__PURE__*/React.createElement(Button, {
168
+ }, buttonRevisingSkill ? /*#__PURE__*/React.createElement(Animated.View, {
169
+ style: showButton1.animatedStyle
170
+ }, /*#__PURE__*/React.createElement(Button, {
180
171
  onPress: handleReviseAnotherSkillPress,
181
172
  accessibilityLabel: buttonRevisingSkill['aria-label'],
182
173
  submitValue: buttonRevisingSkill.label,
@@ -186,13 +177,15 @@ const ReviewCongrats = props => {
186
177
  textStyle: {
187
178
  color: '#123'
188
179
  }
189
- }) : null, buttonRevising ? /*#__PURE__*/React.createElement(Button, {
180
+ })) : null, buttonRevising ? /*#__PURE__*/React.createElement(Animated.View, {
181
+ style: showButton2.animatedStyle
182
+ }, /*#__PURE__*/React.createElement(Button, {
190
183
  onPress: handleContinueRevisingPress,
191
184
  accessibilityLabel: buttonRevising['aria-label'],
192
185
  submitValue: buttonRevising.label
193
- }) : null), isCongratsTranslationDone ? /*#__PURE__*/React.createElement(View, {
186
+ })) : null), isCongratsTranslationDone ? /*#__PURE__*/React.createElement(Animated.View, {
194
187
  pointerEvents: "none",
195
- style: styleSheet.confettis
188
+ style: [styleSheet.confettis, showConfettis.animatedStyle]
196
189
  }, /*#__PURE__*/React.createElement(LottieView, {
197
190
  source: {
198
191
  uri: animationLottie.animationSrc
@@ -1 +1 @@
1
- {"version":3,"file":"index.native.js","names":["React","useEffect","useRef","useState","Animated","ScrollView","StyleSheet","Text","useWindowDimensions","View","LottieView","NovaCompositionCoorpacademyStar","StarIcon","NovaSolidVoteRewardsRewardsBadge5","RankIcon","useTemplateContext","Button","BOX_STYLE","CardCongrats","useTranslateVertically","useUpdateOpacity","createStyleSheet","theme","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","windowHeight","styleSheet","setStylesheet","isCongratsTranslationDone","setCongratsTranslationDone","isRankShown","setRankShown","translate","translateCongratsUp","animatedY","animatedCongratsY","fromValue","toValue","delay","onFinished","translateRankUp","animatedRankY","duration","fadeIn","showRank","animatedOpacity","animatedRankOpacity","onFadeInFinished","scrollViewRef","translateStarsUp","animatedStarsY","showStars","animatedStarsOpacity","_stylesheet","current","scrollToEnd","handleContinueRevisingPress","onClick","handleReviseAnotherSkillPress","animationSrc","reviewCardTitle","reviewCardValue","rankSuffix","positive","battle","label","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,OAAOA,KAAP,IAAeC,SAAf,EAA0BC,MAA1B,EAAkCC,QAAlC,QAAiD,OAAjD;AACA,SACEC,QADF,EAEEC,UAFF,EAGEC,UAHF,EAIEC,IAJF,EAMEC,mBANF,EAOEC,IAPF,QASO,cATP;AAUA,OAAOC,UAAP,MAAuB,qBAAvB;AAEA,SACEC,+BAA+B,IAAIC,QADrC,EAEEC,iCAAiC,IAAIC,QAFvC,QAGO,0BAHP;AAKA,SAAQC,kBAAR,QAAiC,4CAAjC;AAEA,OAAOC,MAAP,MAAmB,gCAAnB;AACA,SAAQC,SAAR,QAAwB,wBAAxB;AACA,OAAOC,YAAP,MAAyB,2CAAzB;AACA,OAAOC,sBAAP,MAAmC,kDAAnC;AACA,OAAOC,gBAAP,MAA6B,4CAA7B;;AAYA,MAAMC,gBAAgB,GAAIC,KAAD,IACvBhB,UAAU,CAACiB,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,C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CAACd;EAA7C,gBACE,oBAAC,UAAD;IAAY,MAAM,EAAE;MAACuD,GAAG,EAAE/C,eAAe,CAACuC;IAAtB,CAApB;IAAyD,QAAQ,MAAjE;IAAkE,IAAI,EAAE;EAAxE,EADF,CADwB,GAItB,IA1DN,CADF;AA8DD,CAjJD;;AAmJA,eAAe1C,cAAf"}
1
+ {"version":3,"file":"index.native.js","names":["React","useEffect","useRef","useState","Animated","ScrollView","StyleSheet","Text","LottieView","NovaCompositionCoorpacademyStar","StarIcon","NovaSolidVoteRewardsRewardsBadge5","RankIcon","sequence","parallel","useAnimateProp","useTranslateY","useTranslateX","useTemplateContext","Button","BOX_STYLE","CardCongrats","createStyleSheet","theme","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","styleSheet","setStylesheet","isCongratsTranslationDone","setCongratsTranslationDone","isRankShown","setRankShown","scrollViewRef","showCongrats","onComplete","translateCongrats","showConfettis","fadeInRank","translateRank","setTimeout","current","scrollToEnd","animatedRank","animatedStyle","fadeInStars","delay","translateStars","showButton1","showButton2","congratsSequence","start","_stylesheet","handleContinueRevisingPress","onClick","handleReviseAnotherSkillPress","animationSrc","reviewCardTitle","reviewCardValue","rankSuffix","positive","battle","label","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,OAAOA,KAAP,IAAeC,SAAf,EAA0BC,MAA1B,EAAkCC,QAAlC,QAAiD,OAAjD;AACA,SAAQC,QAAR,EAAkBC,UAAlB,EAA8BC,UAA9B,EAA0CC,IAA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C,eAAe,CAACkC;IAAtB,CAApB;IAAyD,QAAQ,MAAjE;IAAkE,IAAI,EAAE;EAAxE,EAJF,CADwB,GAOtB,IApEN,CADF;AAwED,CA/JD;;AAiKA,eAAerC,cAAf"}
@@ -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;AA6JtE,QAAA,MAAM,KAAK,UAAW,gBAAgB,gBA8CrC,CAAC;AAEF,eAAe,KAAK,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"}
@@ -2,12 +2,12 @@ import React, { useEffect, useState } from 'react';
2
2
  import { Animated, Easing, StyleSheet, useWindowDimensions, View } from 'react-native';
3
3
  import get from 'lodash/fp/get';
4
4
  import getOr from 'lodash/fp/getOr';
5
+ import { useTranslateY } from '@coorpacademy/react-native-animation';
5
6
  import Text from '../../atom/text/index.native';
6
7
  import Answer from '../../molecule/answer/index.native';
7
8
  import ReviewCorrectionPopin from '../../molecule/review-correction-popin/index.native';
8
9
  import { useTemplateContext } from '../../template/app-review/template-context';
9
10
  import Button from '../../atom/button/index.native';
10
- import useTranslateVertically from '../../behaviours/use-translate-vertically.native';
11
11
  const styles = StyleSheet.create({
12
12
  correctionPopinWrapper: {
13
13
  position: 'absolute',
@@ -22,12 +22,13 @@ const CorrectionPopin = ({
22
22
  showCorrectionPopin,
23
23
  animateCorrectionPopin
24
24
  }) => {
25
- const translateUp = useTranslateVertically({
25
+ const translateUp = useTranslateY({
26
26
  fromValue: 1000,
27
27
  toValue: 0,
28
28
  duration: 800,
29
29
  easing: Easing.bezier(0.37, 0, 0.63, 1)
30
30
  });
31
+ useEffect(() => translateUp.start(), []);
31
32
  if (!showCorrectionPopin) return null;
32
33
  const klf = getOr(undefined, 'klf', correctionPopinProps);
33
34
  const information = getOr({
@@ -48,7 +49,7 @@ const CorrectionPopin = ({
48
49
  type: correctionPopinProps.type,
49
50
  resultLabel: correctionPopinProps.resultLabel
50
51
  };
51
- const style = animateCorrectionPopin ? [styles.correctionPopinWrapper, translateUp.animatedY] : styles.correctionPopinWrapper;
52
+ const style = animateCorrectionPopin ? [styles.correctionPopinWrapper, translateUp.animatedStyle] : styles.correctionPopinWrapper;
52
53
  return /*#__PURE__*/React.createElement(Animated.View, {
53
54
  style: style
54
55
  }, /*#__PURE__*/React.createElement(ReviewCorrectionPopin, _correctionPopinProps));
@@ -145,6 +146,7 @@ const createSlideStyle = (num, screenWidth) => {
145
146
 
146
147
  const Slide = props => {
147
148
  const {
149
+ animatedStyle,
148
150
  slide,
149
151
  correctionPopinProps,
150
152
  validateButton,
@@ -165,14 +167,16 @@ const Slide = props => {
165
167
  } = slide;
166
168
 
167
169
  if (loading) {
168
- return /*#__PURE__*/React.createElement(Text, null, "@todo loader ", num);
170
+ return /*#__PURE__*/React.createElement(View, {
171
+ style: slideStyle.slide
172
+ });
169
173
  }
170
174
 
171
175
  const {
172
176
  onClick: handleValidatePress
173
177
  } = validateButton;
174
- return /*#__PURE__*/React.createElement(View, {
175
- style: slideStyle.slide
178
+ return /*#__PURE__*/React.createElement(Animated.View, {
179
+ style: [slideStyle.slide, animatedStyle]
176
180
  }, /*#__PURE__*/React.createElement(Question, {
177
181
  questionOrigin: parentContentTitle,
178
182
  questionText: questionText,
@@ -1 +1 @@
1
- {"version":3,"file":"index.native.js","names":["React","useEffect","useState","Animated","Easing","StyleSheet","useWindowDimensions","View","get","getOr","Text","Answer","ReviewCorrectionPopin","useTemplateContext","Button","useTranslateVertically","styles","create","correctionPopinWrapper","position","bottom","width","CorrectionPopin","correctionPopinProps","slideIndex","showCorrectionPopin","animateCorrectionPopin","translateUp","fromValue","toValue","duration","easing","bezier","klf","undefined","information","label","message","next","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","setStyle","questionStyle","createSlideStyle","num","screenWidth","slideWidth","slide","left","backgroundColor","height","alignItems","padding","shadowColor","shadowOffset","shadowOpacity","shadowRadius","elevation","borderRadius","Slide","validateButton","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,OAAOA,KAAP,IAAeC,SAAf,EAA0BC,QAA1B,QAAyC,OAAzC;AACA,SACEC,QADF,EAE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C,IAAD,yBAAoBlB,GAApB,CAAP;EACD;;EAED,MAAM;IAACpC,OAAO,EAAEwD;EAAV,IAAiCJ,cAAvC;EAEA,oBACE,oBAAC,IAAD;IAAM,KAAK,EAAEC,UAAU,CAACd;EAAxB,gBACE,oBAAC,QAAD;IACE,cAAc,EAAEgB,kBADlB;IAEE,YAAY,EAAEhC,YAFhB;IAGE,QAAQ,EAAES,QAHZ;IAIE,GAAG,EAAC;EAJN,EADF,eAOE,oBAAC,MAAD;IACE,QAAQ,EAAEoB,cAAc,CAACK,QAD3B;IAEE,WAAW,EAAEL,cAAc,CAACvD,KAF9B;IAGE,OAAO,EAAE2D,mBAHX;IAIE,MAAM,EAAG,yBAAwBvE,UAAW;EAJ9C,EAPF,EAaGD,oBAAoB,gBACnB,oBAAC,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;;AAgDA,eAAegE,KAAf"}
1
+ {"version":3,"file":"index.native.js","names":["React","useEffect","useState","Animated","Easing","StyleSheet","useWindowDimensions","View","get","getOr","useTranslateY","Text","Answer","ReviewCorrectionPopin","useTemplateContext","Button","styles","create","correctionPopinWrapper","position","bottom","width","CorrectionPopin","correctionPopinProps","slideIndex","showCorrectionPopin","animateCorrectionPopin","translateUp","fromValue","toValue","duration","easing","bezier","start","klf","undefined","information","label","message","next","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","setStyle","questionStyle","createSlideStyle","num","screenWidth","slideWidth","slide","left","backgroundColor","height","alignItems","padding","shadowColor","shadowOffset","shadowOpacity","shadowRadius","elevation","borderRadius","Slide","validateButton","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 {animatedStyle, 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 <View style={slideStyle.slide} />;\n }\n\n const {onClick: handleValidatePress} = validateButton;\n\n return (\n <Animated.View style={[slideStyle.slide, animatedStyle]}>\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 </Animated.View>\n );\n};\n\nexport default Slide;\n"],"mappings":"AAAA,OAAOA,KAAP,IAAeC,SAAf,EAA0BC,QAA1B,QAAyC,OAAzC;AACA,SACEC,QADF,EAEEC,MAFF,EAGEC,UAHF,EAKEC,mBALF,EAMEC,IANF,QAQO,cARP;AASA,OAAOC,GAAP,MAAgB,eAAhB;AACA,OAAOC,KAAP,MAAkB,iBAAlB;AACA,SAAQC,aAAR,QAA4B,sCAA5B;AACA,OAAOC,IAAP,MAAiB,8BAAjB;AACA,OAAOC,MAAP,MAAmB,oCAAnB;AACA,OAAOC,qBAAP,MAAkC,qDAAlC;AACA,SAAQC,kBAAR,QAAiC,4CAAjC;AA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nB;EAAtB,gBACE,oBAAC,QAAD;IACE,cAAc,EAAEkD,kBADlB;IAEE,YAAY,EAAEhC,YAFhB;IAGE,QAAQ,EAAES,QAHZ;IAIE,GAAG,EAAC;EAJN,EADF,eAOE,oBAAC,MAAD;IACE,QAAQ,EAAEoB,cAAc,CAACK,QAD3B;IAEE,WAAW,EAAEL,cAAc,CAACvD,KAF9B;IAGE,OAAO,EAAE2D,mBAHX;IAIE,MAAM,EAAG,yBAAwBxE,UAAW;EAJ9C,EAPF,EAaGD,oBAAoB,gBACnB,oBAAC,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;;AAgDA,eAAeiE,KAAf"}
@@ -1,4 +1,5 @@
1
1
  import PropTypes from 'prop-types';
2
+ import type { Animation } from '@coorpacademy/react-native-animation';
2
3
  import { ReviewCorrectionPopinProps } from '../../molecule/review-correction-popin/prop-types';
3
4
  import { AnswerProps } from '../../molecule/answer/prop-types';
4
5
  import { TemplateContextValues } from '../../template/app-review/template-context';
@@ -210,6 +211,7 @@ export declare type ReviewSlideProps = {
210
211
  onClick: () => void;
211
212
  disabled: boolean;
212
213
  };
214
+ animatedStyle?: Animation['animatedStyle'][];
213
215
  };
214
216
  export declare type Fixture = {
215
217
  props: ReviewSlideProps;
@@ -1 +1 @@
1
- {"version":3,"file":"prop-types.d.ts","sourceRoot":"","sources":["../../../src/organism/review-slide/prop-types.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,YAAY,CAAC;AACnC,OAAuC,EACrC,0BAA0B,EAC3B,MAAM,mDAAmD,CAAC;AAC3D,OAAwB,EAAC,WAAW,EAAC,MAAM,kCAAkC,CAAC;AAC9E,OAAO,EAAC,qBAAqB,EAAC,MAAM,4CAA4C,CAAC;AAEjF,eAAO,MAA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;IACvB,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,OAAO,CAAC;IACjB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,aAAa,CAAC,EAAE,SAAS,GAAG,SAAS,CAAC;IACtC,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,sBAAsB,CAAC,EAAE,OAAO,CAAC;IACjC,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,EAAE,WAAW,CAAC;CACxB,CAAC;AAEF,oBAAY,gBAAgB,GAAG;IAC7B,UAAU,EAAE,MAAM,CAAC;IACnB,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,UAAU,CAAC;IAClB,oBAAoB,CAAC,EAAE,0BAA0B,CAAC;IAClD,cAAc,EAAE;QACd,KAAK,EAAE,MAAM,CAAC;QACd,OAAO,EAAE,MAAM,IAAI,CAAC;QACpB,QAAQ,EAAE,OAAO,CAAC;KACnB,CAAC;IACF,aAAa,CAAC,EAAE,SAAS,CAAC,eAAe,CAAC,EAAE,CAAC;CAC9C,CAAC;AAEF,oBAAY,OAAO,GAAG;IAAC,KAAK,EAAE,gBAAgB,CAAC;IAAC,aAAa,CAAC,EAAE,qBAAqB,CAAA;CAAC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"prop-types.js","names":["PropTypes","ReviewCorrectionPopinPropTypes","AnswerPropTypes","SlidePropsTypes","shape","position","number","loading","bool","loadingAriaLabel","string","animationType","isCorrect","animateCorrectionPopin","showCorrectionPopin","disableContent","parentContentTitle","questionText","answerUI","propTypes","slideIndex","slide","validateButton","label","isRequired","onClick","func","disabled","correctionPopinProps","klf","information","next","resultLabel","type"],"sources":["../../../src/organism/review-slide/prop-types.ts"],"sourcesContent":["import PropTypes from 'prop-types';\nimport ReviewCorrectionPopinPropTypes, {\n ReviewCorrectionPopinProps\n} from '../../molecule/review-correction-popin/prop-types';\nimport AnswerPropTypes, {AnswerProps} from '../../molecule/answer/prop-types';\nimport {TemplateContextValues} from '../../template/app-review/template-context';\n\nexport const SlidePropsTypes = PropTypes.shape({\n position: PropTypes.number,\n loading: PropTypes.bool,\n loadingAriaLabel: PropTypes.string,\n animationType: PropTypes.string, // 'unstack' | 'restack'\n isCorrect: PropTypes.bool,\n animateCorrectionPopin: PropTypes.bool,\n showCorrectionPopin: PropTypes.bool,\n disableContent: PropTypes.bool,\n parentContentTitle: PropTypes.string,\n questionText: PropTypes.string,\n answerUI: PropTypes.shape(AnswerPropTypes)\n});\n\nconst propTypes = {\n slideIndex: PropTypes.string,\n slide: SlidePropsTypes,\n validateButton: PropTypes.shape({\n label: PropTypes.string.isRequired,\n onClick: PropTypes.func.isRequired,\n disabled: PropTypes.bool\n }),\n correctionPopinProps: PropTypes.shape({\n klf: ReviewCorrectionPopinPropTypes.klf,\n information: ReviewCorrectionPopinPropTypes.information,\n next: PropTypes.shape({\n label: PropTypes.string,\n 'aria-label': PropTypes.string // Pourquoi le onClick du next n'est pas ici !\n // updateSlidesOnNext: PropTypes.func.isRequired ???\n }),\n resultLabel: ReviewCorrectionPopinPropTypes.resultLabel,\n type: ReviewCorrectionPopinPropTypes.type\n })\n};\n\nexport default propTypes;\n\nexport type PopinProps = {\n correctionPopinProps: ReviewCorrectionPopinProps;\n slideIndex: string;\n showCorrectionPopin?: boolean;\n animateCorrectionPopin?: boolean;\n};\n\nexport type ValidateButtonProps = {\n slideIndex: string;\n validateButton: ReviewSlideProps['validateButton'];\n primarySkinColor?: string;\n};\n\nexport type SlideProps = {\n position: number;\n loading: boolean;\n loadingAriaLabel?: string;\n animationType?: 'unstack' | 'restack';\n isCorrect?: boolean;\n animateCorrectionPopin?: boolean;\n showCorrectionPopin?: boolean;\n parentContentTitle?: string;\n questionText?: string;\n answerUI?: AnswerProps;\n};\n\nexport type ReviewSlideProps = {\n slideIndex: string;\n num: number;\n slide: SlideProps;\n correctionPopinProps?: ReviewCorrectionPopinProps;\n validateButton: {\n label: string;\n onClick: () => void;\n disabled: boolean;\n };\n};\n\nexport type Fixture = {props: ReviewSlideProps; mobileContext?: TemplateContextValues};\n"],"mappings":"AAAA,OAAOA,SAAP,MAAsB,YAAtB;AACA,OAAOC,8BAAP,MAEO,mDAFP;AAGA,OAAOC,eAAP,MAA2C,kCAA3C;AAGA,OAAO,MAAMC,eAAe,GAAGH,SAAS,CAACI,KAAV,CAAgB;EAC7CC,QAAQ,EAAEL,SAAS,CAACM,MADyB;EAE7CC,OAAO,EAAEP,SAAS,CAACQ,IAF0B;EAG7CC,gBAAgB,EAAET,SAAS,CAACU,MAHiB;EAI7CC,aAAa,EAAEX,SAAS,CAACU,MAJoB;EAIZ;EACjCE,SAAS,EAAEZ,SAAS,CAACQ,IALwB;EAM7CK,sBAAsB,EAAEb,SAAS,CAACQ,IANW;EAO7CM,mBAAmB,EAAEd,SAAS,CAACQ,IAPc;EAQ7CO,cAAc,EAAEf,SAAS,CAACQ,IARmB;EAS7CQ,kBAAkB,EAAEhB,SAAS,CAACU,MATe;EAU7CO,YAAY,EAAEjB,SAAS,CAACU,MAVqB;EAW7CQ,QAAQ,EAAElB,SAAS,CAACI,KAAV,CAAgBF,eAAhB;AAXmC,CAAhB,CAAxB;AAcP,MAAMiB,SAAS,GAAG;EAChBC,UAAU,EAAEpB,SAAS,CAACU,MADN;EAEhBW,KAAK,EAAElB,eAFS;EAGhBmB,cAAc,EAAEtB,SAAS,CAACI,KAAV,CAAgB;IAC9BmB,KAAK,EAAEvB,SAAS,CAACU,MAAV,CAAiBc,UADM;IAE9BC,OAAO,EAAEzB,SAAS,CAAC0B,IAAV,CAAeF,UAFM;IAG9BG,QAAQ,EAAE3B,SAAS,CAACQ;EAHU,CAAhB,CAHA;EAQhBoB,oBAAoB,EAAE5B,SAAS,CAACI,KAAV,CAAgB;IACpCyB,GAAG,EAAE5B,8BAA8B,CAAC4B,GADA;IAEpCC,WAAW,EAAE7B,8BAA8B,CAAC6B,WAFR;IAGpCC,IAAI,EAAE/B,SAAS,CAACI,KAAV,CAAgB;MACpBmB,KAAK,EAAEvB,SAAS,CAACU,MADG;MAEpB,cAAcV,SAAS,CAACU,MAFJ,CAEW;MAC/B;;IAHoB,CAAhB,CAH8B;IAQpCsB,WAAW,EAAE/B,8BAA8B,CAAC+B,WARR;IASpCC,IAAI,EAAEhC,8BAA8B,CAACgC;EATD,CAAhB;AARN,CAAlB;AAqBA,eAAed,SAAf"}
1
+ {"version":3,"file":"prop-types.js","names":["PropTypes","ReviewCorrectionPopinPropTypes","AnswerPropTypes","SlidePropsTypes","shape","position","number","loading","bool","loadingAriaLabel","string","animationType","isCorrect","animateCorrectionPopin","showCorrectionPopin","disableContent","parentContentTitle","questionText","answerUI","propTypes","slideIndex","slide","validateButton","label","isRequired","onClick","func","disabled","correctionPopinProps","klf","information","next","resultLabel","type"],"sources":["../../../src/organism/review-slide/prop-types.ts"],"sourcesContent":["import PropTypes from 'prop-types';\nimport type {Animation} from '@coorpacademy/react-native-animation';\nimport ReviewCorrectionPopinPropTypes, {\n ReviewCorrectionPopinProps\n} from '../../molecule/review-correction-popin/prop-types';\nimport AnswerPropTypes, {AnswerProps} from '../../molecule/answer/prop-types';\nimport {TemplateContextValues} from '../../template/app-review/template-context';\n\nexport const SlidePropsTypes = PropTypes.shape({\n position: PropTypes.number,\n loading: PropTypes.bool,\n loadingAriaLabel: PropTypes.string,\n animationType: PropTypes.string, // 'unstack' | 'restack'\n isCorrect: PropTypes.bool,\n animateCorrectionPopin: PropTypes.bool,\n showCorrectionPopin: PropTypes.bool,\n disableContent: PropTypes.bool,\n parentContentTitle: PropTypes.string,\n questionText: PropTypes.string,\n answerUI: PropTypes.shape(AnswerPropTypes)\n});\n\nconst propTypes = {\n slideIndex: PropTypes.string,\n slide: SlidePropsTypes,\n validateButton: PropTypes.shape({\n label: PropTypes.string.isRequired,\n onClick: PropTypes.func.isRequired,\n disabled: PropTypes.bool\n }),\n correctionPopinProps: PropTypes.shape({\n klf: ReviewCorrectionPopinPropTypes.klf,\n information: ReviewCorrectionPopinPropTypes.information,\n next: PropTypes.shape({\n label: PropTypes.string,\n 'aria-label': PropTypes.string // Pourquoi le onClick du next n'est pas ici !\n // updateSlidesOnNext: PropTypes.func.isRequired ???\n }),\n resultLabel: ReviewCorrectionPopinPropTypes.resultLabel,\n type: ReviewCorrectionPopinPropTypes.type\n })\n};\n\nexport default propTypes;\n\nexport type PopinProps = {\n correctionPopinProps: ReviewCorrectionPopinProps;\n slideIndex: string;\n showCorrectionPopin?: boolean;\n animateCorrectionPopin?: boolean;\n};\n\nexport type ValidateButtonProps = {\n slideIndex: string;\n validateButton: ReviewSlideProps['validateButton'];\n primarySkinColor?: string;\n};\n\nexport type SlideProps = {\n position: number;\n loading: boolean;\n loadingAriaLabel?: string;\n animationType?: 'unstack' | 'restack';\n isCorrect?: boolean;\n animateCorrectionPopin?: boolean;\n showCorrectionPopin?: boolean;\n parentContentTitle?: string;\n questionText?: string;\n answerUI?: AnswerProps;\n};\n\nexport type ReviewSlideProps = {\n slideIndex: string;\n num: number;\n slide: SlideProps;\n correctionPopinProps?: ReviewCorrectionPopinProps;\n validateButton: {\n label: string;\n onClick: () => void;\n disabled: boolean;\n };\n animatedStyle?: Animation['animatedStyle'][];\n};\n\nexport type Fixture = {props: ReviewSlideProps; mobileContext?: TemplateContextValues};\n"],"mappings":"AAAA,OAAOA,SAAP,MAAsB,YAAtB;AAEA,OAAOC,8BAAP,MAEO,mDAFP;AAGA,OAAOC,eAAP,MAA2C,kCAA3C;AAGA,OAAO,MAAMC,eAAe,GAAGH,SAAS,CAACI,KAAV,CAAgB;EAC7CC,QAAQ,EAAEL,SAAS,CAACM,MADyB;EAE7CC,OAAO,EAAEP,SAAS,CAACQ,IAF0B;EAG7CC,gBAAgB,EAAET,SAAS,CAACU,MAHiB;EAI7CC,aAAa,EAAEX,SAAS,CAACU,MAJoB;EAIZ;EACjCE,SAAS,EAAEZ,SAAS,CAACQ,IALwB;EAM7CK,sBAAsB,EAAEb,SAAS,CAACQ,IANW;EAO7CM,mBAAmB,EAAEd,SAAS,CAACQ,IAPc;EAQ7CO,cAAc,EAAEf,SAAS,CAACQ,IARmB;EAS7CQ,kBAAkB,EAAEhB,SAAS,CAACU,MATe;EAU7CO,YAAY,EAAEjB,SAAS,CAACU,MAVqB;EAW7CQ,QAAQ,EAAElB,SAAS,CAACI,KAAV,CAAgBF,eAAhB;AAXmC,CAAhB,CAAxB;AAcP,MAAMiB,SAAS,GAAG;EAChBC,UAAU,EAAEpB,SAAS,CAACU,MADN;EAEhBW,KAAK,EAAElB,eAFS;EAGhBmB,cAAc,EAAEtB,SAAS,CAACI,KAAV,CAAgB;IAC9BmB,KAAK,EAAEvB,SAAS,CAACU,MAAV,CAAiBc,UADM;IAE9BC,OAAO,EAAEzB,SAAS,CAAC0B,IAAV,CAAeF,UAFM;IAG9BG,QAAQ,EAAE3B,SAAS,CAACQ;EAHU,CAAhB,CAHA;EAQhBoB,oBAAoB,EAAE5B,SAAS,CAACI,KAAV,CAAgB;IACpCyB,GAAG,EAAE5B,8BAA8B,CAAC4B,GADA;IAEpCC,WAAW,EAAE7B,8BAA8B,CAAC6B,WAFR;IAGpCC,IAAI,EAAE/B,SAAS,CAACI,KAAV,CAAgB;MACpBmB,KAAK,EAAEvB,SAAS,CAACU,MADG;MAEpB,cAAcV,SAAS,CAACU,MAFJ,CAEW;MAC/B;;IAHoB,CAAhB,CAH8B;IAQpCsB,WAAW,EAAE/B,8BAA8B,CAAC+B,WARR;IASpCC,IAAI,EAAEhC,8BAA8B,CAACgC;EATD,CAAhB;AARN,CAAlB;AAqBA,eAAed,SAAf"}
@@ -1,5 +1,5 @@
1
1
  /// <reference types="react" />
2
- import { ReviewStackProps } from './prop-types';
2
+ import type { ReviewStackProps } from './prop-types';
3
3
  export declare const TOTAL_SLIDES_STACK = 5;
4
4
  declare const StackedSlides: (props: ReviewStackProps) => JSX.Element;
5
5
  export default StackedSlides;
@@ -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,gBA+B7C,CAAC;AAEF,eAAe,aAAa,CAAC"}
1
+ {"version":3,"file":"index.native.d.ts","sourceRoot":"","sources":["../../../src/organism/review-stacked-slides/index.native.tsx"],"names":[],"mappings":";AAMA,OAAO,KAAK,EAAC,gBAAgB,EAAC,MAAM,cAAc,CAAC;AAEnD,eAAO,MAAM,kBAAkB,IAAI,CAAC;AAyBpC,QAAA,MAAM,aAAa,UAAW,gBAAgB,gBA0G7C,CAAC;AAEF,eAAe,aAAa,CAAC"}
@@ -1,8 +1,8 @@
1
- import React, { useEffect } from 'react';
1
+ import React, { useEffect, useState } from 'react';
2
2
  import { Animated, StyleSheet, useWindowDimensions } from 'react-native';
3
3
  import keys from 'lodash/fp/keys';
4
+ import { useTranslateY } from '@coorpacademy/react-native-animation';
4
5
  import Slide from '../review-slide/index.native';
5
- import useTranslateVertically from '../../behaviours/use-translate-vertically.native';
6
6
  export const TOTAL_SLIDES_STACK = 5;
7
7
  const style = StyleSheet.create({
8
8
  slides: {
@@ -12,29 +12,86 @@ const style = StyleSheet.create({
12
12
  }
13
13
  });
14
14
 
15
+ const FakeSlide = ({
16
+ position,
17
+ validateButton
18
+ }) => /*#__PURE__*/React.createElement(Slide, {
19
+ num: position,
20
+ slide: {
21
+ loading: true,
22
+ position
23
+ },
24
+ slideIndex: `${position}`,
25
+ validateButton: validateButton
26
+ });
27
+ /*
28
+ - slides are ordered to be played from left to right: [0,1,2,3]
29
+ - slides are piled on the view, so we need to reverse the order:
30
+ -> it's like our eye is looking from the right [3,2,1,0] <-- oO
31
+ */
32
+
33
+
15
34
  const StackedSlides = props => {
16
35
  const {
17
36
  height: windowHeight
18
37
  } = useWindowDimensions();
19
38
  const {
39
+ endReview,
20
40
  slides,
21
41
  validateButton,
22
42
  correctionPopinProps
23
43
  } = props;
24
- const {
25
- translate,
26
- animatedY
27
- } = useTranslateVertically({
44
+ const [unstacked, setUnstacked] = useState([]);
45
+ const [restacked, setRestacked] = useState();
46
+ const hideSlides = useTranslateY({
28
47
  fromValue: 0,
29
48
  toValue: windowHeight,
30
49
  duration: 800
31
50
  });
32
- useEffect(translate, [translate]);
33
- const indexes = keys(slides).reverse();
34
- const stackedSlides = indexes.map(slideIndex => {
51
+ const translateDown = useTranslateY({
52
+ fromValue: 0,
53
+ toValue: windowHeight - 100,
54
+ duration: 1000
55
+ });
56
+ useEffect(() => {
57
+ if (endReview) {
58
+ hideSlides.start();
59
+ }
60
+ }, [endReview, hideSlides]);
61
+ const restackingSlide = keys(slides).find(k => slides[k].animationType === 'restack');
62
+ const unstackingSlide = keys(slides).find(k => slides[k].animationType === 'unstack');
63
+ const remainingKeys = keys(slides).filter(k => slides[k].position >= 0 && !slides[k].animationType);
64
+ const orderedKeys = remainingKeys.sort((k1, k2) => slides[k2].position > slides[k1].position ? 1 : -1);
65
+ const animatedSlide = restackingSlide || unstackingSlide;
66
+ useEffect(() => {
67
+ if (restacked && orderedKeys.includes(restacked)) {
68
+ setRestacked(null);
69
+ } // this effect is required only when the list orderedKeys changes
70
+ // eslint-disable-next-line react-hooks/exhaustive-deps
71
+
72
+ }, [orderedKeys.toString()]);
73
+ useEffect(() => {
74
+ const unstacking = unstackingSlide && !unstacked.includes(unstackingSlide);
75
+
76
+ if (unstacking) {
77
+ translateDown.start(() => {
78
+ setUnstacked([...unstacked, unstackingSlide]);
79
+ });
80
+ }
81
+ }, [unstackingSlide, unstacked, setUnstacked, translateDown]);
82
+ useEffect(() => {
83
+ const restacking = restackingSlide && restacked !== restackingSlide;
84
+
85
+ if (restacking) {
86
+ translateDown.start(() => {
87
+ setRestacked(restackingSlide);
88
+ });
89
+ }
90
+ }, [restackingSlide, restacked, setRestacked, translateDown]);
91
+ const stackedSlides = orderedKeys.map((slideIndex, index) => {
35
92
  const slide = slides[slideIndex];
36
93
  return /*#__PURE__*/React.createElement(Slide, {
37
- num: Number.parseInt(slideIndex),
94
+ num: orderedKeys.length - index,
38
95
  slideIndex,
39
96
  slide,
40
97
  validateButton,
@@ -42,9 +99,25 @@ const StackedSlides = props => {
42
99
  key: slideIndex
43
100
  });
44
101
  });
102
+
103
+ if (animatedSlide) {
104
+ stackedSlides.push( /*#__PURE__*/React.createElement(Slide, {
105
+ num: 0,
106
+ slideIndex: animatedSlide,
107
+ slide: slides[animatedSlide],
108
+ validateButton,
109
+ correctionPopinProps,
110
+ animatedStyle: [translateDown.animatedStyle],
111
+ key: animatedSlide
112
+ }));
113
+ }
114
+
45
115
  return /*#__PURE__*/React.createElement(Animated.View, {
46
- style: [style.slides, animatedY]
47
- }, stackedSlides);
116
+ style: [style.slides, hideSlides.animatedStyle]
117
+ }, restacked ? /*#__PURE__*/React.createElement(FakeSlide, {
118
+ position: orderedKeys.length + 1,
119
+ validateButton: validateButton
120
+ }) : null, stackedSlides);
48
121
  };
49
122
 
50
123
  export default StackedSlides;