@fountain-ui/lab 1.21.0 → 2.0.0-beta.10
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 +8 -0
- package/build/commonjs/AnimatedY/AnimatedY.js +10 -14
- package/build/commonjs/AnimatedY/AnimatedY.js.map +1 -1
- package/build/commonjs/AnimatedY/AnimatedYProps.js.map +1 -1
- package/build/commonjs/AnimatedY/index.js.map +1 -1
- package/build/commonjs/BottomSheet/BottomSheetNative.js +8 -2
- package/build/commonjs/BottomSheet/BottomSheetNative.js.map +1 -1
- package/build/commonjs/BottomSheet/BottomSheetProps.js.map +1 -1
- package/build/commonjs/BottomSheet/BottomSheetWeb.js +2 -6
- package/build/commonjs/BottomSheet/BottomSheetWeb.js.map +1 -1
- package/build/commonjs/BottomSheet/TransparentBackdrop.js +1 -1
- package/build/commonjs/BottomSheet/TransparentBackdrop.js.map +1 -1
- package/build/commonjs/BottomSheet/index.js.map +1 -1
- package/build/commonjs/BottomSheet/index.native.js.map +1 -1
- package/build/commonjs/Carousel/CarouselNative.js.map +1 -1
- package/build/commonjs/Carousel/CarouselProps.js.map +1 -1
- package/build/commonjs/Carousel/CarouselWeb.js +1 -1
- package/build/commonjs/Carousel/CarouselWeb.js.map +1 -1
- package/build/commonjs/Carousel/index.js.map +1 -1
- package/build/commonjs/Carousel/index.native.js.map +1 -1
- package/build/commonjs/Carousel/utils.js +1 -1
- package/build/commonjs/Carousel/utils.js.map +1 -1
- package/build/commonjs/ComicViewer/ComicViewer.js +168 -0
- package/build/commonjs/ComicViewer/ComicViewer.js.map +1 -0
- package/build/commonjs/ComicViewer/ComicViewerItemProps.js +6 -0
- package/build/commonjs/ComicViewer/ComicViewerItemProps.js.map +1 -0
- package/build/commonjs/ComicViewer/ComicViewerProps.js +2 -0
- package/build/commonjs/ComicViewer/ComicViewerProps.js.map +1 -0
- package/build/commonjs/ComicViewer/ViewerItem.js +88 -0
- package/build/commonjs/ComicViewer/ViewerItem.js.map +1 -0
- package/build/commonjs/ComicViewer/index.js +16 -0
- package/build/commonjs/ComicViewer/index.js.map +1 -0
- package/build/commonjs/DateTimePicker/DateTimePicker.js +7 -1
- package/build/commonjs/DateTimePicker/DateTimePicker.js.map +1 -1
- package/build/commonjs/DateTimePicker/DateTimePickerProps.js.map +1 -1
- package/build/commonjs/DateTimePicker/DateTimePickerProvider.js.map +1 -1
- package/build/commonjs/DateTimePicker/YearPicker.js +22 -17
- package/build/commonjs/DateTimePicker/YearPicker.js.map +1 -1
- package/build/commonjs/DateTimePicker/index.js +4 -4
- package/build/commonjs/DateTimePicker/index.js.map +1 -1
- package/build/commonjs/DateTimePicker/utils.js +2 -1
- package/build/commonjs/DateTimePicker/utils.js.map +1 -1
- package/build/commonjs/FlipCard/FlipCard.js +7 -13
- package/build/commonjs/FlipCard/FlipCard.js.map +1 -1
- package/build/commonjs/FlipCard/FlipCardProps.js.map +1 -1
- package/build/commonjs/FlipCard/index.js.map +1 -1
- package/build/commonjs/StatusBarProvider/Provider.js +1 -1
- package/build/commonjs/StatusBarProvider/Provider.js.map +1 -1
- package/build/commonjs/StatusBarProvider/StatusBarProvider.js.map +1 -1
- package/build/commonjs/StatusBarProvider/StatusBarProviderProps.js.map +1 -1
- package/build/commonjs/StatusBarProvider/index.js.map +1 -1
- package/build/commonjs/ViewPager/ChildrenMemoizedPage.js +1 -1
- package/build/commonjs/ViewPager/ChildrenMemoizedPage.js.map +1 -1
- package/build/commonjs/ViewPager/ViewPagerNative.js +19 -16
- package/build/commonjs/ViewPager/ViewPagerNative.js.map +1 -1
- package/build/commonjs/ViewPager/ViewPagerProps.js.map +1 -1
- package/build/commonjs/ViewPager/ViewPagerWeb.js.map +1 -1
- package/build/commonjs/ViewPager/index.js.map +1 -1
- package/build/commonjs/ViewPager/index.native.js.map +1 -1
- package/build/commonjs/ViewPager/utils.js +13 -11
- package/build/commonjs/ViewPager/utils.js.map +1 -1
- package/build/commonjs/hooks/index.js.map +1 -1
- package/build/commonjs/hooks/useAppbarStyles.js.map +1 -1
- package/build/commonjs/hooks/useElevationStyle.js.map +1 -1
- package/build/commonjs/hooks/useHeight.js +5 -4
- package/build/commonjs/hooks/useHeight.js.map +1 -1
- package/build/commonjs/hooks/useUnstableCollapsibleAppBar.js +56 -57
- package/build/commonjs/hooks/useUnstableCollapsibleAppBar.js.map +1 -1
- package/build/commonjs/hooks/useUnstableToggleDisplayStyle.js +9 -11
- package/build/commonjs/hooks/useUnstableToggleDisplayStyle.js.map +1 -1
- package/build/commonjs/index.js +25 -4
- package/build/commonjs/index.js.map +1 -1
- package/build/module/AnimatedY/AnimatedY.js +11 -10
- package/build/module/AnimatedY/AnimatedY.js.map +1 -1
- package/build/module/AnimatedY/AnimatedYProps.js.map +1 -1
- package/build/module/AnimatedY/index.js.map +1 -1
- package/build/module/BottomSheet/BottomSheetNative.js +8 -2
- package/build/module/BottomSheet/BottomSheetNative.js.map +1 -1
- package/build/module/BottomSheet/BottomSheetProps.js.map +1 -1
- package/build/module/BottomSheet/BottomSheetWeb.js +2 -6
- package/build/module/BottomSheet/BottomSheetWeb.js.map +1 -1
- package/build/module/BottomSheet/TransparentBackdrop.js +1 -1
- package/build/module/BottomSheet/TransparentBackdrop.js.map +1 -1
- package/build/module/BottomSheet/index.js.map +1 -1
- package/build/module/BottomSheet/index.native.js.map +1 -1
- package/build/module/Carousel/CarouselNative.js.map +1 -1
- package/build/module/Carousel/CarouselProps.js.map +1 -1
- package/build/module/Carousel/CarouselWeb.js +1 -1
- package/build/module/Carousel/CarouselWeb.js.map +1 -1
- package/build/module/Carousel/index.js.map +1 -1
- package/build/module/Carousel/index.native.js.map +1 -1
- package/build/module/Carousel/utils.js.map +1 -1
- package/build/module/ComicViewer/ComicViewer.js +151 -0
- package/build/module/ComicViewer/ComicViewer.js.map +1 -0
- package/build/module/ComicViewer/ComicViewerItemProps.js +2 -0
- package/build/module/ComicViewer/ComicViewerItemProps.js.map +1 -0
- package/build/module/ComicViewer/ComicViewerProps.js +2 -0
- package/build/module/ComicViewer/ComicViewerProps.js.map +1 -0
- package/build/module/ComicViewer/ViewerItem.js +72 -0
- package/build/module/ComicViewer/ViewerItem.js.map +1 -0
- package/build/module/ComicViewer/index.js +2 -0
- package/build/module/ComicViewer/index.js.map +1 -0
- package/build/module/DateTimePicker/DateTimePicker.js +7 -1
- package/build/module/DateTimePicker/DateTimePicker.js.map +1 -1
- package/build/module/DateTimePicker/DateTimePickerProps.js.map +1 -1
- package/build/module/DateTimePicker/DateTimePickerProvider.js.map +1 -1
- package/build/module/DateTimePicker/YearPicker.js +22 -17
- package/build/module/DateTimePicker/YearPicker.js.map +1 -1
- package/build/module/DateTimePicker/index.js.map +1 -1
- package/build/module/DateTimePicker/utils.js +2 -1
- package/build/module/DateTimePicker/utils.js.map +1 -1
- package/build/module/FlipCard/FlipCard.js +7 -7
- package/build/module/FlipCard/FlipCard.js.map +1 -1
- package/build/module/FlipCard/FlipCardProps.js.map +1 -1
- package/build/module/FlipCard/index.js.map +1 -1
- package/build/module/StatusBarProvider/Provider.js.map +1 -1
- package/build/module/StatusBarProvider/StatusBarProvider.js.map +1 -1
- package/build/module/StatusBarProvider/StatusBarProviderProps.js.map +1 -1
- package/build/module/StatusBarProvider/index.js.map +1 -1
- package/build/module/ViewPager/ChildrenMemoizedPage.js +1 -1
- package/build/module/ViewPager/ChildrenMemoizedPage.js.map +1 -1
- package/build/module/ViewPager/ViewPagerNative.js +14 -9
- package/build/module/ViewPager/ViewPagerNative.js.map +1 -1
- package/build/module/ViewPager/ViewPagerProps.js.map +1 -1
- package/build/module/ViewPager/ViewPagerWeb.js.map +1 -1
- package/build/module/ViewPager/index.js.map +1 -1
- package/build/module/ViewPager/index.native.js.map +1 -1
- package/build/module/ViewPager/utils.js +11 -10
- package/build/module/ViewPager/utils.js.map +1 -1
- package/build/module/hooks/index.js.map +1 -1
- package/build/module/hooks/useAppbarStyles.js.map +1 -1
- package/build/module/hooks/useElevationStyle.js.map +1 -1
- package/build/module/hooks/useHeight.js +4 -3
- package/build/module/hooks/useHeight.js.map +1 -1
- package/build/module/hooks/useUnstableCollapsibleAppBar.js +58 -43
- package/build/module/hooks/useUnstableCollapsibleAppBar.js.map +1 -1
- package/build/module/hooks/useUnstableToggleDisplayStyle.js +9 -7
- package/build/module/hooks/useUnstableToggleDisplayStyle.js.map +1 -1
- package/build/module/index.js +2 -0
- package/build/module/index.js.map +1 -1
- package/build/typescript/AnimatedY/AnimatedY.d.ts +0 -1
- package/build/typescript/BottomSheet/BottomSheetNative.d.ts +0 -1
- package/build/typescript/BottomSheet/BottomSheetWeb.d.ts +0 -1
- package/build/typescript/BottomSheet/TransparentBackdrop.d.ts +0 -1
- package/build/typescript/Carousel/CarouselNative.d.ts +0 -1
- package/build/typescript/ComicViewer/ComicViewer.d.ts +2 -0
- package/build/typescript/ComicViewer/ComicViewerItemProps.d.ts +12 -0
- package/build/typescript/ComicViewer/ComicViewerProps.d.ts +76 -0
- package/build/typescript/ComicViewer/ViewerItem.d.ts +7 -0
- package/build/typescript/ComicViewer/index.d.ts +3 -0
- package/build/typescript/DateTimePicker/DateTimePicker.d.ts +0 -1
- package/build/typescript/DateTimePicker/YearPicker.d.ts +0 -1
- package/build/typescript/FlipCard/FlipCard.d.ts +0 -1
- package/build/typescript/StatusBarProvider/StatusBarProvider.d.ts +0 -1
- package/build/typescript/ViewPager/ViewPagerNative.d.ts +0 -1
- package/build/typescript/ViewPager/ViewPagerWeb.d.ts +0 -1
- package/build/typescript/hooks/useUnstableCollapsibleAppBar.d.ts +2 -3
- package/build/typescript/hooks/useUnstableToggleDisplayStyle.d.ts +2 -2
- package/build/typescript/index.d.ts +2 -0
- package/package.json +13 -13
- package/src/AnimatedY/AnimatedY.tsx +13 -10
- package/src/BottomSheet/BottomSheetNative.tsx +6 -0
- package/src/ComicViewer/ComicViewer.tsx +162 -0
- package/src/ComicViewer/ComicViewerItemProps.ts +15 -0
- package/src/ComicViewer/ComicViewerProps.ts +90 -0
- package/src/ComicViewer/ViewerItem.tsx +76 -0
- package/src/ComicViewer/index.ts +3 -0
- package/src/DateTimePicker/DateTimePicker.tsx +6 -0
- package/src/DateTimePicker/YearPicker.tsx +2 -1
- package/src/FlipCard/FlipCard.tsx +8 -8
- package/src/ViewPager/ViewPagerNative.tsx +16 -9
- package/src/hooks/useHeight.ts +2 -2
- package/src/hooks/useUnstableCollapsibleAppBar.ts +59 -42
- package/src/hooks/useUnstableToggleDisplayStyle.ts +8 -6
- package/src/index.ts +3 -0
- package/build/commonjs/hooks/useWidth.js +0 -29
- package/build/commonjs/hooks/useWidth.js.map +0 -1
- package/build/module/hooks/useWidth.js +0 -15
- package/build/module/hooks/useWidth.js.map +0 -1
- package/build/typescript/hooks/useWidth.d.ts +0 -2
- package/src/hooks/useWidth.ts +0 -17
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["index.native.ts"],"
|
|
1
|
+
{"version":3,"names":[],"sources":["index.native.ts"],"sourcesContent":["export { default } from './ViewPagerNative';\n"],"mappings":";;;;;;;;;;;;AAAA"}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.usePageRenderer = exports.defaultPageComponent = exports.defaultLoading = exports.
|
|
6
|
+
exports.usePageRenderer = exports.defaultPageComponent = exports.defaultLoading = exports.defaultEnableVisibleHint = exports.defaultEnableNeighborPageRerender = void 0;
|
|
7
7
|
|
|
8
8
|
var _react = _interopRequireDefault(require("react"));
|
|
9
9
|
|
|
@@ -20,23 +20,25 @@ exports.defaultLoading = defaultLoading;
|
|
|
20
20
|
const defaultPageComponent = _ChildrenMemoizedPage.default;
|
|
21
21
|
exports.defaultPageComponent = defaultPageComponent;
|
|
22
22
|
|
|
23
|
-
const usePageRenderer =
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
23
|
+
const usePageRenderer = _ref => {
|
|
24
|
+
let {
|
|
25
|
+
enableVisibleHint,
|
|
26
|
+
index: currentIndex,
|
|
27
|
+
loading,
|
|
28
|
+
pageComponent: PageComponent,
|
|
29
|
+
pageForceRerenderKey,
|
|
30
|
+
enableNeighborPageRerender
|
|
31
|
+
} = _ref;
|
|
32
|
+
|
|
31
33
|
const pagesStateRef = _react.default.useRef([]);
|
|
32
34
|
|
|
33
35
|
pagesStateRef.current[currentIndex] = { ...pagesStateRef.current[currentIndex],
|
|
34
36
|
visited: true
|
|
35
37
|
};
|
|
36
38
|
return children => _react.default.Children.map(children, (child, index) => {
|
|
37
|
-
var _pagesStateRef$curren
|
|
39
|
+
var _pagesStateRef$curren;
|
|
38
40
|
|
|
39
|
-
const visited = (_pagesStateRef$curren =
|
|
41
|
+
const visited = ((_pagesStateRef$curren = pagesStateRef.current[index]) === null || _pagesStateRef$curren === void 0 ? void 0 : _pagesStateRef$curren.visited) ?? false;
|
|
40
42
|
const content = loading === 'eager' || visited ? child : null;
|
|
41
43
|
const isVisible = enableVisibleHint ? index === currentIndex : false;
|
|
42
44
|
const isNeighborIndex = index === currentIndex - 1 || index === currentIndex + 1;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"names":["defaultEnableVisibleHint","defaultEnableNeighborPageRerender","defaultLoading","defaultPageComponent","ChildrenMemoizedPage","usePageRenderer","enableVisibleHint","index","currentIndex","loading","pageComponent","PageComponent","pageForceRerenderKey","enableNeighborPageRerender","pagesStateRef","React","useRef","current","visited","children","Children","map","child","content","isVisible","isNeighborIndex"],"sources":["utils.tsx"],"sourcesContent":["import React from 'react';\nimport ViewPagerProps, { Loading, PageComponent } from './ViewPagerProps';\nimport ChildrenMemoizedPage from './ChildrenMemoizedPage';\n\nexport interface PageState {\n visited?: boolean;\n}\n\nexport interface PageRenderOption {\n enableVisibleHint: boolean;\n enableNeighborPageRerender: boolean;\n index: number;\n loading: Loading;\n pageComponent: PageComponent;\n pageForceRerenderKey?: any;\n}\n\nexport interface PageRenderer {\n (children: ViewPagerProps['children']): React.ReactNode;\n}\n\nexport const defaultEnableVisibleHint: boolean = false;\n\nexport const defaultEnableNeighborPageRerender: boolean = false;\n\nexport const defaultLoading: Loading = 'lazy';\n\nexport const defaultPageComponent: PageComponent = ChildrenMemoizedPage;\n\nexport const usePageRenderer = ({\n enableVisibleHint,\n index: currentIndex,\n loading,\n pageComponent: PageComponent,\n pageForceRerenderKey,\n enableNeighborPageRerender,\n}: PageRenderOption): PageRenderer => {\n const pagesStateRef = React.useRef<Array<PageState>>([]);\n\n pagesStateRef.current[currentIndex] = {\n ...pagesStateRef.current[currentIndex],\n visited: true,\n };\n\n return (children => React.Children.map(children, (child, index) => {\n const visited = pagesStateRef.current[index]?.visited ?? false;\n const content = (loading === 'eager' || visited) ? child : null;\n\n const isVisible = enableVisibleHint ? (index === currentIndex) : false;\n const isNeighborIndex = index === currentIndex - 1 || index === currentIndex + 1;\n\n return (\n <PageComponent\n key={index}\n children={content}\n isNeighbor={enableNeighborPageRerender && isNeighborIndex}\n isVisible={isVisible}\n rerenderKey={pageForceRerenderKey}\n />\n );\n }));\n};\n"],"mappings":";;;;;;;AAAA;;AAEA;;;;AAmBO,MAAMA,wBAAiC,GAAG,KAA1C;;AAEA,MAAMC,iCAA0C,GAAG,KAAnD;;AAEA,MAAMC,cAAuB,GAAG,MAAhC;;AAEA,MAAMC,oBAAmC,GAAGC,6BAA5C;;;AAEA,MAAMC,eAAe,GAAG,QAOO;EAAA,IAPN;IAC5BC,iBAD4B;IAE5BC,KAAK,EAAEC,YAFqB;IAG5BC,OAH4B;IAI5BC,aAAa,EAAEC,aAJa;IAK5BC,oBAL4B;IAM5BC;EAN4B,CAOM;;EAClC,MAAMC,aAAa,GAAGC,cAAA,CAAMC,MAAN,CAA+B,EAA/B,CAAtB;;EAEAF,aAAa,CAACG,OAAd,CAAsBT,YAAtB,IAAsC,EAClC,GAAGM,aAAa,CAACG,OAAd,CAAsBT,YAAtB,CAD+B;IAElCU,OAAO,EAAE;EAFyB,CAAtC;EAKA,OAAQC,QAAQ,IAAIJ,cAAA,CAAMK,QAAN,CAAeC,GAAf,CAAmBF,QAAnB,EAA6B,CAACG,KAAD,EAAQf,KAAR,KAAkB;IAAA;;IAC/D,MAAMW,OAAO,GAAG,0BAAAJ,aAAa,CAACG,OAAd,CAAsBV,KAAtB,iFAA8BW,OAA9B,KAAyC,KAAzD;IACA,MAAMK,OAAO,GAAId,OAAO,KAAK,OAAZ,IAAuBS,OAAxB,GAAmCI,KAAnC,GAA2C,IAA3D;IAEA,MAAME,SAAS,GAAGlB,iBAAiB,GAAIC,KAAK,KAAKC,YAAd,GAA8B,KAAjE;IACA,MAAMiB,eAAe,GAAGlB,KAAK,KAAKC,YAAY,GAAG,CAAzB,IAA8BD,KAAK,KAAKC,YAAY,GAAG,CAA/E;IAEA,oBACI,6BAAC,aAAD;MACI,GAAG,EAAED,KADT;MAEI,QAAQ,EAAEgB,OAFd;MAGI,UAAU,EAAEV,0BAA0B,IAAIY,eAH9C;MAII,SAAS,EAAED,SAJf;MAKI,WAAW,EAAEZ;IALjB,EADJ;EASH,CAhBmB,CAApB;AAiBH,CAhCM"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export { default as useUnstableCollapsibleAppBar } from './useUnstableCollapsibleAppBar';\nexport { default as useUnstableToggleDisplayStyle } from './useUnstableToggleDisplayStyle';\n\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;;AACA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"names":["useAppBarStyles","floating","position","top","left","right"],"sources":["useAppbarStyles.ts"],"sourcesContent":["import { NamedStylesStringUnion, UseStyles } from '@fountain-ui/styles';\n\ntype AppBarStyles = NamedStylesStringUnion<'floating'>;\n\nconst useAppBarStyles: UseStyles<AppBarStyles> = function (): AppBarStyles {\n return {\n floating: {\n position: 'absolute',\n top: 0,\n left: 0,\n right: 0,\n },\n };\n};\n\nexport default useAppBarStyles;"],"mappings":";;;;;;;AAIA,MAAMA,eAAwC,GAAG,YAA0B;EACvE,OAAO;IACHC,QAAQ,EAAE;MACNC,QAAQ,EAAE,UADJ;MAENC,GAAG,EAAE,CAFC;MAGNC,IAAI,EAAE,CAHA;MAINC,KAAK,EAAE;IAJD;EADP,CAAP;AAQH,CATD;;eAWeL,e"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"names":["useElevationStyle","elevation","theme","useTheme","shadow","Platform","select","android","ios","web","boxShadow"],"sources":["useElevationStyle.ts"],"sourcesContent":["import { Platform } from 'react-native';\nimport type { Elevation } from '@fountain-ui/styles';\nimport { useTheme } from '@fountain-ui/styles';\n\nexport default function useElevationStyle(elevation: Elevation) {\n const theme = useTheme();\n const shadow = theme.shadow[elevation];\n\n return Platform.select<any>({\n android: shadow?.elevation,\n ios: shadow?.shadow,\n web: shadow?.boxShadow,\n });\n};\n"],"mappings":";;;;;;;AAAA;;AAEA;;AAEe,SAASA,iBAAT,CAA2BC,SAA3B,EAAiD;EAC5D,MAAMC,KAAK,GAAG,IAAAC,gBAAA,GAAd;EACA,MAAMC,MAAM,GAAGF,KAAK,CAACE,MAAN,CAAaH,SAAb,CAAf;EAEA,OAAOI,qBAAA,CAASC,MAAT,CAAqB;IACxBC,OAAO,EAAEH,MAAF,aAAEA,MAAF,uBAAEA,MAAM,CAAEH,SADO;IAExBO,GAAG,EAAEJ,MAAF,aAAEA,MAAF,uBAAEA,MAAM,CAAEA,MAFW;IAGxBK,GAAG,EAAEL,MAAF,aAAEA,MAAF,uBAAEA,MAAM,CAAEM;EAHW,CAArB,CAAP;AAKH;;AAAA"}
|
|
@@ -7,17 +7,18 @@ exports.default = useHeight;
|
|
|
7
7
|
|
|
8
8
|
var _react = _interopRequireDefault(require("react"));
|
|
9
9
|
|
|
10
|
-
var _reactNativeReanimated =
|
|
10
|
+
var _reactNativeReanimated = require("react-native-reanimated");
|
|
11
11
|
|
|
12
12
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
13
|
|
|
14
|
-
function useHeight(
|
|
14
|
+
function useHeight() {
|
|
15
|
+
let initialHeight = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
|
|
16
|
+
|
|
15
17
|
const [height, setHeight] = _react.default.useState(initialHeight);
|
|
16
18
|
|
|
17
|
-
const onLayout = _reactNativeReanimated.
|
|
19
|
+
const onLayout = (0, _reactNativeReanimated.useWorkletCallback)(e => {
|
|
18
20
|
setHeight(e.nativeEvent.layout.height);
|
|
19
21
|
}, []);
|
|
20
|
-
|
|
21
22
|
return [height, onLayout];
|
|
22
23
|
}
|
|
23
24
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"names":["useHeight","initialHeight","height","setHeight","React","useState","onLayout","useWorkletCallback","e","nativeEvent","layout"],"sources":["useHeight.ts"],"sourcesContent":["import React from 'react';\nimport { ViewProps } from 'react-native';\nimport { useWorkletCallback } from 'react-native-reanimated';\n\ntype OnLayoutCallback = ViewProps['onLayout'];\n\nexport default function useHeight(initialHeight = 0): [number, OnLayoutCallback] {\n const [height, setHeight] = React.useState<number>(initialHeight);\n\n const onLayout = useWorkletCallback((e) => {\n setHeight(e.nativeEvent.layout.height);\n }, []);\n\n return [height, onLayout];\n};\n"],"mappings":";;;;;;;AAAA;;AAEA;;;;AAIe,SAASA,SAAT,GAAkE;EAAA,IAA/CC,aAA+C,uEAA/B,CAA+B;;EAC7E,MAAM,CAACC,MAAD,EAASC,SAAT,IAAsBC,cAAA,CAAMC,QAAN,CAAuBJ,aAAvB,CAA5B;;EAEA,MAAMK,QAAQ,GAAG,IAAAC,yCAAA,EAAoBC,CAAD,IAAO;IACvCL,SAAS,CAACK,CAAC,CAACC,WAAF,CAAcC,MAAd,CAAqBR,MAAtB,CAAT;EACH,CAFgB,EAEd,EAFc,CAAjB;EAIA,OAAO,CAACA,MAAD,EAASI,QAAT,CAAP;AACH;;AAAA"}
|
|
@@ -5,11 +5,11 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.default = useUnstableCollapsibleAppBar;
|
|
7
7
|
|
|
8
|
-
var _react =
|
|
8
|
+
var _react = require("react");
|
|
9
9
|
|
|
10
10
|
var _reactNative = require("react-native");
|
|
11
11
|
|
|
12
|
-
var _reactNativeReanimated =
|
|
12
|
+
var _reactNativeReanimated = require("react-native-reanimated");
|
|
13
13
|
|
|
14
14
|
var _reactNativeSafeAreaContext = require("react-native-safe-area-context");
|
|
15
15
|
|
|
@@ -21,12 +21,7 @@ var _useHeight = _interopRequireDefault(require("./useHeight"));
|
|
|
21
21
|
|
|
22
22
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
23
23
|
|
|
24
|
-
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); }
|
|
25
|
-
|
|
26
|
-
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; }
|
|
27
|
-
|
|
28
24
|
const defaultOptions = {
|
|
29
|
-
translucent: false,
|
|
30
25
|
shouldTranslateYReset: false
|
|
31
26
|
};
|
|
32
27
|
const ANIMATION_DURATION_MILLIS = 100;
|
|
@@ -39,9 +34,9 @@ function useLargerValueOfLastTwoValues(value) {
|
|
|
39
34
|
return Math.max(...refLatestTwoValues.current);
|
|
40
35
|
}
|
|
41
36
|
|
|
42
|
-
function useUnstableCollapsibleAppBar(
|
|
37
|
+
function useUnstableCollapsibleAppBar() {
|
|
38
|
+
let userOptions = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : defaultOptions;
|
|
43
39
|
const {
|
|
44
|
-
translucent,
|
|
45
40
|
shouldTranslateYReset
|
|
46
41
|
} = { ...defaultOptions,
|
|
47
42
|
...userOptions
|
|
@@ -51,53 +46,58 @@ function useUnstableCollapsibleAppBar(userOptions = defaultOptions) {
|
|
|
51
46
|
const [appBarHeight, onAppBarLayout] = (0, _useHeight.default)();
|
|
52
47
|
const appBarMaxHeight = useLargerValueOfLastTwoValues(appBarHeight);
|
|
53
48
|
const [collapsibleToolbarHeight, onCollapsibleToolbarLayout] = (0, _useHeight.default)();
|
|
49
|
+
const maxTranslateY = (0, _reactNativeReanimated.useDerivedValue)(() => -collapsibleToolbarHeight, [collapsibleToolbarHeight]);
|
|
50
|
+
const translateY = (0, _reactNativeReanimated.useSharedValue)(0);
|
|
51
|
+
const lastTranslateY = (0, _reactNativeReanimated.useSharedValue)(0);
|
|
52
|
+
const lastOffsetY = (0, _reactNativeReanimated.useSharedValue)(0);
|
|
53
|
+
const prevOffsetY = (0, _reactNativeReanimated.useSharedValue)(0);
|
|
54
|
+
const overlapped = (0, _reactNativeReanimated.useSharedValue)(false);
|
|
55
|
+
const vectorY = (0, _reactNativeReanimated.useSharedValue)(0);
|
|
56
|
+
const elevationStyle = (0, _useElevationStyle.default)(4);
|
|
57
|
+
const animatedStyle = (0, _reactNativeReanimated.useAnimatedStyle)(() => {
|
|
58
|
+
const transform = [{
|
|
59
|
+
translateY: translateY.value
|
|
60
|
+
}];
|
|
61
|
+
|
|
62
|
+
if (_reactNative.Platform.OS === 'web') {
|
|
63
|
+
return {
|
|
64
|
+
transform,
|
|
65
|
+
boxShadow: overlapped.value ? elevationStyle === null || elevationStyle === void 0 ? void 0 : elevationStyle.boxShadow : 0
|
|
66
|
+
};
|
|
67
|
+
}
|
|
54
68
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
const lastOffsetY = _reactNativeReanimated.default.useSharedValue(0);
|
|
62
|
-
|
|
63
|
-
const prevOffsetY = _reactNativeReanimated.default.useSharedValue(0);
|
|
64
|
-
|
|
65
|
-
const overlapped = _reactNativeReanimated.default.useSharedValue(false);
|
|
66
|
-
|
|
67
|
-
const vectorY = _reactNativeReanimated.default.useSharedValue(0);
|
|
69
|
+
if (_reactNative.Platform.OS === 'android') {
|
|
70
|
+
return {
|
|
71
|
+
transform,
|
|
72
|
+
elevation: overlapped.value ? elevationStyle === null || elevationStyle === void 0 ? void 0 : elevationStyle.elevation : 0
|
|
73
|
+
};
|
|
74
|
+
}
|
|
68
75
|
|
|
69
|
-
|
|
76
|
+
if (_reactNative.Platform.OS === 'ios') {
|
|
77
|
+
return {
|
|
78
|
+
transform,
|
|
79
|
+
shadowColor: elevationStyle === null || elevationStyle === void 0 ? void 0 : elevationStyle.shadowColor,
|
|
80
|
+
shadowOffset: elevationStyle === null || elevationStyle === void 0 ? void 0 : elevationStyle.shadowOffset,
|
|
81
|
+
shadowRadius: elevationStyle === null || elevationStyle === void 0 ? void 0 : elevationStyle.shadowRadius,
|
|
82
|
+
shadowOpacity: overlapped.value ? elevationStyle === null || elevationStyle === void 0 ? void 0 : elevationStyle.shadowOpacity : 0
|
|
83
|
+
};
|
|
84
|
+
}
|
|
70
85
|
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
translateY: translateY.value
|
|
80
|
-
}],
|
|
81
|
-
elevation: overlapped.value ? elevationStyle === null || elevationStyle === void 0 ? void 0 : elevationStyle.elevation : 0,
|
|
82
|
-
shadowColor: elevationStyle === null || elevationStyle === void 0 ? void 0 : elevationStyle.shadowColor,
|
|
83
|
-
shadowOffset: elevationStyle === null || elevationStyle === void 0 ? void 0 : elevationStyle.shadowOffset,
|
|
84
|
-
shadowRadius: elevationStyle === null || elevationStyle === void 0 ? void 0 : elevationStyle.shadowRadius,
|
|
85
|
-
shadowOpacity: overlapped.value ? elevationStyle === null || elevationStyle === void 0 ? void 0 : elevationStyle.shadowOpacity : 0
|
|
86
|
-
};
|
|
87
|
-
});
|
|
88
|
-
|
|
89
|
-
const indexRef = _react.default.useRef(0);
|
|
90
|
-
|
|
91
|
-
const offsetsRef = _react.default.useRef([]);
|
|
86
|
+
return {};
|
|
87
|
+
}, [
|
|
88
|
+
/**
|
|
89
|
+
* FIXME: Consider add `elevationStyle` to dependencies.
|
|
90
|
+
*/
|
|
91
|
+
]);
|
|
92
|
+
const indexRef = (0, _react.useRef)(0);
|
|
93
|
+
const offsetsRef = (0, _react.useRef)([]);
|
|
92
94
|
|
|
93
95
|
const onScrollViewChanged = nextIndex => {
|
|
94
|
-
var _offsetsRef$current$n;
|
|
95
|
-
|
|
96
96
|
const prevIndex = indexRef.current;
|
|
97
97
|
|
|
98
98
|
if (prevIndex === nextIndex) {
|
|
99
99
|
if (shouldTranslateYReset) {
|
|
100
|
-
translateY.value = _reactNativeReanimated.
|
|
100
|
+
translateY.value = (0, _reactNativeReanimated.withTiming)(0, {
|
|
101
101
|
duration: ANIMATION_DURATION_MILLIS
|
|
102
102
|
});
|
|
103
103
|
vectorY.value = 0;
|
|
@@ -109,21 +109,21 @@ function useUnstableCollapsibleAppBar(userOptions = defaultOptions) {
|
|
|
109
109
|
}
|
|
110
110
|
|
|
111
111
|
offsetsRef.current[prevIndex] = lastOffsetY.value;
|
|
112
|
-
const savedOffsetY =
|
|
112
|
+
const savedOffsetY = offsetsRef.current[nextIndex] ?? 0;
|
|
113
113
|
lastOffsetY.value = savedOffsetY;
|
|
114
114
|
indexRef.current = nextIndex; // Determine whether to overlap every time index is changed.
|
|
115
115
|
|
|
116
116
|
overlapped.value = savedOffsetY > 0; // If next ScrollView's offset is too short, expand app bar.
|
|
117
117
|
|
|
118
118
|
if (translateY.value < 0 && savedOffsetY < appBarHeight) {
|
|
119
|
-
translateY.value = _reactNativeReanimated.
|
|
119
|
+
translateY.value = (0, _reactNativeReanimated.withTiming)(0, {
|
|
120
120
|
duration: ANIMATION_DURATION_MILLIS
|
|
121
121
|
});
|
|
122
122
|
vectorY.value = 0;
|
|
123
123
|
}
|
|
124
124
|
};
|
|
125
125
|
|
|
126
|
-
const scrollHandler = _reactNativeReanimated.
|
|
126
|
+
const scrollHandler = (0, _reactNativeReanimated.useAnimatedScrollHandler)({
|
|
127
127
|
onBeginDrag: () => {
|
|
128
128
|
lastTranslateY.value = translateY.value;
|
|
129
129
|
},
|
|
@@ -145,13 +145,13 @@ function useUnstableCollapsibleAppBar(userOptions = defaultOptions) {
|
|
|
145
145
|
} else {
|
|
146
146
|
if (offsetY > -maxTy) {
|
|
147
147
|
if (ty === 0) {
|
|
148
|
-
translateY.value = _reactNativeReanimated.
|
|
148
|
+
translateY.value = (0, _reactNativeReanimated.withTiming)(Math.min(Math.max(-offsetY, maxTy), 0), {
|
|
149
149
|
duration: ANIMATION_DURATION_MILLIS
|
|
150
150
|
});
|
|
151
151
|
}
|
|
152
152
|
} else {
|
|
153
153
|
if (ty === maxTy) {
|
|
154
|
-
translateY.value = _reactNativeReanimated.
|
|
154
|
+
translateY.value = (0, _reactNativeReanimated.withTiming)(0, {
|
|
155
155
|
duration: ANIMATION_DURATION_MILLIS
|
|
156
156
|
});
|
|
157
157
|
}
|
|
@@ -177,16 +177,15 @@ function useUnstableCollapsibleAppBar(userOptions = defaultOptions) {
|
|
|
177
177
|
const threshold = maxTy * 0.5;
|
|
178
178
|
const nextTranslateY = ty > threshold || offsetY < appBarHeight ? 0 : maxTy;
|
|
179
179
|
overlapped.value = offsetY + nextTranslateY > 0;
|
|
180
|
-
translateY.value = _reactNativeReanimated.
|
|
180
|
+
translateY.value = (0, _reactNativeReanimated.withTiming)(nextTranslateY, {
|
|
181
181
|
duration: ANIMATION_DURATION_MILLIS
|
|
182
182
|
});
|
|
183
183
|
}
|
|
184
|
-
});
|
|
185
|
-
|
|
184
|
+
}, []);
|
|
186
185
|
const hasCollapsible = collapsibleToolbarHeight > 0;
|
|
187
|
-
const appBarStyle = [animatedStyle,
|
|
186
|
+
const appBarStyle = [animatedStyle, {
|
|
188
187
|
paddingTop: safeAreaInsets.top
|
|
189
|
-
}
|
|
188
|
+
}, hasCollapsible ? styles.floating : undefined];
|
|
190
189
|
return {
|
|
191
190
|
appBarStyle,
|
|
192
191
|
vectorY,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["useUnstableCollapsibleAppBar.ts"],"names":["defaultOptions","translucent","shouldTranslateYReset","ANIMATION_DURATION_MILLIS","SUPPORTS_DRAG_DETECTION","Platform","OS","useLargerValueOfLastTwoValues","value","refLatestTwoValues","current","shift","push","Math","max","useUnstableCollapsibleAppBar","userOptions","styles","safeAreaInsets","appBarHeight","onAppBarLayout","appBarMaxHeight","collapsibleToolbarHeight","onCollapsibleToolbarLayout","maxTranslateY","Animated","useDerivedValue","translateY","useSharedValue","lastTranslateY","lastOffsetY","prevOffsetY","overlapped","vectorY","elevationStyle","animatedStyle","useAnimatedStyle","transform","boxShadow","elevation","shadowColor","shadowOffset","shadowRadius","shadowOpacity","indexRef","React","useRef","offsetsRef","onScrollViewChanged","nextIndex","prevIndex","withTiming","duration","savedOffsetY","scrollHandler","useAnimatedScrollHandler","onBeginDrag","onMomentumBegin","onScroll","event","offsetY","contentOffset","y","ty","maxTy","deltaY","dy","min","onEndDrag","onMomentumEnd","threshold","next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AAA,UAAU,CAACxB,KAAX,GAAmBoD,OAAO,GAAGW,cAAV,GAA2B,CAA9C;AAEA5C,MAAAA,UAAU,CAACnB,KAAX,GAAmBiB,+BAAS0B,UAAT,CAAoBoB,cAApB,EAAoC;AACnDnB,QAAAA,QAAQ,EAAEjD;AADyC,OAApC,CAAnB;AAGH;AApEmD,GAAlC,CAAtB;;AAuEA,QAAMqE,cAAc,GAAGlD,wBAAwB,GAAG,CAAlD;AAEA,QAAMmD,WAAW,GAAG,CAChBtC,aADgB,EAEhBlC,WAAW,GAAG;AAAEyE,IAAAA,UAAU,EAAExD,cAAc,CAACyD;AAA7B,GAAH,GAAwCC,SAFnC,EAGhBJ,cAAc,GAAGvD,MAAM,CAAC4D,QAAV,GAAqBD,SAHnB,CAApB;AAMA,SAAO;AACHH,IAAAA,WADG;AAEHxC,IAAAA,OAFG;AAGHb,IAAAA,cAHG;AAIHG,IAAAA,0BAJG;AAKHmC,IAAAA,QAAQ,EAAEJ,aALP;AAMHN,IAAAA,mBANG;AAOH8B,IAAAA,mBAAmB,EAAE;AAAEH,MAAAA,GAAG,EAAEH,cAAc,GAAGnD,eAAH,GAAqB;AAA1C;AAPlB,GAAP;AASH;;AAAA","sourcesContent":["import React, { useRef } from 'react';\nimport { Falsy, Platform, RegisteredStyle, ScrollViewProps, ViewProps, ViewStyle } from 'react-native';\nimport Animated from 'react-native-reanimated';\nimport { useSafeAreaInsets } from 'react-native-safe-area-context';\nimport useAppbarStyles from './useAppbarStyles';\nimport useElevationStyle from './useElevationStyle';\nimport useHeight from './useHeight';\n\ntype WebOnlyStyle = { boxShadow: any };\n\ntype ViewStyleProp = Array<ViewStyle | RegisteredStyle<ViewStyle> | WebOnlyStyle | Falsy>;\n\ntype OnScroll = ScrollViewProps['onScroll'];\n\ntype OnLayoutCallback = ViewProps['onLayout'];\n\nexport interface ContentInsets {\n top?: number;\n bottom?: number;\n left?: number;\n right?: number;\n}\n\nexport interface Options {\n translucent?: boolean;\n shouldTranslateYReset?: boolean;\n}\n\nexport interface CollapsibleAppBar {\n appBarStyle: ViewStyleProp;\n vectorY: Animated.SharedValue<number>;\n onAppBarLayout: OnLayoutCallback;\n onCollapsibleToolbarLayout: OnLayoutCallback;\n onScroll: OnScroll;\n onScrollViewChanged: (index: number) => void;\n scrollContentInsets: ContentInsets;\n}\n\nconst defaultOptions: Required<Options> = {\n translucent: false,\n shouldTranslateYReset: false,\n};\n\nconst ANIMATION_DURATION_MILLIS = 100;\n\nconst SUPPORTS_DRAG_DETECTION = Platform.OS !== 'web';\n\n\nfunction useLargerValueOfLastTwoValues(value: number) {\n const refLatestTwoValues = useRef([0, 0]);\n\n refLatestTwoValues.current.shift();\n refLatestTwoValues.current.push(value);\n\n return Math.max(...refLatestTwoValues.current);\n}\n\n\nexport default function useUnstableCollapsibleAppBar(userOptions: Options = defaultOptions): CollapsibleAppBar {\n const {\n translucent,\n shouldTranslateYReset,\n }: Required<Options> = {\n ...defaultOptions,\n ...userOptions,\n };\n\n const styles = useAppbarStyles();\n\n const safeAreaInsets = useSafeAreaInsets();\n\n const [appBarHeight, onAppBarLayout] = useHeight();\n const appBarMaxHeight = useLargerValueOfLastTwoValues(appBarHeight);\n const [collapsibleToolbarHeight, onCollapsibleToolbarLayout] = useHeight();\n\n const maxTranslateY = Animated.useDerivedValue(() => -collapsibleToolbarHeight);\n\n const translateY = Animated.useSharedValue<number>(0);\n const lastTranslateY = Animated.useSharedValue<number>(0);\n const lastOffsetY = Animated.useSharedValue<number>(0);\n const prevOffsetY = Animated.useSharedValue<number>(0);\n const overlapped = Animated.useSharedValue<boolean>(false);\n const vectorY = Animated.useSharedValue<number>(0);\n\n const elevationStyle = useElevationStyle(4);\n const animatedStyle = Animated.useAnimatedStyle(() => {\n return Platform.OS === 'web' ? ({\n transform: [{ translateY: translateY.value }],\n boxShadow: overlapped.value ? elevationStyle?.boxShadow : 0,\n }) : ({\n transform: [{ translateY: translateY.value }],\n elevation: overlapped.value ? elevationStyle?.elevation : 0,\n shadowColor: elevationStyle?.shadowColor,\n shadowOffset: elevationStyle?.shadowOffset,\n shadowRadius: elevationStyle?.shadowRadius,\n shadowOpacity: overlapped.value ? elevationStyle?.shadowOpacity : 0,\n });\n });\n\n const indexRef = React.useRef<number>(0);\n const offsetsRef = React.useRef<Array<number>>([]);\n\n const onScrollViewChanged = (nextIndex: number) => {\n const prevIndex = indexRef.current;\n if (prevIndex === nextIndex) {\n if (shouldTranslateYReset) {\n translateY.value = Animated.withTiming(0, {\n duration: ANIMATION_DURATION_MILLIS,\n });\n\n vectorY.value = 0;\n offsetsRef.current = [];\n overlapped.value = false;\n }\n\n return;\n }\n\n offsetsRef.current[prevIndex] = lastOffsetY.value;\n\n const savedOffsetY = offsetsRef.current[nextIndex] ?? 0;\n lastOffsetY.value = savedOffsetY;\n\n indexRef.current = nextIndex;\n\n // Determine whether to overlap every time index is changed.\n overlapped.value = savedOffsetY > 0;\n\n // If next ScrollView's offset is too short, expand app bar.\n if (translateY.value < 0 && savedOffsetY < appBarHeight) {\n translateY.value = Animated.withTiming(0, {\n duration: ANIMATION_DURATION_MILLIS,\n });\n\n vectorY.value = 0;\n }\n };\n\n const scrollHandler = Animated.useAnimatedScrollHandler({\n onBeginDrag: () => {\n lastTranslateY.value = translateY.value;\n },\n onMomentumBegin: () => {\n lastTranslateY.value = translateY.value;\n },\n onScroll: (event) => {\n const offsetY = event.contentOffset.y;\n\n const ty = translateY.value;\n const maxTy = maxTranslateY.value;\n\n const deltaY = offsetY - prevOffsetY.value;\n vectorY.value = (vectorY.value * deltaY >= 0 && offsetY > 0) ? vectorY.value + deltaY : deltaY;\n prevOffsetY.value = offsetY;\n\n if (SUPPORTS_DRAG_DETECTION) {\n const dy = offsetY - lastOffsetY.value;\n\n translateY.value = offsetY <= 0 ? 0 : Math.min(Math.max(lastTranslateY.value - dy, maxTy), 0);\n\n overlapped.value = offsetY + translateY.value > 0;\n } else {\n if (offsetY > -maxTy) {\n if (ty === 0) {\n translateY.value = Animated.withTiming(Math.min(Math.max(-offsetY, maxTy), 0), {\n duration: ANIMATION_DURATION_MILLIS,\n });\n }\n } else {\n if (ty === maxTy) {\n translateY.value = Animated.withTiming(0, {\n duration: ANIMATION_DURATION_MILLIS,\n });\n }\n }\n\n overlapped.value = offsetY > 0;\n\n lastOffsetY.value = offsetY;\n }\n },\n onEndDrag: (event) => {\n lastOffsetY.value = event.contentOffset.y;\n },\n onMomentumEnd: (event) => {\n const offsetY = event.contentOffset.y;\n\n lastOffsetY.value = offsetY;\n\n const ty = translateY.value;\n const maxTy = maxTranslateY.value;\n\n // If toolbar is already positioned on edge, do nothing.\n if (ty <= maxTy || ty >= 0) {\n return;\n }\n\n const threshold = maxTy * 0.5;\n\n const nextTranslateY = (ty > threshold || offsetY < appBarHeight) ? 0 : maxTy;\n\n overlapped.value = offsetY + nextTranslateY > 0;\n\n translateY.value = Animated.withTiming(nextTranslateY, {\n duration: ANIMATION_DURATION_MILLIS,\n });\n },\n });\n\n const hasCollapsible = collapsibleToolbarHeight > 0;\n\n const appBarStyle = [\n animatedStyle,\n translucent ? { paddingTop: safeAreaInsets.top } : undefined,\n hasCollapsible ? styles.floating : undefined,\n ];\n\n return {\n appBarStyle,\n vectorY,\n onAppBarLayout,\n onCollapsibleToolbarLayout,\n onScroll: scrollHandler,\n onScrollViewChanged,\n scrollContentInsets: { top: hasCollapsible ? appBarMaxHeight : 0 },\n };\n};\n"]}
|
|
1
|
+
{"version":3,"names":["defaultOptions","shouldTranslateYReset","ANIMATION_DURATION_MILLIS","SUPPORTS_DRAG_DETECTION","Platform","OS","useLargerValueOfLastTwoValues","value","refLatestTwoValues","useRef","current","shift","push","Math","max","useUnstableCollapsibleAppBar","userOptions","styles","useAppbarStyles","safeAreaInsets","useSafeAreaInsets","appBarHeight","onAppBarLayout","useHeight","appBarMaxHeight","collapsibleToolbarHeight","onCollapsibleToolbarLayout","maxTranslateY","useDerivedValue","translateY","useSharedValue","lastTranslateY","lastOffsetY","prevOffsetY","overlapped","vectorY","elevationStyle","useElevationStyle","animatedStyle","useAnimatedStyle","transform","boxShadow","elevation","shadowColor","shadowOffset","shadowRadius","shadowOpacity","indexRef","offsetsRef","onScrollViewChanged","nextIndex","prevIndex","withTiming","duration","savedOffsetY","scrollHandler","useAnimatedScrollHandler","onBeginDrag","onMomentumBegin","onScroll","event","offsetY","contentOffset","y","ty","maxTy","deltaY","dy","min","onEndDrag","onMomentumEnd","threshold","nextTranslateY","hasCollapsible","appBarStyle","paddingTop","top","floating","undefined","scrollContentInsets"],"sources":["useUnstableCollapsibleAppBar.ts"],"sourcesContent":["import { useRef } from 'react';\nimport { Falsy, Platform, RegisteredStyle, ScrollViewProps, ViewProps, ViewStyle } from 'react-native';\nimport type { SharedValue } from 'react-native-reanimated';\nimport {\n useAnimatedScrollHandler,\n useAnimatedStyle,\n useDerivedValue,\n useSharedValue,\n withTiming,\n} from 'react-native-reanimated';\nimport { useSafeAreaInsets } from 'react-native-safe-area-context';\nimport useAppbarStyles from './useAppbarStyles';\nimport useElevationStyle from './useElevationStyle';\nimport useHeight from './useHeight';\n\ntype WebOnlyStyle = { boxShadow: any };\n\ntype ViewStyleProp = Array<ViewStyle | RegisteredStyle<ViewStyle> | WebOnlyStyle | Falsy>;\n\ntype OnScroll = ScrollViewProps['onScroll'];\n\ntype OnLayoutCallback = ViewProps['onLayout'];\n\nexport interface ContentInsets {\n top?: number;\n bottom?: number;\n left?: number;\n right?: number;\n}\n\nexport interface Options {\n shouldTranslateYReset?: boolean;\n}\n\nexport interface CollapsibleAppBar {\n appBarStyle: ViewStyleProp;\n vectorY: SharedValue<number>;\n onAppBarLayout: OnLayoutCallback;\n onCollapsibleToolbarLayout: OnLayoutCallback;\n onScroll: OnScroll;\n onScrollViewChanged: (index: number) => void;\n scrollContentInsets: ContentInsets;\n}\n\nconst defaultOptions: Required<Options> = {\n shouldTranslateYReset: false,\n};\n\nconst ANIMATION_DURATION_MILLIS = 100;\n\nconst SUPPORTS_DRAG_DETECTION = Platform.OS !== 'web';\n\nfunction useLargerValueOfLastTwoValues(value: number) {\n const refLatestTwoValues = useRef([0, 0]);\n\n refLatestTwoValues.current.shift();\n refLatestTwoValues.current.push(value);\n\n return Math.max(...refLatestTwoValues.current);\n}\n\nexport default function useUnstableCollapsibleAppBar(userOptions: Options = defaultOptions): CollapsibleAppBar {\n const { shouldTranslateYReset }: Required<Options> = {\n ...defaultOptions,\n ...userOptions,\n };\n\n const styles = useAppbarStyles();\n\n const safeAreaInsets = useSafeAreaInsets();\n\n const [appBarHeight, onAppBarLayout] = useHeight();\n const appBarMaxHeight = useLargerValueOfLastTwoValues(appBarHeight);\n const [collapsibleToolbarHeight, onCollapsibleToolbarLayout] = useHeight();\n\n const maxTranslateY = useDerivedValue(() => -collapsibleToolbarHeight, [collapsibleToolbarHeight]);\n\n const translateY = useSharedValue<number>(0);\n const lastTranslateY = useSharedValue<number>(0);\n const lastOffsetY = useSharedValue<number>(0);\n const prevOffsetY = useSharedValue<number>(0);\n const overlapped = useSharedValue<boolean>(false);\n const vectorY = useSharedValue<number>(0);\n\n const elevationStyle = useElevationStyle(4);\n const animatedStyle = useAnimatedStyle(() => {\n const transform = [{ translateY: translateY.value }];\n\n if (Platform.OS === 'web') {\n return {\n transform,\n boxShadow: overlapped.value ? elevationStyle?.boxShadow : 0,\n };\n }\n if (Platform.OS === 'android') {\n return {\n transform,\n elevation: overlapped.value ? elevationStyle?.elevation : 0,\n };\n }\n if (Platform.OS === 'ios') {\n return {\n transform,\n shadowColor: elevationStyle?.shadowColor,\n shadowOffset: elevationStyle?.shadowOffset,\n shadowRadius: elevationStyle?.shadowRadius,\n shadowOpacity: overlapped.value ? elevationStyle?.shadowOpacity : 0,\n };\n }\n return {};\n }, [\n /**\n * FIXME: Consider add `elevationStyle` to dependencies.\n */\n ]);\n\n const indexRef = useRef<number>(0);\n const offsetsRef = useRef<Array<number>>([]);\n\n const onScrollViewChanged = (nextIndex: number) => {\n const prevIndex = indexRef.current;\n if (prevIndex === nextIndex) {\n if (shouldTranslateYReset) {\n translateY.value = withTiming(0, {\n duration: ANIMATION_DURATION_MILLIS,\n });\n\n vectorY.value = 0;\n offsetsRef.current = [];\n overlapped.value = false;\n }\n\n return;\n }\n\n offsetsRef.current[prevIndex] = lastOffsetY.value;\n\n const savedOffsetY = offsetsRef.current[nextIndex] ?? 0;\n lastOffsetY.value = savedOffsetY;\n\n indexRef.current = nextIndex;\n\n // Determine whether to overlap every time index is changed.\n overlapped.value = savedOffsetY > 0;\n\n // If next ScrollView's offset is too short, expand app bar.\n if (translateY.value < 0 && savedOffsetY < appBarHeight) {\n translateY.value = withTiming(0, {\n duration: ANIMATION_DURATION_MILLIS,\n });\n\n vectorY.value = 0;\n }\n };\n\n const scrollHandler = useAnimatedScrollHandler({\n onBeginDrag: () => {\n lastTranslateY.value = translateY.value;\n },\n onMomentumBegin: () => {\n lastTranslateY.value = translateY.value;\n },\n onScroll: (event) => {\n const offsetY = event.contentOffset.y;\n\n const ty = translateY.value;\n const maxTy = maxTranslateY.value;\n\n const deltaY = offsetY - prevOffsetY.value;\n vectorY.value = (vectorY.value * deltaY >= 0 && offsetY > 0) ? vectorY.value + deltaY : deltaY;\n prevOffsetY.value = offsetY;\n\n if (SUPPORTS_DRAG_DETECTION) {\n const dy = offsetY - lastOffsetY.value;\n\n translateY.value = offsetY <= 0 ? 0 : Math.min(Math.max(lastTranslateY.value - dy, maxTy), 0);\n\n overlapped.value = offsetY + translateY.value > 0;\n } else {\n if (offsetY > -maxTy) {\n if (ty === 0) {\n translateY.value = withTiming(Math.min(Math.max(-offsetY, maxTy), 0), {\n duration: ANIMATION_DURATION_MILLIS,\n });\n }\n } else {\n if (ty === maxTy) {\n translateY.value = withTiming(0, {\n duration: ANIMATION_DURATION_MILLIS,\n });\n }\n }\n\n overlapped.value = offsetY > 0;\n\n lastOffsetY.value = offsetY;\n }\n },\n onEndDrag: (event) => {\n lastOffsetY.value = event.contentOffset.y;\n },\n onMomentumEnd: (event) => {\n const offsetY = event.contentOffset.y;\n\n lastOffsetY.value = offsetY;\n\n const ty = translateY.value;\n const maxTy = maxTranslateY.value;\n\n // If toolbar is already positioned on edge, do nothing.\n if (ty <= maxTy || ty >= 0) {\n return;\n }\n\n const threshold = maxTy * 0.5;\n\n const nextTranslateY = (ty > threshold || offsetY < appBarHeight) ? 0 : maxTy;\n\n overlapped.value = offsetY + nextTranslateY > 0;\n\n translateY.value = withTiming(nextTranslateY, {\n duration: ANIMATION_DURATION_MILLIS,\n });\n },\n }, []);\n\n const hasCollapsible = collapsibleToolbarHeight > 0;\n\n const appBarStyle = [\n animatedStyle,\n { paddingTop: safeAreaInsets.top },\n hasCollapsible ? styles.floating : undefined,\n ];\n\n return {\n appBarStyle,\n vectorY,\n onAppBarLayout,\n onCollapsibleToolbarLayout,\n onScroll: scrollHandler,\n onScrollViewChanged,\n scrollContentInsets: { top: hasCollapsible ? appBarMaxHeight : 0 },\n };\n};\n"],"mappings":";;;;;;;AAAA;;AACA;;AAEA;;AAOA;;AACA;;AACA;;AACA;;;;AA+BA,MAAMA,cAAiC,GAAG;EACtCC,qBAAqB,EAAE;AADe,CAA1C;AAIA,MAAMC,yBAAyB,GAAG,GAAlC;AAEA,MAAMC,uBAAuB,GAAGC,qBAAA,CAASC,EAAT,KAAgB,KAAhD;;AAEA,SAASC,6BAAT,CAAuCC,KAAvC,EAAsD;EAClD,MAAMC,kBAAkB,GAAG,IAAAC,aAAA,EAAO,CAAC,CAAD,EAAI,CAAJ,CAAP,CAA3B;EAEAD,kBAAkB,CAACE,OAAnB,CAA2BC,KAA3B;EACAH,kBAAkB,CAACE,OAAnB,CAA2BE,IAA3B,CAAgCL,KAAhC;EAEA,OAAOM,IAAI,CAACC,GAAL,CAAS,GAAGN,kBAAkB,CAACE,OAA/B,CAAP;AACH;;AAEc,SAASK,4BAAT,GAAgG;EAAA,IAA1DC,WAA0D,uEAAnChB,cAAmC;EAC3G,MAAM;IAAEC;EAAF,IAA+C,EACjD,GAAGD,cAD8C;IAEjD,GAAGgB;E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CAApC;MAEA/B,WAAW,CAACzB,KAAZ,GAAoBsD,OAApB;MAEA,MAAMG,EAAE,GAAGnC,UAAU,CAACtB,KAAtB;MACA,MAAM0D,KAAK,GAAGtC,aAAa,CAACpB,KAA5B,CANsB,CAQtB;;MACA,IAAIyD,EAAE,IAAIC,KAAN,IAAeD,EAAE,IAAI,CAAzB,EAA4B;QACxB;MACH;;MAED,MAAMO,SAAS,GAAGN,KAAK,GAAG,GAA1B;MAEA,MAAMO,cAAc,GAAIR,EAAE,GAAGO,SAAL,IAAkBV,OAAO,GAAGxC,YAA7B,GAA6C,CAA7C,GAAiD4C,KAAxE;MAEA/B,UAAU,CAAC3B,KAAX,GAAmBsD,OAAO,GAAGW,cAAV,GAA2B,CAA9C;MAEA3C,UAAU,CAACtB,KAAX,GAAmB,IAAA6C,iCAAA,EAAWoB,cAAX,EAA2B;QAC1CnB,QAAQ,EAAEnD;MADgC,CAA3B,CAAnB;IAGH;EApE0C,CAAzB,EAqEnB,EArEmB,CAAtB;EAuEA,MAAMuE,cAAc,GAAGhD,wBAAwB,GAAG,CAAlD;EAEA,MAAMiD,WAAW,GAAG,CAChBpC,aADgB,EAEhB;IAAEqC,UAAU,EAAExD,cAAc,CAACyD;EAA7B,CAFgB,EAGhBH,cAAc,GAAGxD,MAAM,CAAC4D,QAAV,GAAqBC,SAHnB,CAApB;EAMA,OAAO;IACHJ,WADG;IAEHvC,OAFG;IAGHb,cAHG;IAIHI,0BAJG;IAKHiC,QAAQ,EAAEJ,aALP;IAMHN,mBANG;IAOH8B,mBAAmB,EAAE;MAAEH,GAAG,EAAEH,cAAc,GAAGjD,eAAH,GAAqB;IAA1C;EAPlB,CAAP;AASH;;AAAA"}
|
|
@@ -5,24 +5,22 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.default = useAnimatedDisplayStyle;
|
|
7
7
|
|
|
8
|
-
var _reactNativeReanimated =
|
|
8
|
+
var _reactNativeReanimated = require("react-native-reanimated");
|
|
9
9
|
|
|
10
|
-
function
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
const display = _reactNativeReanimated.
|
|
14
|
-
|
|
15
|
-
_reactNativeReanimated.default.useAnimatedReaction(() => vectorY.value, vy => {
|
|
10
|
+
function useAnimatedDisplayStyle(vectorY) {
|
|
11
|
+
let threshold = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 200;
|
|
12
|
+
let defaultDisplay = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'flex';
|
|
13
|
+
const display = (0, _reactNativeReanimated.useSharedValue)(defaultDisplay);
|
|
14
|
+
(0, _reactNativeReanimated.useAnimatedReaction)(() => vectorY.value, vy => {
|
|
16
15
|
if (vy >= threshold) {
|
|
17
16
|
display.value = 'none';
|
|
18
17
|
} else if (vy < threshold) {
|
|
19
18
|
display.value = 'flex';
|
|
20
19
|
}
|
|
21
|
-
});
|
|
22
|
-
|
|
23
|
-
return _reactNativeReanimated.default.useAnimatedStyle(() => ({
|
|
20
|
+
}, [threshold]);
|
|
21
|
+
return (0, _reactNativeReanimated.useAnimatedStyle)(() => ({
|
|
24
22
|
display: display.value
|
|
25
|
-
}));
|
|
23
|
+
}), []);
|
|
26
24
|
}
|
|
27
25
|
|
|
28
26
|
;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"names":["useAnimatedDisplayStyle","vectorY","threshold","defaultDisplay","display","useSharedValue","useAnimatedReaction","value","vy","useAnimatedStyle"],"sources":["useUnstableToggleDisplayStyle.ts"],"sourcesContent":["import type { SharedValue } from 'react-native-reanimated';\nimport { useAnimatedReaction, useAnimatedStyle, useSharedValue } from 'react-native-reanimated';\n\nexport default function useAnimatedDisplayStyle(\n vectorY: SharedValue<number>,\n threshold: number = 200,\n defaultDisplay: 'flex' | 'none' = 'flex',\n) {\n const display = useSharedValue(defaultDisplay);\n\n useAnimatedReaction(\n () => vectorY.value,\n (vy) => {\n if (vy >= threshold) {\n display.value = 'none';\n } else if (vy < threshold) {\n display.value = 'flex';\n }\n },\n [threshold],\n );\n\n return useAnimatedStyle(() => ({\n display: display.value,\n }), []);\n};\n"],"mappings":";;;;;;;AACA;;AAEe,SAASA,uBAAT,CACXC,OADW,EAIb;EAAA,IAFEC,SAEF,uEAFsB,GAEtB;EAAA,IADEC,cACF,uEADoC,MACpC;EACE,MAAMC,OAAO,GAAG,IAAAC,qCAAA,EAAeF,cAAf,CAAhB;EAEA,IAAAG,0CAAA,EACI,MAAML,OAAO,CAACM,KADlB,EAEKC,EAAD,IAAQ;IACJ,IAAIA,EAAE,IAAIN,SAAV,EAAqB;MACjBE,OAAO,CAACG,KAAR,GAAgB,MAAhB;IACH,CAFD,MAEO,IAAIC,EAAE,GAAGN,SAAT,EAAoB;MACvBE,OAAO,CAACG,KAAR,GAAgB,MAAhB;IACH;EACJ,CARL,EASI,CAACL,SAAD,CATJ;EAYA,OAAO,IAAAO,uCAAA,EAAiB,OAAO;IAC3BL,OAAO,EAAEA,OAAO,CAACG;EADU,CAAP,CAAjB,EAEH,EAFG,CAAP;AAGH;;AAAA"}
|
package/build/commonjs/index.js
CHANGED
|
@@ -9,6 +9,7 @@ var _exportNames = {
|
|
|
9
9
|
DateTimePicker: true,
|
|
10
10
|
FlipCard: true,
|
|
11
11
|
ViewPager: true,
|
|
12
|
+
ComicViewer: true,
|
|
12
13
|
StatusBarProvider: true,
|
|
13
14
|
useStatusBarContext: true
|
|
14
15
|
};
|
|
@@ -24,6 +25,12 @@ Object.defineProperty(exports, "Carousel", {
|
|
|
24
25
|
return _Carousel.default;
|
|
25
26
|
}
|
|
26
27
|
});
|
|
28
|
+
Object.defineProperty(exports, "ComicViewer", {
|
|
29
|
+
enumerable: true,
|
|
30
|
+
get: function () {
|
|
31
|
+
return _ComicViewer.default;
|
|
32
|
+
}
|
|
33
|
+
});
|
|
27
34
|
Object.defineProperty(exports, "DateTimePicker", {
|
|
28
35
|
enumerable: true,
|
|
29
36
|
get: function () {
|
|
@@ -36,16 +43,16 @@ Object.defineProperty(exports, "FlipCard", {
|
|
|
36
43
|
return _FlipCard.default;
|
|
37
44
|
}
|
|
38
45
|
});
|
|
39
|
-
Object.defineProperty(exports, "
|
|
46
|
+
Object.defineProperty(exports, "StatusBarProvider", {
|
|
40
47
|
enumerable: true,
|
|
41
48
|
get: function () {
|
|
42
|
-
return
|
|
49
|
+
return _StatusBarProvider.default;
|
|
43
50
|
}
|
|
44
51
|
});
|
|
45
|
-
Object.defineProperty(exports, "
|
|
52
|
+
Object.defineProperty(exports, "ViewPager", {
|
|
46
53
|
enumerable: true,
|
|
47
54
|
get: function () {
|
|
48
|
-
return
|
|
55
|
+
return _ViewPager.default;
|
|
49
56
|
}
|
|
50
57
|
});
|
|
51
58
|
Object.defineProperty(exports, "useStatusBarContext", {
|
|
@@ -125,6 +132,20 @@ Object.keys(_ViewPager).forEach(function (key) {
|
|
|
125
132
|
});
|
|
126
133
|
});
|
|
127
134
|
|
|
135
|
+
var _ComicViewer = _interopRequireWildcard(require("./ComicViewer"));
|
|
136
|
+
|
|
137
|
+
Object.keys(_ComicViewer).forEach(function (key) {
|
|
138
|
+
if (key === "default" || key === "__esModule") return;
|
|
139
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
140
|
+
if (key in exports && exports[key] === _ComicViewer[key]) return;
|
|
141
|
+
Object.defineProperty(exports, key, {
|
|
142
|
+
enumerable: true,
|
|
143
|
+
get: function () {
|
|
144
|
+
return _ComicViewer[key];
|
|
145
|
+
}
|
|
146
|
+
});
|
|
147
|
+
});
|
|
148
|
+
|
|
128
149
|
var _StatusBarProvider = _interopRequireWildcard(require("./StatusBarProvider"));
|
|
129
150
|
|
|
130
151
|
Object.keys(_StatusBarProvider).forEach(function (key) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"names":[],"sources":["index.ts"],"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 ComicViewer } from './ComicViewer';\nexport * from './ComicViewer';\n\nexport { default as StatusBarProvider, useStatusBarContext } from './StatusBarProvider';\nexport * from './StatusBarProvider';\n\nexport * from './hooks';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;EAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AAEA;;AACA;EAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AAEA;;AACA;EAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AAEA;;AACA;EAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AAEA;;AACA;EAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AAEA;;AACA;EAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AAEA;;AACA;EAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AAEA;;AAAA;EAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA"}
|
|
@@ -1,23 +1,24 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import Animated, { Easing } from 'react-native-reanimated';
|
|
1
|
+
import React, { useEffect } from 'react';
|
|
2
|
+
import Animated, { Easing, useAnimatedStyle, useSharedValue, withTiming } from 'react-native-reanimated';
|
|
3
|
+
const ANIMATION_CONFIG = {
|
|
4
|
+
duration: 150,
|
|
5
|
+
easing: Easing.out(Easing.exp)
|
|
6
|
+
};
|
|
3
7
|
export default function AnimatedY(props) {
|
|
4
8
|
const {
|
|
5
9
|
children,
|
|
6
10
|
translateY,
|
|
7
11
|
style
|
|
8
12
|
} = props;
|
|
9
|
-
const animatedY =
|
|
10
|
-
const animatedStyle =
|
|
13
|
+
const animatedY = useSharedValue(translateY);
|
|
14
|
+
const animatedStyle = useAnimatedStyle(() => ({
|
|
11
15
|
transform: [{
|
|
12
16
|
translateY: animatedY.value
|
|
13
17
|
}]
|
|
14
|
-
}));
|
|
15
|
-
|
|
18
|
+
}), []);
|
|
19
|
+
useEffect(() => {
|
|
16
20
|
if (translateY >= 0) {
|
|
17
|
-
animatedY.value =
|
|
18
|
-
duration: 150,
|
|
19
|
-
easing: Easing.out(Easing.exp)
|
|
20
|
-
});
|
|
21
|
+
animatedY.value = withTiming(translateY, ANIMATION_CONFIG);
|
|
21
22
|
}
|
|
22
23
|
}, [translateY]);
|
|
23
24
|
return /*#__PURE__*/React.createElement(Animated.View, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"names":["React","useEffect","Animated","Easing","useAnimatedStyle","useSharedValue","withTiming","ANIMATION_CONFIG","duration","easing","out","exp","AnimatedY","props","children","translateY","style","animatedY","animatedStyle","transform","value"],"sources":["AnimatedY.tsx"],"sourcesContent":["import React, { useEffect } from 'react';\nimport type { WithTimingConfig } from 'react-native-reanimated';\nimport Animated, { Easing, useAnimatedStyle, useSharedValue, withTiming } from 'react-native-reanimated';\nimport type AnimatedYProps from './AnimatedYProps';\n\nconst ANIMATION_CONFIG: Readonly<WithTimingConfig> = {\n duration: 150,\n easing: Easing.out(Easing.exp),\n};\n\nexport default function AnimatedY(props: AnimatedYProps) {\n const {\n children,\n translateY,\n style,\n } = props;\n\n const animatedY = useSharedValue(translateY);\n const animatedStyle = useAnimatedStyle(() => ({\n transform: [{ translateY: animatedY.value }],\n }), []);\n\n useEffect(() => {\n if (translateY >= 0) {\n animatedY.value = withTiming(translateY, ANIMATION_CONFIG);\n }\n }, [translateY]);\n\n return (\n <Animated.View\n children={children}\n style={[\n animatedStyle,\n style,\n ]}\n />\n );\n};\n"],"mappings":"AAAA,OAAOA,KAAP,IAAgBC,SAAhB,QAAiC,OAAjC;AAEA,OAAOC,QAAP,IAAmBC,MAAnB,EAA2BC,gBAA3B,EAA6CC,cAA7C,EAA6DC,UAA7D,QAA+E,yBAA/E;AAGA,MAAMC,gBAA4C,GAAG;EACjDC,QAAQ,EAAE,GADuC;EAEjDC,MAAM,EAAEN,MAAM,CAACO,GAAP,CAAWP,MAAM,CAACQ,GAAlB;AAFyC,CAArD;AAKA,eAAe,SAASC,SAAT,CAAmBC,KAAnB,EAA0C;EACrD,MAAM;IACFC,QADE;IAEFC,UAFE;IAGFC;EAHE,IAIFH,KAJJ;EAMA,MAAMI,SAAS,GAAGZ,cAAc,CAACU,UAAD,CAAhC;EACA,MAAMG,aAAa,GAAGd,gBAAgB,CAAC,OAAO;IAC1Ce,SAAS,EAAE,CAAC;MAAEJ,UAAU,EAAEE,SAAS,CAACG;IAAxB,CAAD;EAD+B,CAAP,CAAD,EAElC,EAFkC,CAAtC;EAIAnB,SAAS,CAAC,MAAM;IACZ,IAAIc,UAAU,IAAI,CAAlB,EAAqB;MACjBE,SAAS,CAACG,KAAV,GAAkBd,UAAU,CAACS,UAAD,EAAaR,gBAAb,CAA5B;IACH;EACJ,CAJQ,EAIN,CAACQ,UAAD,CAJM,CAAT;EAMA,oBACI,oBAAC,QAAD,CAAU,IAAV;IACI,QAAQ,EAAED,QADd;IAEI,KAAK,EAAE,CACHI,aADG,EAEHF,KAFG;EAFX,EADJ;AASH;AAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"names":[],"sources":["AnimatedYProps.ts"],"sourcesContent":["import React from 'react';\nimport type { ComponentProps } from '@fountain-ui/core';\n\nexport default interface AnimatedYProps extends ComponentProps<{\n /**\n * The content of the component.\n */\n children?: React.ReactNode;\n\n /**\n * The translate y value of the component.\n */\n translateY: number;\n}> {}\n"],"mappings":""}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"names":["default"],"sources":["index.ts"],"sourcesContent":["export { default } from './AnimatedY';\nexport type { default as AnimatedYProps } from './AnimatedYProps';\n"],"mappings":"AAAA,SAASA,OAAT,QAAwB,aAAxB"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
function _extends() { _extends = Object.assign
|
|
1
|
+
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); }
|
|
2
2
|
|
|
3
3
|
import React from 'react';
|
|
4
4
|
import { Platform } from 'react-native';
|
|
@@ -44,6 +44,7 @@ export default function BottomSheet(props) {
|
|
|
44
44
|
} else {
|
|
45
45
|
var _bottomSheetRef$curre3;
|
|
46
46
|
|
|
47
|
+
// @ts-ignore
|
|
47
48
|
(_bottomSheetRef$curre3 = bottomSheetRef.current) === null || _bottomSheetRef$curre3 === void 0 ? void 0 : _bottomSheetRef$curre3.snapToIndex(index);
|
|
48
49
|
}
|
|
49
50
|
}, [index]);
|
|
@@ -57,6 +58,9 @@ export default function BottomSheet(props) {
|
|
|
57
58
|
web: shadow === null || shadow === void 0 ? void 0 : shadow.boxShadow
|
|
58
59
|
})
|
|
59
60
|
};
|
|
61
|
+
const backgroundStyle = {
|
|
62
|
+
backgroundColor: theme.palette.paper.default
|
|
63
|
+
};
|
|
60
64
|
const isBackdropTransparent = backdropOpacity <= 0;
|
|
61
65
|
|
|
62
66
|
const OpacityAwareBackdrop = props => /*#__PURE__*/React.createElement(BottomSheetBackdrop, _extends({}, props, {
|
|
@@ -66,7 +70,9 @@ export default function BottomSheet(props) {
|
|
|
66
70
|
}));
|
|
67
71
|
|
|
68
72
|
return /*#__PURE__*/React.createElement(BottomSheetModalProvider, null, /*#__PURE__*/React.createElement(BottomSheetModal, {
|
|
69
|
-
backdropComponent: isBackdropTransparent ? TransparentBackdrop : OpacityAwareBackdrop
|
|
73
|
+
backdropComponent: isBackdropTransparent ? TransparentBackdrop : OpacityAwareBackdrop // @ts-ignore
|
|
74
|
+
,
|
|
75
|
+
backgroundStyle: backgroundStyle,
|
|
70
76
|
index: index,
|
|
71
77
|
handleComponent: NoHandle,
|
|
72
78
|
onChange: handleChange,
|