@fountain-ui/lab 1.16.2 → 1.19.0

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/CHANGELOG.md CHANGED
@@ -3,6 +3,30 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ # [1.19.0](https://github.com/tappytoon/tappytoon/compare/@fountain-ui/lab@1.13.0...@fountain-ui/lab@1.19.0) (2022-03-21)
7
+
8
+ **Note:** Version bump only for package @fountain-ui/lab
9
+
10
+
11
+
12
+
13
+
14
+ # [1.18.0](https://github.com/tappytoon/tappytoon/compare/@fountain-ui/lab@1.13.0...@fountain-ui/lab@1.18.0) (2022-03-07)
15
+
16
+ **Note:** Version bump only for package @fountain-ui/lab
17
+
18
+
19
+
20
+
21
+
22
+ # [1.17.0](https://github.com/tappytoon/tappytoon/compare/@fountain-ui/lab@1.13.0...@fountain-ui/lab@1.17.0) (2022-01-25)
23
+
24
+ **Note:** Version bump only for package @fountain-ui/lab
25
+
26
+
27
+
28
+
29
+
6
30
  ## [1.16.2](https://github.com/tappytoon/tappytoon/compare/@fountain-ui/lab@1.13.0...@fountain-ui/lab@1.16.2) (2022-01-13)
7
31
 
8
32
  **Note:** Version bump only for package @fountain-ui/lab
@@ -0,0 +1,83 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = FlipCard;
7
+
8
+ var _react = _interopRequireWildcard(require("react"));
9
+
10
+ var _reactNative = require("react-native");
11
+
12
+ var _reactNativeReanimated = _interopRequireDefault(require("react-native-reanimated"));
13
+
14
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
15
+
16
+ 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); }
17
+
18
+ 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; }
19
+
20
+ const styles = _reactNative.StyleSheet.create({
21
+ container: {
22
+ height: 32,
23
+ width: 24
24
+ },
25
+ animatedCard: {
26
+ alignItems: 'center',
27
+ justifyContent: 'center',
28
+ position: 'absolute'
29
+ }
30
+ });
31
+
32
+ const PERSPECTIVE = 100;
33
+ const Z_INDEX_CHANGE_ANGLE = 90;
34
+
35
+ function FlipCard(props) {
36
+ const {
37
+ backCard,
38
+ frontCard,
39
+ reanimationKey,
40
+ style
41
+ } = props;
42
+
43
+ const sharedAngle = _reactNativeReanimated.default.useSharedValue(0);
44
+
45
+ const animatedFrontCardStyle = _reactNativeReanimated.default.useAnimatedStyle(() => {
46
+ return {
47
+ zIndex: sharedAngle.value < Z_INDEX_CHANGE_ANGLE ? 2 : 1,
48
+ transform: [{
49
+ perspective: PERSPECTIVE
50
+ }, {
51
+ rotateX: `${sharedAngle.value}deg`
52
+ }]
53
+ };
54
+ });
55
+
56
+ const animatedBackCardStyle = _reactNativeReanimated.default.useAnimatedStyle(() => {
57
+ return {
58
+ zIndex: sharedAngle.value <= Z_INDEX_CHANGE_ANGLE ? 1 : 2,
59
+ transform: [{
60
+ perspective: PERSPECTIVE
61
+ }, {
62
+ rotateX: `${sharedAngle.value + 180}deg`
63
+ }]
64
+ };
65
+ });
66
+
67
+ (0, _react.useEffect)(() => {
68
+ sharedAngle.value = 0;
69
+ sharedAngle.value = _reactNativeReanimated.default.withTiming(180, {
70
+ duration: 500
71
+ });
72
+ }, [reanimationKey]);
73
+ return /*#__PURE__*/_react.default.createElement(_reactNative.View, {
74
+ style: [styles.container, style]
75
+ }, /*#__PURE__*/_react.default.createElement(_reactNativeReanimated.default.View, {
76
+ style: [styles.animatedCard, animatedFrontCardStyle]
77
+ }, frontCard), /*#__PURE__*/_react.default.createElement(_reactNativeReanimated.default.View, {
78
+ style: [styles.animatedCard, animatedBackCardStyle]
79
+ }, backCard));
80
+ }
81
+
82
+ ;
83
+ //# sourceMappingURL=FlipCard.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["FlipCard.tsx"],"names":["styles","StyleSheet","create","container","height","width","animatedCard","alignItems","justifyContent","position","PERSPECTIVE","Z_INDEX_CHANGE_ANGLE","FlipCard","props","backCard","frontCard","reanimationKey","style","sharedAngle","Animated","useSharedValue","animatedFrontCardStyle","useAnimatedStyle","zIndex","value","transform","perspective","rotateX","animatedBackCardStyle","withTiming","duration"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;;;;;;;AAGA,MAAMA,MAAM,GAAGC,wBAAWC,MAAX,CAAkB;AAC7BC,EAAAA,SAAS,EAAE;AACPC,IAAAA,MAAM,EAAE,EADD;AAEPC,IAAAA,KAAK,EAAE;AAFA,GADkB;AAK7BC,EAAAA,YAAY,EAAE;AACVC,IAAAA,UAAU,EAAE,QADF;AAEVC,IAAAA,cAAc,EAAE,QAFN;AAGVC,IAAAA,QAAQ,EAAE;AAHA;AALe,CAAlB,CAAf;;AAYA,MAAMC,WAAW,GAAG,GAApB;AACA,MAAMC,oBAAoB,GAAG,EAA7B;;AAEe,SAASC,QAAT,CAAkBC,KAAlB,EAAwC;AACnD,QAAM;AACFC,IAAAA,QADE;AAEFC,IAAAA,SAFE;AAGFC,IAAAA,cAHE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6BAAC,8BAAD,CAAU,IAAV;AAAe,IAAA,KAAK,EAAE,CAACf,MAAM,CAACM,YAAR,EAAsBsB,qBAAtB;AAAtB,KACKd,QADL,CALJ,CADJ;AAWH;;AAAA","sourcesContent":["import React, { useEffect } from 'react';\nimport { StyleSheet, View } from 'react-native';\nimport Animated from 'react-native-reanimated';\nimport type FlipCardProps from './FlipCardProps';\n\nconst styles = StyleSheet.create({\n container: {\n height: 32,\n width: 24,\n },\n animatedCard: {\n alignItems: 'center',\n justifyContent: 'center',\n position: 'absolute',\n },\n});\n\nconst PERSPECTIVE = 100;\nconst Z_INDEX_CHANGE_ANGLE = 90;\n\nexport default function FlipCard(props: FlipCardProps) {\n const {\n backCard,\n frontCard,\n reanimationKey,\n style,\n } = props;\n\n const sharedAngle = Animated.useSharedValue(0);\n\n const animatedFrontCardStyle = Animated.useAnimatedStyle(() => {\n return {\n zIndex: sharedAngle.value < Z_INDEX_CHANGE_ANGLE ? 2 : 1,\n transform: [\n { perspective: PERSPECTIVE },\n { rotateX: `${sharedAngle.value}deg` },\n ],\n };\n });\n\n const animatedBackCardStyle = Animated.useAnimatedStyle(() => {\n return {\n zIndex: sharedAngle.value <= Z_INDEX_CHANGE_ANGLE ? 1 : 2,\n transform: [\n { perspective: PERSPECTIVE },\n { rotateX: `${(sharedAngle.value + 180)}deg` },\n ],\n };\n });\n\n useEffect(() => {\n sharedAngle.value = 0;\n sharedAngle.value = Animated.withTiming(180, { duration: 500 });\n }, [reanimationKey]);\n\n return (\n <View style={[styles.container, style]}>\n <Animated.View style={[styles.animatedCard, animatedFrontCardStyle]}>\n {frontCard}\n </Animated.View>\n\n <Animated.View style={[styles.animatedCard, animatedBackCardStyle]}>\n {backCard}\n </Animated.View>\n </View>\n );\n};"]}
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ //# sourceMappingURL=FlipCardProps.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","sourcesContent":[]}
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ Object.defineProperty(exports, "default", {
7
+ enumerable: true,
8
+ get: function () {
9
+ return _FlipCard.default;
10
+ }
11
+ });
12
+
13
+ var _FlipCard = _interopRequireDefault(require("./FlipCard"));
14
+
15
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
16
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA","sourcesContent":["export { default } from './FlipCard';\nexport type { default as FlipCardProps } from './FlipCardProps';"]}
@@ -7,6 +7,7 @@ var _exportNames = {
7
7
  BottomSheet: true,
8
8
  Carousel: true,
9
9
  DateTimePicker: true,
10
+ FlipCard: true,
10
11
  ViewPager: true,
11
12
  StatusBarProvider: true,
12
13
  useStatusBarContext: true
@@ -29,6 +30,12 @@ Object.defineProperty(exports, "DateTimePicker", {
29
30
  return _DateTimePicker.default;
30
31
  }
31
32
  });
33
+ Object.defineProperty(exports, "FlipCard", {
34
+ enumerable: true,
35
+ get: function () {
36
+ return _FlipCard.default;
37
+ }
38
+ });
32
39
  Object.defineProperty(exports, "ViewPager", {
33
40
  enumerable: true,
34
41
  get: function () {
@@ -90,6 +97,20 @@ Object.keys(_DateTimePicker).forEach(function (key) {
90
97
  });
91
98
  });
92
99
 
100
+ var _FlipCard = _interopRequireWildcard(require("./FlipCard"));
101
+
102
+ Object.keys(_FlipCard).forEach(function (key) {
103
+ if (key === "default" || key === "__esModule") return;
104
+ if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
105
+ if (key in exports && exports[key] === _FlipCard[key]) return;
106
+ Object.defineProperty(exports, key, {
107
+ enumerable: true,
108
+ get: function () {
109
+ return _FlipCard[key];
110
+ }
111
+ });
112
+ });
113
+
93
114
  var _ViewPager = _interopRequireWildcard(require("./ViewPager"));
94
115
 
95
116
  Object.keys(_ViewPager).forEach(function (key) {
@@ -1 +1 @@
1
- {"version":3,"sources":["index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AAEA;;AACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AAEA;;AACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AAEA;;AACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AAEA;;AACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AAEA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA","sourcesContent":["export { default as BottomSheet } from './BottomSheet';\nexport * from './BottomSheet';\n\nexport { default as Carousel } from './Carousel';\nexport * from './Carousel';\n\nexport { default as DateTimePicker } from './DateTimePicker';\nexport * from './DateTimePicker';\n\nexport { default as ViewPager } from './ViewPager';\nexport * from './ViewPager';\n\nexport { default as StatusBarProvider, useStatusBarContext } from './StatusBarProvider';\nexport * from './StatusBarProvider';\n\nexport * from './hooks';\n"]}
1
+ {"version":3,"sources":["index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AAEA;;AACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AAEA;;AACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AAEA;;AACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AAEA;;AACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AAEA;;AACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AAEA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA","sourcesContent":["export { default as BottomSheet } from './BottomSheet';\nexport * from './BottomSheet';\n\nexport { default as Carousel } from './Carousel';\nexport * from './Carousel';\n\nexport { default as DateTimePicker } from './DateTimePicker';\nexport * from './DateTimePicker';\n\nexport { default as FlipCard } from './FlipCard';\nexport * from './FlipCard';\n\nexport { default as ViewPager } from './ViewPager';\nexport * from './ViewPager';\n\nexport { default as StatusBarProvider, useStatusBarContext } from './StatusBarProvider';\nexport * from './StatusBarProvider';\n\nexport * from './hooks';\n"]}
@@ -0,0 +1,60 @@
1
+ import React, { useEffect } from 'react';
2
+ import { StyleSheet, View } from 'react-native';
3
+ import Animated from 'react-native-reanimated';
4
+ const styles = StyleSheet.create({
5
+ container: {
6
+ height: 32,
7
+ width: 24
8
+ },
9
+ animatedCard: {
10
+ alignItems: 'center',
11
+ justifyContent: 'center',
12
+ position: 'absolute'
13
+ }
14
+ });
15
+ const PERSPECTIVE = 100;
16
+ const Z_INDEX_CHANGE_ANGLE = 90;
17
+ export default function FlipCard(props) {
18
+ const {
19
+ backCard,
20
+ frontCard,
21
+ reanimationKey,
22
+ style
23
+ } = props;
24
+ const sharedAngle = Animated.useSharedValue(0);
25
+ const animatedFrontCardStyle = Animated.useAnimatedStyle(() => {
26
+ return {
27
+ zIndex: sharedAngle.value < Z_INDEX_CHANGE_ANGLE ? 2 : 1,
28
+ transform: [{
29
+ perspective: PERSPECTIVE
30
+ }, {
31
+ rotateX: `${sharedAngle.value}deg`
32
+ }]
33
+ };
34
+ });
35
+ const animatedBackCardStyle = Animated.useAnimatedStyle(() => {
36
+ return {
37
+ zIndex: sharedAngle.value <= Z_INDEX_CHANGE_ANGLE ? 1 : 2,
38
+ transform: [{
39
+ perspective: PERSPECTIVE
40
+ }, {
41
+ rotateX: `${sharedAngle.value + 180}deg`
42
+ }]
43
+ };
44
+ });
45
+ useEffect(() => {
46
+ sharedAngle.value = 0;
47
+ sharedAngle.value = Animated.withTiming(180, {
48
+ duration: 500
49
+ });
50
+ }, [reanimationKey]);
51
+ return /*#__PURE__*/React.createElement(View, {
52
+ style: [styles.container, style]
53
+ }, /*#__PURE__*/React.createElement(Animated.View, {
54
+ style: [styles.animatedCard, animatedFrontCardStyle]
55
+ }, frontCard), /*#__PURE__*/React.createElement(Animated.View, {
56
+ style: [styles.animatedCard, animatedBackCardStyle]
57
+ }, backCard));
58
+ }
59
+ ;
60
+ //# sourceMappingURL=FlipCard.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["FlipCard.tsx"],"names":["React","useEffect","StyleSheet","View","Animated","styles","create","container","height","width","animatedCard","alignItems","justifyContent","position","PERSPECTIVE","Z_INDEX_CHANGE_ANGLE","FlipCard","props","backCard","frontCard","reanimationKey","style","sharedAngle","useSharedValue","animatedFrontCardStyle","useAnimatedStyle","zIndex","value","transform","perspective","rotateX","animatedBackCardStyle","withTiming","duration"],"mappings":"AAAA,OAAOA,KAAP,IAAgBC,SAAhB,QAAiC,OAAjC;AACA,SAASC,UAAT,EAAqBC,IAArB,QAAiC,cAAjC;AACA,OAAOC,QAAP,MAAqB,yBAArB;AAGA,MAAMC,MAAM,GAAGH,UAAU,CAACI,MAAX,CAAkB;AAC7BC,EAAAA,SAAS,EAAE;AACPC,IAAAA,MAAM,EAAE,EADD;AAEPC,IAAAA,KAAK,EAAE;AAFA,GADkB;AAK7BC,EAAAA,YAAY,EAAE;AACVC,IAAAA,UAAU,EAAE,QADF;AAEVC,IAAAA,cAAc,EAAE,QAFN;AAGVC,IAAAA,QAAQ,EAAE;AAHA;AALe,CAAlB,CAAf;AAYA,MAAMC,WAAW,GAAG,GAApB;AACA,MAAMC,oBAAoB,GAAG,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E,CAACf,MAAM,CAACE,SAAR,EAAmBc,KAAnB;AAAb,kBACI,oBAAC,QAAD,CAAU,IAAV;AAAe,IAAA,KAAK,EAAE,CAAChB,MAAM,CAACK,YAAR,EAAsBc,sBAAtB;AAAtB,KACKL,SADL,CADJ,eAKI,oBAAC,QAAD,CAAU,IAAV;AAAe,IAAA,KAAK,EAAE,CAACd,MAAM,CAACK,YAAR,EAAsBqB,qBAAtB;AAAtB,KACKb,QADL,CALJ,CADJ;AAWH;AAAA","sourcesContent":["import React, { useEffect } from 'react';\nimport { StyleSheet, View } from 'react-native';\nimport Animated from 'react-native-reanimated';\nimport type FlipCardProps from './FlipCardProps';\n\nconst styles = StyleSheet.create({\n container: {\n height: 32,\n width: 24,\n },\n animatedCard: {\n alignItems: 'center',\n justifyContent: 'center',\n position: 'absolute',\n },\n});\n\nconst PERSPECTIVE = 100;\nconst Z_INDEX_CHANGE_ANGLE = 90;\n\nexport default function FlipCard(props: FlipCardProps) {\n const {\n backCard,\n frontCard,\n reanimationKey,\n style,\n } = props;\n\n const sharedAngle = Animated.useSharedValue(0);\n\n const animatedFrontCardStyle = Animated.useAnimatedStyle(() => {\n return {\n zIndex: sharedAngle.value < Z_INDEX_CHANGE_ANGLE ? 2 : 1,\n transform: [\n { perspective: PERSPECTIVE },\n { rotateX: `${sharedAngle.value}deg` },\n ],\n };\n });\n\n const animatedBackCardStyle = Animated.useAnimatedStyle(() => {\n return {\n zIndex: sharedAngle.value <= Z_INDEX_CHANGE_ANGLE ? 1 : 2,\n transform: [\n { perspective: PERSPECTIVE },\n { rotateX: `${(sharedAngle.value + 180)}deg` },\n ],\n };\n });\n\n useEffect(() => {\n sharedAngle.value = 0;\n sharedAngle.value = Animated.withTiming(180, { duration: 500 });\n }, [reanimationKey]);\n\n return (\n <View style={[styles.container, style]}>\n <Animated.View style={[styles.animatedCard, animatedFrontCardStyle]}>\n {frontCard}\n </Animated.View>\n\n <Animated.View style={[styles.animatedCard, animatedBackCardStyle]}>\n {backCard}\n </Animated.View>\n </View>\n );\n};"]}
@@ -0,0 +1,2 @@
1
+
2
+ //# sourceMappingURL=FlipCardProps.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","sourcesContent":[]}
@@ -0,0 +1,2 @@
1
+ export { default } from './FlipCard';
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["index.ts"],"names":["default"],"mappings":"AAAA,SAASA,OAAT,QAAwB,YAAxB","sourcesContent":["export { default } from './FlipCard';\nexport type { default as FlipCardProps } from './FlipCardProps';"]}
@@ -4,6 +4,8 @@ export { default as Carousel } from './Carousel';
4
4
  export * from './Carousel';
5
5
  export { default as DateTimePicker } from './DateTimePicker';
6
6
  export * from './DateTimePicker';
7
+ export { default as FlipCard } from './FlipCard';
8
+ export * from './FlipCard';
7
9
  export { default as ViewPager } from './ViewPager';
8
10
  export * from './ViewPager';
9
11
  export { default as StatusBarProvider, useStatusBarContext } from './StatusBarProvider';
@@ -1 +1 @@
1
- {"version":3,"sources":["index.ts"],"names":["default","BottomSheet","Carousel","DateTimePicker","ViewPager","StatusBarProvider","useStatusBarContext"],"mappings":"AAAA,SAASA,OAAO,IAAIC,WAApB,QAAuC,eAAvC;AACA,cAAc,eAAd;AAEA,SAASD,OAAO,IAAIE,QAApB,QAAoC,YAApC;AACA,cAAc,YAAd;AAEA,SAASF,OAAO,IAAIG,cAApB,QAA0C,kBAA1C;AACA,cAAc,kBAAd;AAEA,SAASH,OAAO,IAAII,SAApB,QAAqC,aAArC;AACA,cAAc,aAAd;AAEA,SAASJ,OAAO,IAAIK,iBAApB,EAAuCC,mBAAvC,QAAkE,qBAAlE;AACA,cAAc,qBAAd;AAEA,cAAc,SAAd","sourcesContent":["export { default as BottomSheet } from './BottomSheet';\nexport * from './BottomSheet';\n\nexport { default as Carousel } from './Carousel';\nexport * from './Carousel';\n\nexport { default as DateTimePicker } from './DateTimePicker';\nexport * from './DateTimePicker';\n\nexport { default as ViewPager } from './ViewPager';\nexport * from './ViewPager';\n\nexport { default as StatusBarProvider, useStatusBarContext } from './StatusBarProvider';\nexport * from './StatusBarProvider';\n\nexport * from './hooks';\n"]}
1
+ {"version":3,"sources":["index.ts"],"names":["default","BottomSheet","Carousel","DateTimePicker","FlipCard","ViewPager","StatusBarProvider","useStatusBarContext"],"mappings":"AAAA,SAASA,OAAO,IAAIC,WAApB,QAAuC,eAAvC;AACA,cAAc,eAAd;AAEA,SAASD,OAAO,IAAIE,QAApB,QAAoC,YAApC;AACA,cAAc,YAAd;AAEA,SAASF,OAAO,IAAIG,cAApB,QAA0C,kBAA1C;AACA,cAAc,kBAAd;AAEA,SAASH,OAAO,IAAII,QAApB,QAAoC,YAApC;AACA,cAAc,YAAd;AAEA,SAASJ,OAAO,IAAIK,SAApB,QAAqC,aAArC;AACA,cAAc,aAAd;AAEA,SAASL,OAAO,IAAIM,iBAApB,EAAuCC,mBAAvC,QAAkE,qBAAlE;AACA,cAAc,qBAAd;AAEA,cAAc,SAAd","sourcesContent":["export { default as BottomSheet } from './BottomSheet';\nexport * from './BottomSheet';\n\nexport { default as Carousel } from './Carousel';\nexport * from './Carousel';\n\nexport { default as DateTimePicker } from './DateTimePicker';\nexport * from './DateTimePicker';\n\nexport { default as FlipCard } from './FlipCard';\nexport * from './FlipCard';\n\nexport { default as ViewPager } from './ViewPager';\nexport * from './ViewPager';\n\nexport { default as StatusBarProvider, useStatusBarContext } from './StatusBarProvider';\nexport * from './StatusBarProvider';\n\nexport * from './hooks';\n"]}
@@ -0,0 +1,3 @@
1
+ /// <reference types="react" />
2
+ import type FlipCardProps from './FlipCardProps';
3
+ export default function FlipCard(props: FlipCardProps): JSX.Element;
@@ -0,0 +1,17 @@
1
+ import React from 'react';
2
+ import { ComponentProps } from '@fountain-ui/core';
3
+ export default interface FlipCardProps extends ComponentProps<{
4
+ /**
5
+ * Element placed on backSide
6
+ */
7
+ backCard: React.ReactElement;
8
+ /**
9
+ * Element placed on frontSide
10
+ */
11
+ frontCard: React.ReactElement;
12
+ /**
13
+ * The key to reanimate Component, usually includes card content
14
+ */
15
+ reanimationKey?: string;
16
+ }> {
17
+ }
@@ -0,0 +1,2 @@
1
+ export { default } from './FlipCard';
2
+ export type { default as FlipCardProps } from './FlipCardProps';
@@ -4,6 +4,8 @@ export { default as Carousel } from './Carousel';
4
4
  export * from './Carousel';
5
5
  export { default as DateTimePicker } from './DateTimePicker';
6
6
  export * from './DateTimePicker';
7
+ export { default as FlipCard } from './FlipCard';
8
+ export * from './FlipCard';
7
9
  export { default as ViewPager } from './ViewPager';
8
10
  export * from './ViewPager';
9
11
  export { default as StatusBarProvider, useStatusBarContext } from './StatusBarProvider';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fountain-ui/lab",
3
- "version": "1.16.2",
3
+ "version": "1.19.0",
4
4
  "private": false,
5
5
  "author": "Fountain-UI Team",
6
6
  "description": "Incubator for Fountain-UI React components.",
@@ -17,7 +17,7 @@
17
17
  "dependencies": {
18
18
  "@emotion/react": "^11.4.1",
19
19
  "@emotion/styled": "^11.0.0",
20
- "@fountain-ui/icons": "^1.15.2",
20
+ "@fountain-ui/icons": "^1.18.0",
21
21
  "@fountain-ui/utils": "^1.1.0",
22
22
  "react-native-calendars": "1.1267.0"
23
23
  },
@@ -53,7 +53,7 @@
53
53
  }
54
54
  },
55
55
  "devDependencies": {
56
- "@fountain-ui/core": "^1.14.2",
56
+ "@fountain-ui/core": "^1.17.0",
57
57
  "@gorhom/bottom-sheet": "4.1.3",
58
58
  "@react-native-community/viewpager": "^4.2.2",
59
59
  "@types/react-native-snap-carousel": "^3.8.4",
@@ -85,5 +85,5 @@
85
85
  "publishConfig": {
86
86
  "access": "public"
87
87
  },
88
- "gitHead": "2453b78c3d7ff484fc25ea0663e33a681942f910"
88
+ "gitHead": "f1c8ecff8e5819a3cf723236e0f626cc921cb9d3"
89
89
  }
@@ -0,0 +1,67 @@
1
+ import React, { useEffect } from 'react';
2
+ import { StyleSheet, View } from 'react-native';
3
+ import Animated from 'react-native-reanimated';
4
+ import type FlipCardProps from './FlipCardProps';
5
+
6
+ const styles = StyleSheet.create({
7
+ container: {
8
+ height: 32,
9
+ width: 24,
10
+ },
11
+ animatedCard: {
12
+ alignItems: 'center',
13
+ justifyContent: 'center',
14
+ position: 'absolute',
15
+ },
16
+ });
17
+
18
+ const PERSPECTIVE = 100;
19
+ const Z_INDEX_CHANGE_ANGLE = 90;
20
+
21
+ export default function FlipCard(props: FlipCardProps) {
22
+ const {
23
+ backCard,
24
+ frontCard,
25
+ reanimationKey,
26
+ style,
27
+ } = props;
28
+
29
+ const sharedAngle = Animated.useSharedValue(0);
30
+
31
+ const animatedFrontCardStyle = Animated.useAnimatedStyle(() => {
32
+ return {
33
+ zIndex: sharedAngle.value < Z_INDEX_CHANGE_ANGLE ? 2 : 1,
34
+ transform: [
35
+ { perspective: PERSPECTIVE },
36
+ { rotateX: `${sharedAngle.value}deg` },
37
+ ],
38
+ };
39
+ });
40
+
41
+ const animatedBackCardStyle = Animated.useAnimatedStyle(() => {
42
+ return {
43
+ zIndex: sharedAngle.value <= Z_INDEX_CHANGE_ANGLE ? 1 : 2,
44
+ transform: [
45
+ { perspective: PERSPECTIVE },
46
+ { rotateX: `${(sharedAngle.value + 180)}deg` },
47
+ ],
48
+ };
49
+ });
50
+
51
+ useEffect(() => {
52
+ sharedAngle.value = 0;
53
+ sharedAngle.value = Animated.withTiming(180, { duration: 500 });
54
+ }, [reanimationKey]);
55
+
56
+ return (
57
+ <View style={[styles.container, style]}>
58
+ <Animated.View style={[styles.animatedCard, animatedFrontCardStyle]}>
59
+ {frontCard}
60
+ </Animated.View>
61
+
62
+ <Animated.View style={[styles.animatedCard, animatedBackCardStyle]}>
63
+ {backCard}
64
+ </Animated.View>
65
+ </View>
66
+ );
67
+ };
@@ -0,0 +1,19 @@
1
+ import React from 'react';
2
+ import { ComponentProps } from '@fountain-ui/core';
3
+
4
+ export default interface FlipCardProps extends ComponentProps<{
5
+ /**
6
+ * Element placed on backSide
7
+ */
8
+ backCard: React.ReactElement;
9
+
10
+ /**
11
+ * Element placed on frontSide
12
+ */
13
+ frontCard: React.ReactElement;
14
+
15
+ /**
16
+ * The key to reanimate Component, usually includes card content
17
+ */
18
+ reanimationKey?: string;
19
+ }> {}
@@ -0,0 +1,2 @@
1
+ export { default } from './FlipCard';
2
+ export type { default as FlipCardProps } from './FlipCardProps';
package/src/index.ts CHANGED
@@ -7,6 +7,9 @@ export * from './Carousel';
7
7
  export { default as DateTimePicker } from './DateTimePicker';
8
8
  export * from './DateTimePicker';
9
9
 
10
+ export { default as FlipCard } from './FlipCard';
11
+ export * from './FlipCard';
12
+
10
13
  export { default as ViewPager } from './ViewPager';
11
14
  export * from './ViewPager';
12
15