@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
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
const _excluded = ["duration", "onFadeInFinished", "onFadeOutFinished"];
|
|
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 useUpdateOpacity = (params = {}) => {
|
|
11
|
-
const {
|
|
12
|
-
duration = 750,
|
|
13
|
-
onFadeInFinished,
|
|
14
|
-
onFadeOutFinished
|
|
15
|
-
} = params,
|
|
16
|
-
othersParams = _objectWithoutPropertiesLoose(params, _excluded);
|
|
17
|
-
|
|
18
|
-
const fadeAnim = useRef(new Animated.Value(0)).current;
|
|
19
|
-
const fadeIn = useCallback(() => {
|
|
20
|
-
Animated.timing(fadeAnim, _extends({}, othersParams, {
|
|
21
|
-
toValue: 1,
|
|
22
|
-
duration,
|
|
23
|
-
useNativeDriver: true
|
|
24
|
-
})).start(({
|
|
25
|
-
finished
|
|
26
|
-
}) => {
|
|
27
|
-
if (finished) {
|
|
28
|
-
onFadeInFinished?.();
|
|
29
|
-
}
|
|
30
|
-
});
|
|
31
|
-
}, [duration, fadeAnim, onFadeInFinished, othersParams]);
|
|
32
|
-
const fadeOut = useCallback(() => {
|
|
33
|
-
Animated.timing(fadeAnim, _extends({}, othersParams, {
|
|
34
|
-
toValue: 0,
|
|
35
|
-
duration,
|
|
36
|
-
useNativeDriver: true
|
|
37
|
-
})).start(({
|
|
38
|
-
finished
|
|
39
|
-
}) => {
|
|
40
|
-
if (finished) {
|
|
41
|
-
onFadeOutFinished?.();
|
|
42
|
-
}
|
|
43
|
-
});
|
|
44
|
-
}, [duration, fadeAnim, onFadeOutFinished, othersParams]);
|
|
45
|
-
return {
|
|
46
|
-
fadeIn,
|
|
47
|
-
fadeOut,
|
|
48
|
-
animatedOpacity: {
|
|
49
|
-
opacity: fadeAnim
|
|
50
|
-
}
|
|
51
|
-
};
|
|
52
|
-
};
|
|
53
|
-
|
|
54
|
-
export default useUpdateOpacity;
|
|
55
|
-
//# sourceMappingURL=use-update-opacity.native.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"use-update-opacity.native.js","names":["useCallback","useRef","Animated","useUpdateOpacity","params","duration","onFadeInFinished","onFadeOutFinished","othersParams","fadeAnim","Value","current","fadeIn","timing","toValue","useNativeDriver","start","finished","fadeOut","animatedOpacity","opacity"],"sources":["../../src/behaviours/use-update-opacity.native.tsx"],"sourcesContent":["import {useCallback, useRef} from 'react';\nimport {Animated} from 'react-native';\n\ntype Params = Omit<Animated.TimingAnimationConfig, 'useNativeDriver' | 'toValue'> & {\n onFadeInFinished?: () => void;\n onFadeOutFinished?: () => void;\n};\n\nconst useUpdateOpacity = (params: Params = {}) => {\n const {duration = 750, onFadeInFinished, onFadeOutFinished, ...othersParams} = params;\n\n const fadeAnim = useRef(new Animated.Value(0)).current;\n\n const fadeIn = useCallback(() => {\n Animated.timing(fadeAnim, {\n ...othersParams,\n toValue: 1,\n duration,\n useNativeDriver: true\n }).start(({finished}) => {\n if (finished) {\n onFadeInFinished?.();\n }\n });\n }, [duration, fadeAnim, onFadeInFinished, othersParams]);\n\n const fadeOut = useCallback(() => {\n Animated.timing(fadeAnim, {\n ...othersParams,\n toValue: 0,\n duration,\n useNativeDriver: true\n }).start(({finished}) => {\n if (finished) {\n onFadeOutFinished?.();\n }\n });\n }, [duration, fadeAnim, onFadeOutFinished, othersParams]);\n\n return {fadeIn, fadeOut, animatedOpacity: {opacity: fadeAnim}};\n};\n\nexport default useUpdateOpacity;\n"],"mappings":";;;;;;AAAA,SAAQA,WAAR,EAAqBC,MAArB,QAAkC,OAAlC;AACA,SAAQC,QAAR,QAAuB,cAAvB;;AAOA,MAAMC,gBAAgB,GAAG,CAACC,MAAc,GAAG,EAAlB,KAAyB;EAChD,MAAM;IAACC,QAAQ,GAAG,GAAZ;IAAiBC,gBAAjB;IAAmCC;EAAnC,IAAyEH,MAA/E;EAAA,MAA+DI,YAA/D,iCAA+EJ,MAA/E;;EAEA,MAAMK,QAAQ,GAAGR,MAAM,CAAC,IAAIC,QAAQ,CAACQ,KAAb,CAAmB,CAAnB,CAAD,CAAN,CAA8BC,OAA/C;EAEA,MAAMC,MAAM,GAAGZ,WAAW,CAAC,MAAM;IAC/BE,QAAQ,CAACW,MAAT,CAAgBJ,QAAhB,eACKD,YADL;MAEEM,OAAO,EAAE,CAFX;MAGET,QAHF;MAIEU,eAAe,EAAE;IAJnB,IAKGC,KALH,CAKS,CAAC;MAACC;IAAD,CAAD,KAAgB;MACvB,IAAIA,QAAJ,EAAc;QACZX,gBAAgB;MACjB;IACF,CATD;EAUD,CAXyB,EAWvB,CAACD,QAAD,EAAWI,QAAX,EAAqBH,gBAArB,EAAuCE,YAAvC,CAXuB,CAA1B;EAaA,MAAMU,OAAO,GAAGlB,WAAW,CAAC,MAAM;IAChCE,QAAQ,CAACW,MAAT,CAAgBJ,QAAhB,eACKD,YADL;MAEEM,OAAO,EAAE,CAFX;MAGET,QAHF;MAIEU,eAAe,EAAE;IAJnB,IAKGC,KALH,CAKS,CAAC;MAACC;IAAD,CAAD,KAAgB;MACvB,IAAIA,QAAJ,EAAc;QACZV,iBAAiB;MAClB;IACF,CATD;EAUD,CAX0B,EAWxB,CAACF,QAAD,EAAWI,QAAX,EAAqBF,iBAArB,EAAwCC,YAAxC,CAXwB,CAA3B;EAaA,OAAO;IAACI,MAAD;IAASM,OAAT;IAAkBC,eAAe,EAAE;MAACC,OAAO,EAAEX;IAAV;EAAnC,CAAP;AACD,CAhCD;;AAkCA,eAAeN,gBAAf"}
|
|
@@ -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,51 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
exports.__esModule = true;
|
|
4
|
-
exports.default = void 0;
|
|
5
|
-
|
|
6
|
-
var _react = require("react");
|
|
7
|
-
|
|
8
|
-
var _reactNative = require("react-native");
|
|
9
|
-
|
|
10
|
-
const _excluded = ["fromValue", "toValue", "duration", "onFinished"];
|
|
11
|
-
|
|
12
|
-
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); }
|
|
13
|
-
|
|
14
|
-
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; }
|
|
15
|
-
|
|
16
|
-
const useTranslateVertically = (params = {}) => {
|
|
17
|
-
const {
|
|
18
|
-
fromValue = 0,
|
|
19
|
-
toValue = 100,
|
|
20
|
-
duration = 550,
|
|
21
|
-
onFinished
|
|
22
|
-
} = params,
|
|
23
|
-
othersParams = _objectWithoutPropertiesLoose(params, _excluded);
|
|
24
|
-
|
|
25
|
-
const translateY = (0, _react.useRef)(new _reactNative.Animated.Value(fromValue)).current;
|
|
26
|
-
const translate = (0, _react.useCallback)(() => {
|
|
27
|
-
_reactNative.Animated.timing(translateY, _extends({}, othersParams, {
|
|
28
|
-
toValue,
|
|
29
|
-
duration,
|
|
30
|
-
useNativeDriver: true
|
|
31
|
-
})).start(({
|
|
32
|
-
finished
|
|
33
|
-
}) => {
|
|
34
|
-
if (finished) {
|
|
35
|
-
onFinished?.();
|
|
36
|
-
}
|
|
37
|
-
});
|
|
38
|
-
}, [onFinished, duration, othersParams, toValue, translateY]);
|
|
39
|
-
return {
|
|
40
|
-
translate,
|
|
41
|
-
animatedY: {
|
|
42
|
-
transform: [{
|
|
43
|
-
translateY
|
|
44
|
-
}]
|
|
45
|
-
}
|
|
46
|
-
};
|
|
47
|
-
};
|
|
48
|
-
|
|
49
|
-
var _default = useTranslateVertically;
|
|
50
|
-
exports.default = _default;
|
|
51
|
-
//# sourceMappingURL=use-translate-vertically.native.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"use-translate-vertically.native.js","names":["useTranslateVertically","params","fromValue","toValue","duration","onFinished","othersParams","translateY","useRef","Animated","Value","current","translate","useCallback","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;;AACA;;;;;;;;AAQA,MAAMA,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,GAAG,IAAAC,aAAA,EAAO,IAAIC,qBAAA,CAASC,KAAb,CAAmBR,SAAnB,CAAP,EAAsCS,OAAzD;EAEA,MAAMC,SAAS,GAAG,IAAAC,kBAAA,EAAY,MAAM;IAClCJ,qBAAA,CAASK,MAAT,CAAgBP,UAAhB,eACKD,YADL;MAEEH,OAFF;MAGEC,QAHF;MAIEW,eAAe,EAAE;IAJnB,IAKGC,KALH,CAKS,CAAC;MAACC;IAAD,CAAD,KAAgB;MACvB,IAAIA,QAAJ,EAAc;QACZZ,UAAU;MACX;IACF,CATD;EAUD,CAXiB,EAWf,CAACA,UAAD,EAAaD,QAAb,EAAuBE,YAAvB,EAAqCH,OAArC,EAA8CI,UAA9C,CAXe,CAAlB;EAaA,OAAO;IAACK,SAAD;IAAYM,SAAS,EAAE;MAACC,SAAS,EAAE,CAAC;QAACZ;MAAD,CAAD;IAAZ;EAAvB,CAAP;AACD,CAlBD;;eAoBeP,sB"}
|
|
@@ -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"}
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
exports.__esModule = true;
|
|
4
|
-
exports.default = void 0;
|
|
5
|
-
|
|
6
|
-
var _react = require("react");
|
|
7
|
-
|
|
8
|
-
var _reactNative = require("react-native");
|
|
9
|
-
|
|
10
|
-
const _excluded = ["duration", "onFadeInFinished", "onFadeOutFinished"];
|
|
11
|
-
|
|
12
|
-
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); }
|
|
13
|
-
|
|
14
|
-
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; }
|
|
15
|
-
|
|
16
|
-
const useUpdateOpacity = (params = {}) => {
|
|
17
|
-
const {
|
|
18
|
-
duration = 750,
|
|
19
|
-
onFadeInFinished,
|
|
20
|
-
onFadeOutFinished
|
|
21
|
-
} = params,
|
|
22
|
-
othersParams = _objectWithoutPropertiesLoose(params, _excluded);
|
|
23
|
-
|
|
24
|
-
const fadeAnim = (0, _react.useRef)(new _reactNative.Animated.Value(0)).current;
|
|
25
|
-
const fadeIn = (0, _react.useCallback)(() => {
|
|
26
|
-
_reactNative.Animated.timing(fadeAnim, _extends({}, othersParams, {
|
|
27
|
-
toValue: 1,
|
|
28
|
-
duration,
|
|
29
|
-
useNativeDriver: true
|
|
30
|
-
})).start(({
|
|
31
|
-
finished
|
|
32
|
-
}) => {
|
|
33
|
-
if (finished) {
|
|
34
|
-
onFadeInFinished?.();
|
|
35
|
-
}
|
|
36
|
-
});
|
|
37
|
-
}, [duration, fadeAnim, onFadeInFinished, othersParams]);
|
|
38
|
-
const fadeOut = (0, _react.useCallback)(() => {
|
|
39
|
-
_reactNative.Animated.timing(fadeAnim, _extends({}, othersParams, {
|
|
40
|
-
toValue: 0,
|
|
41
|
-
duration,
|
|
42
|
-
useNativeDriver: true
|
|
43
|
-
})).start(({
|
|
44
|
-
finished
|
|
45
|
-
}) => {
|
|
46
|
-
if (finished) {
|
|
47
|
-
onFadeOutFinished?.();
|
|
48
|
-
}
|
|
49
|
-
});
|
|
50
|
-
}, [duration, fadeAnim, onFadeOutFinished, othersParams]);
|
|
51
|
-
return {
|
|
52
|
-
fadeIn,
|
|
53
|
-
fadeOut,
|
|
54
|
-
animatedOpacity: {
|
|
55
|
-
opacity: fadeAnim
|
|
56
|
-
}
|
|
57
|
-
};
|
|
58
|
-
};
|
|
59
|
-
|
|
60
|
-
var _default = useUpdateOpacity;
|
|
61
|
-
exports.default = _default;
|
|
62
|
-
//# sourceMappingURL=use-update-opacity.native.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"use-update-opacity.native.js","names":["useUpdateOpacity","params","duration","onFadeInFinished","onFadeOutFinished","othersParams","fadeAnim","useRef","Animated","Value","current","fadeIn","useCallback","timing","toValue","useNativeDriver","start","finished","fadeOut","animatedOpacity","opacity"],"sources":["../../src/behaviours/use-update-opacity.native.tsx"],"sourcesContent":["import {useCallback, useRef} from 'react';\nimport {Animated} from 'react-native';\n\ntype Params = Omit<Animated.TimingAnimationConfig, 'useNativeDriver' | 'toValue'> & {\n onFadeInFinished?: () => void;\n onFadeOutFinished?: () => void;\n};\n\nconst useUpdateOpacity = (params: Params = {}) => {\n const {duration = 750, onFadeInFinished, onFadeOutFinished, ...othersParams} = params;\n\n const fadeAnim = useRef(new Animated.Value(0)).current;\n\n const fadeIn = useCallback(() => {\n Animated.timing(fadeAnim, {\n ...othersParams,\n toValue: 1,\n duration,\n useNativeDriver: true\n }).start(({finished}) => {\n if (finished) {\n onFadeInFinished?.();\n }\n });\n }, [duration, fadeAnim, onFadeInFinished, othersParams]);\n\n const fadeOut = useCallback(() => {\n Animated.timing(fadeAnim, {\n ...othersParams,\n toValue: 0,\n duration,\n useNativeDriver: true\n }).start(({finished}) => {\n if (finished) {\n onFadeOutFinished?.();\n }\n });\n }, [duration, fadeAnim, onFadeOutFinished, othersParams]);\n\n return {fadeIn, fadeOut, animatedOpacity: {opacity: fadeAnim}};\n};\n\nexport default useUpdateOpacity;\n"],"mappings":";;;;;AAAA;;AACA;;;;;;;;AAOA,MAAMA,gBAAgB,GAAG,CAACC,MAAc,GAAG,EAAlB,KAAyB;EAChD,MAAM;IAACC,QAAQ,GAAG,GAAZ;IAAiBC,gBAAjB;IAAmCC;EAAnC,IAAyEH,MAA/E;EAAA,MAA+DI,YAA/D,iCAA+EJ,MAA/E;;EAEA,MAAMK,QAAQ,GAAG,IAAAC,aAAA,EAAO,IAAIC,qBAAA,CAASC,KAAb,CAAmB,CAAnB,CAAP,EAA8BC,OAA/C;EAEA,MAAMC,MAAM,GAAG,IAAAC,kBAAA,EAAY,MAAM;IAC/BJ,qBAAA,CAASK,MAAT,CAAgBP,QAAhB,eACKD,YADL;MAEES,OAAO,EAAE,CAFX;MAGEZ,QAHF;MAIEa,eAAe,EAAE;IAJnB,IAKGC,KALH,CAKS,CAAC;MAACC;IAAD,CAAD,KAAgB;MACvB,IAAIA,QAAJ,EAAc;QACZd,gBAAgB;MACjB;IACF,CATD;EAUD,CAXc,EAWZ,CAACD,QAAD,EAAWI,QAAX,EAAqBH,gBAArB,EAAuCE,YAAvC,CAXY,CAAf;EAaA,MAAMa,OAAO,GAAG,IAAAN,kBAAA,EAAY,MAAM;IAChCJ,qBAAA,CAASK,MAAT,CAAgBP,QAAhB,eACKD,YADL;MAEES,OAAO,EAAE,CAFX;MAGEZ,QAHF;MAIEa,eAAe,EAAE;IAJnB,IAKGC,KALH,CAKS,CAAC;MAACC;IAAD,CAAD,KAAgB;MACvB,IAAIA,QAAJ,EAAc;QACZb,iBAAiB;MAClB;IACF,CATD;EAUD,CAXe,EAWb,CAACF,QAAD,EAAWI,QAAX,EAAqBF,iBAArB,EAAwCC,YAAxC,CAXa,CAAhB;EAaA,OAAO;IAACM,MAAD;IAASO,OAAT;IAAkBC,eAAe,EAAE;MAACC,OAAO,EAAEd;IAAV;EAAnC,CAAP;AACD,CAhCD;;eAkCeN,gB"}
|