react-native-header-motion 0.4.0 → 1.0.0-beta.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/README.md +400 -335
- package/lib/module/components/Bridge.js +16 -0
- package/lib/module/components/Bridge.js.map +1 -0
- package/lib/module/components/FlatList.js +5 -62
- package/lib/module/components/FlatList.js.map +1 -1
- package/lib/module/components/Header.js +71 -13
- package/lib/module/components/Header.js.map +1 -1
- package/lib/module/components/HeaderDynamic.js +34 -0
- package/lib/module/components/HeaderDynamic.js.map +1 -0
- package/lib/module/components/HeaderMotion.js +59 -23
- package/lib/module/components/HeaderMotion.js.map +1 -1
- package/lib/module/components/HeaderPanBoundary.js +54 -0
- package/lib/module/components/HeaderPanBoundary.js.map +1 -0
- package/lib/module/components/NavigationBridge.js +20 -0
- package/lib/module/components/NavigationBridge.js.map +1 -0
- package/lib/module/components/ScrollManager.js +7 -5
- package/lib/module/components/ScrollManager.js.map +1 -1
- package/lib/module/components/ScrollView.js +6 -47
- package/lib/module/components/ScrollView.js.map +1 -1
- package/lib/module/components/createHeaderMotionScrollable.js +136 -0
- package/lib/module/components/createHeaderMotionScrollable.js.map +1 -0
- package/lib/module/components/index.js +3 -1
- package/lib/module/components/index.js.map +1 -1
- package/lib/module/context.js +8 -1
- package/lib/module/context.js.map +1 -1
- package/lib/module/hooks/index.js +1 -0
- package/lib/module/hooks/index.js.map +1 -1
- package/lib/module/hooks/useActiveScrollId.js +7 -6
- package/lib/module/hooks/useActiveScrollId.js.map +1 -1
- package/lib/module/hooks/useHeaderMotionBridge.js +14 -0
- package/lib/module/hooks/useHeaderMotionBridge.js.map +1 -0
- package/lib/module/hooks/useMotionProgress.js +10 -36
- package/lib/module/hooks/useMotionProgress.js.map +1 -1
- package/lib/module/hooks/useMotionProgress.test.js +56 -0
- package/lib/module/hooks/useMotionProgress.test.js.map +1 -0
- package/lib/module/hooks/useScrollManager.js +219 -109
- package/lib/module/hooks/useScrollManager.js.map +1 -1
- package/lib/module/index.js +21 -18
- package/lib/module/index.js.map +1 -1
- package/lib/module/utils/defaults.js +2 -1
- package/lib/module/utils/defaults.js.map +1 -1
- package/lib/module/utils/header.js +24 -0
- package/lib/module/utils/header.js.map +1 -0
- package/lib/module/utils/headerOffsetStyle.js +31 -0
- package/lib/module/utils/headerOffsetStyle.js.map +1 -0
- package/lib/module/utils/index.js +3 -0
- package/lib/module/utils/index.js.map +1 -1
- package/lib/module/utils/refreshControl.js +93 -0
- package/lib/module/utils/refreshControl.js.map +1 -0
- package/lib/module/utils/values.js +36 -0
- package/lib/module/utils/values.js.map +1 -1
- package/lib/typescript/src/components/Bridge.d.ts +19 -0
- package/lib/typescript/src/components/Bridge.d.ts.map +1 -0
- package/lib/typescript/src/components/FlatList.d.ts +7 -15
- package/lib/typescript/src/components/FlatList.d.ts.map +1 -1
- package/lib/typescript/src/components/Header.d.ts +73 -12
- package/lib/typescript/src/components/Header.d.ts.map +1 -1
- package/lib/typescript/src/components/HeaderDynamic.d.ts +11 -0
- package/lib/typescript/src/components/HeaderDynamic.d.ts.map +1 -0
- package/lib/typescript/src/components/HeaderMotion.d.ts +37 -18
- package/lib/typescript/src/components/HeaderMotion.d.ts.map +1 -1
- package/lib/typescript/src/components/HeaderPanBoundary.d.ts +11 -0
- package/lib/typescript/src/components/HeaderPanBoundary.d.ts.map +1 -0
- package/lib/typescript/src/components/NavigationBridge.d.ts +19 -0
- package/lib/typescript/src/components/NavigationBridge.d.ts.map +1 -0
- package/lib/typescript/src/components/ScrollManager.d.ts +18 -25
- package/lib/typescript/src/components/ScrollManager.d.ts.map +1 -1
- package/lib/typescript/src/components/ScrollView.d.ts +7 -14
- package/lib/typescript/src/components/ScrollView.d.ts.map +1 -1
- package/lib/typescript/src/components/createHeaderMotionScrollable.d.ts +86 -0
- package/lib/typescript/src/components/createHeaderMotionScrollable.d.ts.map +1 -0
- package/lib/typescript/src/components/index.d.ts +3 -1
- package/lib/typescript/src/components/index.d.ts.map +1 -1
- package/lib/typescript/src/context.d.ts +3 -13
- package/lib/typescript/src/context.d.ts.map +1 -1
- package/lib/typescript/src/hooks/index.d.ts +1 -0
- package/lib/typescript/src/hooks/index.d.ts.map +1 -1
- package/lib/typescript/src/hooks/useActiveScrollId.d.ts +7 -6
- package/lib/typescript/src/hooks/useActiveScrollId.d.ts.map +1 -1
- package/lib/typescript/src/hooks/useHeaderMotionBridge.d.ts +10 -0
- package/lib/typescript/src/hooks/useHeaderMotionBridge.d.ts.map +1 -0
- package/lib/typescript/src/hooks/useMotionProgress.d.ts +8 -25
- package/lib/typescript/src/hooks/useMotionProgress.d.ts.map +1 -1
- package/lib/typescript/src/hooks/useMotionProgress.test.d.ts +2 -0
- package/lib/typescript/src/hooks/useMotionProgress.test.d.ts.map +1 -0
- package/lib/typescript/src/hooks/useScrollManager.d.ts +63 -31
- package/lib/typescript/src/hooks/useScrollManager.d.ts.map +1 -1
- package/lib/typescript/src/index.d.ts +56 -26
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/types.d.ts +63 -15
- package/lib/typescript/src/types.d.ts.map +1 -1
- package/lib/typescript/src/utils/defaults.d.ts +3 -2
- package/lib/typescript/src/utils/defaults.d.ts.map +1 -1
- package/lib/typescript/src/utils/header.d.ts +10 -0
- package/lib/typescript/src/utils/header.d.ts.map +1 -0
- package/lib/typescript/src/utils/headerOffsetStyle.d.ts +19 -0
- package/lib/typescript/src/utils/headerOffsetStyle.d.ts.map +1 -0
- package/lib/typescript/src/utils/index.d.ts +3 -0
- package/lib/typescript/src/utils/index.d.ts.map +1 -1
- package/lib/typescript/src/utils/refreshControl.d.ts +150 -0
- package/lib/typescript/src/utils/refreshControl.d.ts.map +1 -0
- package/lib/typescript/src/utils/values.d.ts +4 -1
- package/lib/typescript/src/utils/values.d.ts.map +1 -1
- package/package.json +13 -5
- package/src/components/Bridge.tsx +29 -0
- package/src/components/FlatList.tsx +18 -84
- package/src/components/Header.tsx +159 -23
- package/src/components/HeaderDynamic.tsx +45 -0
- package/src/components/HeaderMotion.tsx +114 -41
- package/src/components/HeaderPanBoundary.tsx +92 -0
- package/src/components/NavigationBridge.tsx +30 -0
- package/src/components/ScrollManager.tsx +38 -43
- package/src/components/ScrollView.tsx +16 -68
- package/src/components/createHeaderMotionScrollable.tsx +438 -0
- package/src/components/index.ts +3 -1
- package/src/context.ts +12 -18
- package/src/hooks/index.ts +1 -0
- package/src/hooks/useActiveScrollId.ts +7 -6
- package/src/hooks/useHeaderMotionBridge.ts +15 -0
- package/src/hooks/useMotionProgress.test.ts +67 -0
- package/src/hooks/useMotionProgress.ts +12 -37
- package/src/hooks/useScrollManager.ts +310 -129
- package/src/index.ts +82 -36
- package/src/types.ts +85 -25
- package/src/utils/defaults.ts +7 -1
- package/src/utils/header.tsx +52 -0
- package/src/utils/headerOffsetStyle.ts +40 -0
- package/src/utils/index.ts +3 -0
- package/src/utils/refreshControl.tsx +118 -0
- package/src/utils/values.ts +57 -1
- package/lib/module/components/HeaderBase.js +0 -59
- package/lib/module/components/HeaderBase.js.map +0 -1
- package/lib/module/hooks/refreshControl.js +0 -31
- package/lib/module/hooks/refreshControl.js.map +0 -1
- package/lib/typescript/src/components/HeaderBase.d.ts +0 -34
- package/lib/typescript/src/components/HeaderBase.d.ts.map +0 -1
- package/lib/typescript/src/hooks/refreshControl.d.ts +0 -13
- package/lib/typescript/src/hooks/refreshControl.d.ts.map +0 -1
- package/src/components/HeaderBase.tsx +0 -51
- package/src/hooks/refreshControl.ts +0 -55
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { cloneElement, createElement, isValidElement } from 'react';
|
|
4
|
+
import { RefreshControl } from 'react-native';
|
|
5
|
+
import Animated, { useAnimatedProps } from 'react-native-reanimated';
|
|
6
|
+
|
|
7
|
+
// FIXME: Types are a mess here
|
|
8
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
9
|
+
const AnimatedRefreshControl = Animated.createAnimatedComponent(RefreshControl);
|
|
10
|
+
export function resolveRefreshControl({
|
|
11
|
+
refreshControl,
|
|
12
|
+
refreshing,
|
|
13
|
+
onRefresh,
|
|
14
|
+
progressViewOffset
|
|
15
|
+
}) {
|
|
16
|
+
if (!refreshControl) {
|
|
17
|
+
return createRefreshControlWithOffset({
|
|
18
|
+
refreshing,
|
|
19
|
+
onRefresh,
|
|
20
|
+
progressViewOffset
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
return /*#__PURE__*/isValidElement(refreshControl) ? injectProgressViewOffset(refreshControl, progressViewOffset) : undefined;
|
|
24
|
+
}
|
|
25
|
+
function createRefreshControlWithOffset({
|
|
26
|
+
refreshing,
|
|
27
|
+
onRefresh,
|
|
28
|
+
progressViewOffset
|
|
29
|
+
}) {
|
|
30
|
+
if (!onRefresh) {
|
|
31
|
+
return undefined;
|
|
32
|
+
}
|
|
33
|
+
return /*#__PURE__*/createElement(ResolvedRefreshControl, {
|
|
34
|
+
refreshing: refreshing ?? false,
|
|
35
|
+
onRefresh: onRefresh,
|
|
36
|
+
progressViewOffset: progressViewOffset
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
function injectProgressViewOffset(refreshControl, progressViewOffset) {
|
|
40
|
+
const offset = refreshControl.props.progressViewOffset ?? progressViewOffset;
|
|
41
|
+
if (!isSharedValue(offset)) {
|
|
42
|
+
return /*#__PURE__*/cloneElement(refreshControl, {
|
|
43
|
+
progressViewOffset: offset
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
return /*#__PURE__*/createElement(ResolvedRefreshControl, {
|
|
47
|
+
...refreshControl.props,
|
|
48
|
+
progressViewOffset: progressViewOffset
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
function ResolvedRefreshControl({
|
|
52
|
+
refreshing,
|
|
53
|
+
onRefresh,
|
|
54
|
+
progressViewOffset,
|
|
55
|
+
...props
|
|
56
|
+
}) {
|
|
57
|
+
const animatedProps = useAnimatedProps(() => {
|
|
58
|
+
return {
|
|
59
|
+
...(isSharedValue(refreshing) ? {
|
|
60
|
+
refreshing: refreshing.value
|
|
61
|
+
} : {}),
|
|
62
|
+
...(isSharedValue(onRefresh) ? {
|
|
63
|
+
onRefresh: onRefresh.value
|
|
64
|
+
} : {}),
|
|
65
|
+
...(isSharedValue(progressViewOffset) ? {
|
|
66
|
+
progressViewOffset: progressViewOffset.value
|
|
67
|
+
} : {})
|
|
68
|
+
};
|
|
69
|
+
});
|
|
70
|
+
const nonAnimatedProps = {
|
|
71
|
+
...(isSharedValue(refreshing) ? {} : {
|
|
72
|
+
refreshing
|
|
73
|
+
}),
|
|
74
|
+
...(isSharedValue(onRefresh) ? {} : {
|
|
75
|
+
onRefresh
|
|
76
|
+
}),
|
|
77
|
+
...(isSharedValue(progressViewOffset) ? {} : {
|
|
78
|
+
progressViewOffset
|
|
79
|
+
})
|
|
80
|
+
};
|
|
81
|
+
return /*#__PURE__*/_jsx(AnimatedRefreshControl, {
|
|
82
|
+
...props,
|
|
83
|
+
...nonAnimatedProps,
|
|
84
|
+
refreshing: nonAnimatedProps.refreshing,
|
|
85
|
+
animatedProps: animatedProps
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
function isSharedValue(value) {
|
|
89
|
+
'worklet';
|
|
90
|
+
|
|
91
|
+
return typeof value === 'object' && value !== null && 'value' in value;
|
|
92
|
+
}
|
|
93
|
+
//# sourceMappingURL=refreshControl.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["cloneElement","createElement","isValidElement","RefreshControl","Animated","useAnimatedProps","jsx","_jsx","AnimatedRefreshControl","createAnimatedComponent","resolveRefreshControl","refreshControl","refreshing","onRefresh","progressViewOffset","createRefreshControlWithOffset","injectProgressViewOffset","undefined","ResolvedRefreshControl","offset","props","isSharedValue","animatedProps","value","nonAnimatedProps"],"sourceRoot":"../../../src","sources":["utils/refreshControl.tsx"],"mappings":";;AAAA,SACEA,YAAY,EACZC,aAAa,EACbC,cAAc,QAET,OAAO;AACd,SAASC,cAAc,QAAkC,cAAc;AAEvE,OAAOC,QAAQ,IAAIC,gBAAgB,QAAQ,yBAAyB;;AAEpE;AAAA,SAAAC,GAAA,IAAAC,IAAA;AAEA,MAAMC,sBAAsB,GAAGJ,QAAQ,CAACK,uBAAuB,CAACN,cAAc,CAAC;AAW/E,OAAO,SAASO,qBAAqBA,CAAC;EACpCC,cAAc;EACdC,UAAU;EACVC,SAAS;EACTC;AAC4B,CAAC,EAIjB;EACZ,IAAI,CAACH,cAAc,EAAE;IACnB,OAAOI,8BAA8B,CAAC;MACpCH,UAAU;MACVC,SAAS;MACTC;IACF,CAAC,CAAC;EACJ;EAEA,OAAO,aAAAZ,cAAc,CAAsBS,cAAc,CAAC,GACtDK,wBAAwB,CAACL,cAAc,EAAEG,kBAAkB,CAAC,GAC5DG,SAAS;AACf;AAEA,SAASF,8BAA8BA,CAAC;EACtCH,UAAU;EACVC,SAAS;EACTC;AACoD,CAAC,EAAE;EACvD,IAAI,CAACD,SAAS,EAAE;IACd,OAAOI,SAAS;EAClB;EAEA,oBAAOhB,aAAa,CAACiB,sBAAsB,EAAE;IAC3CN,UAAU,EAAGA,UAAU,IAAgB,KAAK;IAC5CC,SAAS,EAAEA,SAAuB;IAClCC,kBAAkB,EAAEA;EACtB,CAAC,CAAC;AACJ;AAEA,SAASE,wBAAwBA,CAC/BL,cAAiD,EACjDG,kBAA6D,EAC7D;EACA,MAAMK,MAAM,GAAGR,cAAc,CAACS,KAAK,CAACN,kBAAkB,IAAIA,kBAAkB;EAE5E,IAAI,CAACO,aAAa,CAASF,MAAM,CAAC,EAAE;IAClC,oBAAOnB,YAAY,CAACW,cAAc,EAAE;MAClCG,kBAAkB,EAAEK;IACtB,CAAC,CAAC;EACJ;EAEA,oBAAOlB,aAAa,CAACiB,sBAAsB,EAAE;IAC3C,GAAGP,cAAc,CAACS,KAAK;IACvBN,kBAAkB,EAAEA;EACtB,CAAC,CAAC;AACJ;AAEA,SAASI,sBAAsBA,CAAC;EAC9BN,UAAU;EACVC,SAAS;EACTC,kBAAkB;EAClB,GAAGM;AACgD,CAAC,EAAE;EACtD,MAAME,aAAa,GAAGjB,gBAAgB,CAAsB,MAAM;IAChE,OAAO;MACL,IAAIgB,aAAa,CAACT,UAAU,CAAC,GAAG;QAAEA,UAAU,EAAEA,UAAU,CAACW;MAAM,CAAC,GAAG,CAAC,CAAC,CAAC;MACtE,IAAIF,aAAa,CAACR,SAAS,CAAC,GAAG;QAAEA,SAAS,EAAEA,SAAS,CAACU;MAAM,CAAC,GAAG,CAAC,CAAC,CAAC;MACnE,IAAIF,aAAa,CAACP,kBAAkB,CAAC,GACjC;QAAEA,kBAAkB,EAAEA,kBAAkB,CAACS;MAAM,CAAC,GAChD,CAAC,CAAC;IACR,CAAC;EACH,CAAC,CAAC;EAEF,MAAMC,gBAAgB,GAAG;IACvB,IAAIH,aAAa,CAACT,UAAU,CAAC,GAAG,CAAC,CAAC,GAAG;MAAEA;IAAW,CAAC,CAAC;IACpD,IAAIS,aAAa,CAACR,SAAS,CAAC,GAAG,CAAC,CAAC,GAAG;MAAEA;IAAU,CAAC,CAAC;IAClD,IAAIQ,aAAa,CAACP,kBAAkB,CAAC,GAAG,CAAC,CAAC,GAAG;MAAEA;IAAmB,CAAC;EACrE,CAAC;EAED,oBACEP,IAAA,CAACC,sBAAsB;IAAA,GACjBY,KAAK;IAAA,GACLI,gBAAgB;IACpBZ,UAAU,EAAEY,gBAAgB,CAACZ,UAAsB;IACnDU,aAAa,EAAEA;EAAc,CAC9B,CAAC;AAEN;AAEA,SAASD,aAAaA,CACpBE,KAAsC,EACb;EACzB,SAAS;;EACT,OAAO,OAAOA,KAAK,KAAK,QAAQ,IAAIA,KAAK,KAAK,IAAI,IAAI,OAAO,IAAIA,KAAK;AACxE","ignoreList":[]}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
import { DEFAULT_SCROLL_ID } from "./defaults.js";
|
|
3
4
|
export function getInitialScrollValue() {
|
|
4
5
|
'worklet';
|
|
5
6
|
|
|
@@ -8,4 +9,39 @@ export function getInitialScrollValue() {
|
|
|
8
9
|
current: 0
|
|
9
10
|
};
|
|
10
11
|
}
|
|
12
|
+
export function ensureScrollValueRegistered(scrollValues, id) {
|
|
13
|
+
'worklet';
|
|
14
|
+
|
|
15
|
+
const values = scrollValues.get();
|
|
16
|
+
if (values[id]) {
|
|
17
|
+
return values;
|
|
18
|
+
}
|
|
19
|
+
scrollValues.modify(value => {
|
|
20
|
+
if (!value[id]) {
|
|
21
|
+
value[id] = getInitialScrollValue();
|
|
22
|
+
}
|
|
23
|
+
return value;
|
|
24
|
+
});
|
|
25
|
+
return scrollValues.get();
|
|
26
|
+
}
|
|
27
|
+
export function warnIfMissingActiveScrollId(scrollValues, id, activeScrollId) {
|
|
28
|
+
'worklet';
|
|
29
|
+
|
|
30
|
+
if (!__DEV__ || activeScrollId || id === DEFAULT_SCROLL_ID) {
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
let nonDefaultCount = 0;
|
|
34
|
+
let nonDefaultIds = '';
|
|
35
|
+
for (const key in scrollValues) {
|
|
36
|
+
if (key === DEFAULT_SCROLL_ID) {
|
|
37
|
+
continue;
|
|
38
|
+
}
|
|
39
|
+
nonDefaultCount += 1;
|
|
40
|
+
nonDefaultIds = nonDefaultIds ? `${nonDefaultIds}, ${key}` : key;
|
|
41
|
+
}
|
|
42
|
+
if (nonDefaultCount < 1) {
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
console.warn(`[react-native-header-motion] Explicit scrollIds (${nonDefaultIds}) are registered but no activeScrollId was provided. Pass useActiveScrollId(...).sv to <HeaderMotion activeScrollId={...}> to keep header motion deterministic.`);
|
|
46
|
+
}
|
|
11
47
|
//# sourceMappingURL=values.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["getInitialScrollValue","min","current"],"sourceRoot":"../../../src","sources":["utils/values.ts"],"mappings":";;AAEA,OAAO,
|
|
1
|
+
{"version":3,"names":["DEFAULT_SCROLL_ID","getInitialScrollValue","min","current","ensureScrollValueRegistered","scrollValues","id","values","get","modify","value","warnIfMissingActiveScrollId","activeScrollId","__DEV__","nonDefaultCount","nonDefaultIds","key","console","warn"],"sourceRoot":"../../../src","sources":["utils/values.ts"],"mappings":";;AAEA,SAASA,iBAAiB,QAAQ,eAAY;AAE9C,OAAO,SAASC,qBAAqBA,CAAA,EAAgB;EACnD,SAAS;;EACT,OAAO;IAAEC,GAAG,EAAE,CAAC;IAAEC,OAAO,EAAE;EAAE,CAAC;AAC/B;AAEA,OAAO,SAASC,2BAA2BA,CACzCC,YAAuC,EACvCC,EAAU,EACI;EACd,SAAS;;EAET,MAAMC,MAAM,GAAGF,YAAY,CAACG,GAAG,CAAC,CAAC;EACjC,IAAID,MAAM,CAACD,EAAE,CAAC,EAAE;IACd,OAAOC,MAAM;EACf;EAEAF,YAAY,CAACI,MAAM,CAAEC,KAAK,IAAK;IAC7B,IAAI,CAACA,KAAK,CAACJ,EAAE,CAAC,EAAE;MACbI,KAAK,CAAkBJ,EAAE,CAAC,GAAGL,qBAAqB,CAAC,CAAC;IACvD;IAEA,OAAOS,KAAK;EACd,CAAC,CAAC;EAEF,OAAOL,YAAY,CAACG,GAAG,CAAC,CAAC;AAC3B;AAEA,OAAO,SAASG,2BAA2BA,CACzCN,YAA0B,EAC1BC,EAAU,EACVM,cAAkC,EAC5B;EACN,SAAS;;EAET,IAAI,CAACC,OAAO,IAAID,cAAc,IAAIN,EAAE,KAAKN,iBAAiB,EAAE;IAC1D;EACF;EAEA,IAAIc,eAAe,GAAG,CAAC;EACvB,IAAIC,aAAa,GAAG,EAAE;EAEtB,KAAK,MAAMC,GAAG,IAAIX,YAAY,EAAE;IAC9B,IAAIW,GAAG,KAAKhB,iBAAiB,EAAE;MAC7B;IACF;IAEAc,eAAe,IAAI,CAAC;IACpBC,aAAa,GAAGA,aAAa,GAAG,GAAGA,aAAa,KAAKC,GAAG,EAAE,GAAGA,GAAG;EAClE;EAEA,IAAIF,eAAe,GAAG,CAAC,EAAE;IACvB;EACF;EAEAG,OAAO,CAACC,IAAI,CACV,oDAAoDH,aAAa,iKACnE,CAAC;AACH","ignoreList":[]}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
import type { HeaderMotionBridgeValue } from '../types';
|
|
3
|
+
type HeaderRenderChildren = (value: HeaderMotionBridgeValue) => ReactNode;
|
|
4
|
+
export interface HeaderMotionBridgeProps {
|
|
5
|
+
/**
|
|
6
|
+
* Render function that receives the current HeaderMotion context value.
|
|
7
|
+
*
|
|
8
|
+
* Use this when you need to pass the library's context across a React tree
|
|
9
|
+
* boundary, most commonly into a navigation-rendered header.
|
|
10
|
+
*/
|
|
11
|
+
children: HeaderRenderChildren;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Reads the current HeaderMotion context and exposes it through a render
|
|
15
|
+
* function so it can be forwarded into another subtree.
|
|
16
|
+
*/
|
|
17
|
+
export declare function Bridge({ children }: HeaderMotionBridgeProps): ReactNode;
|
|
18
|
+
export {};
|
|
19
|
+
//# sourceMappingURL=Bridge.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Bridge.d.ts","sourceRoot":"","sources":["../../../../src/components/Bridge.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,UAAU,CAAC;AAExD,KAAK,oBAAoB,GAAG,CAAC,KAAK,EAAE,uBAAuB,KAAK,SAAS,CAAC;AAE1E,MAAM,WAAW,uBAAuB;IACtC;;;;;OAKG;IACH,QAAQ,EAAE,oBAAoB,CAAC;CAChC;AAED;;;GAGG;AACH,wBAAgB,MAAM,CAAC,EAAE,QAAQ,EAAE,EAAE,uBAAuB,aAQ3D"}
|
|
@@ -1,17 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import Animated, { type
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
* Use this when you have multiple scroll views (e.g. in tabs) to track them separately.
|
|
7
|
-
*/
|
|
8
|
-
scrollId?: string;
|
|
9
|
-
/**
|
|
10
|
-
* Optional animated ref to use for the flat list.
|
|
11
|
-
* When provided, the scroll manager will use this ref instead of creating its own.
|
|
12
|
-
*/
|
|
13
|
-
animatedRef?: AnimatedRef<any>;
|
|
14
|
-
};
|
|
1
|
+
import type { ReactElement } from 'react';
|
|
2
|
+
import Animated, { type FlatListPropsWithLayout } from 'react-native-reanimated';
|
|
3
|
+
import { type HeaderMotionScrollableOwnProps } from './createHeaderMotionScrollable';
|
|
4
|
+
export type HeaderMotionFlatListProps<T = any> = FlatListPropsWithLayout<T> & HeaderMotionScrollableOwnProps<Animated.FlatList<T>>;
|
|
5
|
+
type FlatListComponent = <T = any>(props: HeaderMotionFlatListProps<T>) => ReactElement | null;
|
|
15
6
|
/**
|
|
16
7
|
* Animated FlatList component that integrates with HeaderMotion.
|
|
17
8
|
* Automatically handles scroll tracking and header animation synchronization.
|
|
@@ -29,5 +20,6 @@ export type HeaderMotionFlatListProps<T = any> = ComponentProps<typeof Animated.
|
|
|
29
20
|
* </HeaderMotion>
|
|
30
21
|
* ```
|
|
31
22
|
*/
|
|
32
|
-
export declare
|
|
23
|
+
export declare const FlatList: FlatListComponent;
|
|
24
|
+
export {};
|
|
33
25
|
//# sourceMappingURL=FlatList.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FlatList.d.ts","sourceRoot":"","sources":["../../../../src/components/FlatList.tsx"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"FlatList.d.ts","sourceRoot":"","sources":["../../../../src/components/FlatList.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AAC1C,OAAO,QAAQ,EAAE,EACf,KAAK,uBAAuB,EAC7B,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAEL,KAAK,8BAA8B,EACpC,MAAM,gCAAgC,CAAC;AAExC,MAAM,MAAM,yBAAyB,CAAC,CAAC,GAAG,GAAG,IAAI,uBAAuB,CAAC,CAAC,CAAC,GACzE,8BAA8B,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC;AAEvD,KAAK,iBAAiB,GAAG,CAAC,CAAC,GAAG,GAAG,EAC/B,KAAK,EAAE,yBAAyB,CAAC,CAAC,CAAC,KAChC,YAAY,GAAG,IAAI,CAAC;AAEzB;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,QAAQ,EAIf,iBAAiB,CAAC"}
|
|
@@ -1,19 +1,80 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import
|
|
3
|
-
type
|
|
4
|
-
|
|
1
|
+
import type { HeaderAsChildProps, HeaderDefaultProps, HeaderPanDecayConfig } from '../types';
|
|
2
|
+
import { HeaderDynamic } from './HeaderDynamic';
|
|
3
|
+
type HeaderPanProps = {
|
|
4
|
+
/** Enables dragging the header itself to scroll the active scrollable.
|
|
5
|
+
*
|
|
6
|
+
* This is useful when the header covers a large portion of the screen
|
|
7
|
+
* and you want the gesture to feel continuous between header and content.
|
|
8
|
+
*
|
|
9
|
+
* @default false
|
|
10
|
+
*/
|
|
11
|
+
pannable: true;
|
|
12
|
+
/**
|
|
13
|
+
* Customizes the momentum animation that runs after a header pan ends.
|
|
14
|
+
*
|
|
15
|
+
* Use an object for a fixed decay profile. Use a function when the decay
|
|
16
|
+
* should depend on the end event, for example to dampen or amplify
|
|
17
|
+
* certain velocities.
|
|
18
|
+
*
|
|
19
|
+
* If you provide a function, it runs inside the gesture end worklet and
|
|
20
|
+
* **must itself be marked with the 'worklet' directive.**
|
|
21
|
+
*/
|
|
22
|
+
panDecayConfig?: HeaderPanDecayConfig;
|
|
23
|
+
} | {
|
|
24
|
+
pannable?: false | undefined;
|
|
25
|
+
panDecayConfig?: never;
|
|
26
|
+
};
|
|
27
|
+
export type HeaderProps = (HeaderDefaultProps & HeaderPanProps & {
|
|
28
|
+
/**
|
|
29
|
+
* Applies the default absolute-positioned header layout.
|
|
30
|
+
*
|
|
31
|
+
* Leave this enabled for navigation headers and any header that should
|
|
32
|
+
* visually float above the scrollable content. Disable it only when you
|
|
33
|
+
* intentionally want the header to participate in normal layout flow.
|
|
34
|
+
*
|
|
35
|
+
* @default true
|
|
36
|
+
*/
|
|
37
|
+
overlay?: boolean;
|
|
5
38
|
/**
|
|
6
|
-
*
|
|
7
|
-
*
|
|
39
|
+
* Wraps the pan gesture in `GestureHandlerRootView`.
|
|
40
|
+
*
|
|
41
|
+
* Only use this when the rendered header subtree is not already under a
|
|
42
|
+
* gesture-handler root.
|
|
43
|
+
*
|
|
44
|
+
* @default false
|
|
8
45
|
*/
|
|
9
|
-
|
|
10
|
-
}
|
|
46
|
+
withGestureHandlerRootView?: boolean;
|
|
47
|
+
}) | (HeaderAsChildProps & HeaderPanProps & {
|
|
48
|
+
/**
|
|
49
|
+
* Wraps the pan gesture in `GestureHandlerRootView`.
|
|
50
|
+
*
|
|
51
|
+
* Only use this when the rendered header subtree is not already under a
|
|
52
|
+
* gesture-handler root.
|
|
53
|
+
*
|
|
54
|
+
* @default false
|
|
55
|
+
*/
|
|
56
|
+
withGestureHandlerRootView?: boolean;
|
|
57
|
+
});
|
|
58
|
+
declare function HeaderRoot(props: HeaderProps): import("react/jsx-runtime").JSX.Element;
|
|
11
59
|
/**
|
|
12
|
-
* Header
|
|
13
|
-
*
|
|
60
|
+
* Header container that measures the total header height for scroll offsetting.
|
|
61
|
+
*
|
|
62
|
+
* It renders an `Animated.View` by default, wires the outer header measurement
|
|
63
|
+
* automatically, and can optionally make the header surface pannable.
|
|
14
64
|
*
|
|
15
|
-
*
|
|
65
|
+
* Pair it with `Header.Dynamic` to mark the part of the header that should
|
|
66
|
+
* drive the collapse threshold.
|
|
16
67
|
*/
|
|
17
|
-
export declare
|
|
68
|
+
export declare const Header: typeof HeaderRoot & {
|
|
69
|
+
/**
|
|
70
|
+
* Marks the part of the header whose measured layout should define the
|
|
71
|
+
* collapsible distance.
|
|
72
|
+
*
|
|
73
|
+
* In most designs, this is the section that visually disappears while the
|
|
74
|
+
* header collapses. Its measured value feeds `measureDynamic`, which can in
|
|
75
|
+
* turn drive `progressThreshold`.
|
|
76
|
+
*/
|
|
77
|
+
Dynamic: typeof HeaderDynamic;
|
|
78
|
+
};
|
|
18
79
|
export {};
|
|
19
80
|
//# sourceMappingURL=Header.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Header.d.ts","sourceRoot":"","sources":["../../../../src/components/Header.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Header.d.ts","sourceRoot":"","sources":["../../../../src/components/Header.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,kBAAkB,EAClB,kBAAkB,EAClB,oBAAoB,EACrB,MAAM,UAAU,CAAC;AAMlB,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAGhD,KAAK,cAAc,GACf;IACE;;;;;;OAMG;IACH,QAAQ,EAAE,IAAI,CAAC;IACf;;;;;;;;;OASG;IACH,cAAc,CAAC,EAAE,oBAAoB,CAAC;CACvC,GACD;IACE,QAAQ,CAAC,EAAE,KAAK,GAAG,SAAS,CAAC;IAC7B,cAAc,CAAC,EAAE,KAAK,CAAC;CACxB,CAAC;AAEN,MAAM,MAAM,WAAW,GACnB,CAAC,kBAAkB,GACjB,cAAc,GAAG;IACf;;;;;;;;OAQG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;;;;;;OAOG;IACH,0BAA0B,CAAC,EAAE,OAAO,CAAC;CACtC,CAAC,GACJ,CAAC,kBAAkB,GACjB,cAAc,GAAG;IACf;;;;;;;OAOG;IACH,0BAA0B,CAAC,EAAE,OAAO,CAAC;CACtC,CAAC,CAAC;AAWT,iBAAS,UAAU,CAAC,KAAK,EAAE,WAAW,2CAwDrC;AAED;;;;;;;;GAQG;AACH,eAAO,MAAM,MAAM;IACjB;;;;;;;OAOG;;CAEH,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { HeaderDynamicProps } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* Marks the part of the header whose layout should define the collapsible
|
|
4
|
+
* distance.
|
|
5
|
+
*
|
|
6
|
+
* In most designs, this is the section that visually disappears while the
|
|
7
|
+
* header collapses. Its measured value feeds `measureDynamic`, which in turn
|
|
8
|
+
* can drive `progressThreshold`.
|
|
9
|
+
*/
|
|
10
|
+
export declare function HeaderDynamic(props: HeaderDynamicProps): import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
//# sourceMappingURL=HeaderDynamic.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"HeaderDynamic.d.ts","sourceRoot":"","sources":["../../../../src/components/HeaderDynamic.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAOnD;;;;;;;GAOG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,kBAAkB,2CA0BtD"}
|
|
@@ -3,48 +3,67 @@ import type { ReactNode } from 'react';
|
|
|
3
3
|
import type { MeasureAnimatedHeader, ProgressThreshold } from '../types';
|
|
4
4
|
export interface HeaderMotionProps<T extends string> {
|
|
5
5
|
/**
|
|
6
|
-
*
|
|
7
|
-
*
|
|
6
|
+
* Distance that maps the active scrollable from `progress = 0`
|
|
7
|
+
* to `progress = 1`.
|
|
8
8
|
*
|
|
9
|
-
*
|
|
9
|
+
* Use a number when the collapse distance is fixed. Use a function when the
|
|
10
|
+
* distance should depend on what `measureDynamic` reads from
|
|
11
|
+
* `HeaderMotion.Header.Dynamic`.
|
|
12
|
+
*
|
|
13
|
+
* A common pattern is to measure the height of the part of the header that
|
|
14
|
+
* should disappear and use that as the threshold.
|
|
10
15
|
*/
|
|
11
16
|
progressThreshold?: ProgressThreshold;
|
|
12
17
|
/**
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
* Receives the layout change event from React Native.
|
|
18
|
+
* Reads the value that should define the "collapsible" part of the header.
|
|
16
19
|
*
|
|
17
|
-
* This
|
|
20
|
+
* This is called from `HeaderMotion.Header.Dynamic` on layout. The returned
|
|
21
|
+
* number feeds `progressThreshold` when you provide that prop as a function.
|
|
18
22
|
*
|
|
19
|
-
*
|
|
23
|
+
* By default, the library measures the dynamic section's height. Override
|
|
24
|
+
* this when the collapse distance should be based on something else, for
|
|
25
|
+
* example width or a derived value from the layout event.
|
|
20
26
|
*/
|
|
21
27
|
measureDynamic?: MeasureAnimatedHeader;
|
|
22
28
|
/**
|
|
23
|
-
*
|
|
29
|
+
* Controls when `measureDynamic` is allowed to update.
|
|
30
|
+
*
|
|
24
31
|
* - 'mount': Only measure once on mount
|
|
25
|
-
* - 'update':
|
|
32
|
+
* - 'update': Re-measure whenever `HeaderMotion.Header.Dynamic` lays out again
|
|
33
|
+
*
|
|
34
|
+
* Use `'mount'` for stable headers. Use `'update'` when the dynamic section
|
|
35
|
+
* can change size after mount, for example after async data loads or content
|
|
36
|
+
* expansion.
|
|
37
|
+
*
|
|
26
38
|
* @default 'mount'
|
|
27
39
|
*/
|
|
28
40
|
measureDynamicMode?: 'update' | 'mount';
|
|
29
41
|
/**
|
|
30
|
-
* Shared value
|
|
31
|
-
*
|
|
42
|
+
* Shared value that tells HeaderMotion which scrollable currently owns the
|
|
43
|
+
* header progress in multi-scroll setups.
|
|
44
|
+
*
|
|
45
|
+
* Pass this when one header is shared across multiple scrollables, such as
|
|
46
|
+
* tabs or pager pages. Each scrollable should also get its own `scrollId`.
|
|
32
47
|
*/
|
|
33
48
|
activeScrollId?: SharedValue<T>;
|
|
34
49
|
/**
|
|
35
|
-
*
|
|
36
|
-
*
|
|
50
|
+
* Controls how `progress` behaves outside the `[0, threshold]` range.
|
|
51
|
+
*
|
|
52
|
+
* The default clamps the value between `0` and `1`. Relax this if you want
|
|
53
|
+
* to animate overscroll or other out-of-range states.
|
|
37
54
|
*
|
|
38
|
-
* You may want to modify it to achieve some animations for the overscroll scenarios.
|
|
39
55
|
* @default Extrapolation.CLAMP
|
|
40
56
|
*/
|
|
41
57
|
progressExtrapolation?: ExtrapolationType;
|
|
42
|
-
/**
|
|
58
|
+
/** Descendants that should participate in the shared header-motion state. */
|
|
43
59
|
children: ReactNode;
|
|
44
60
|
}
|
|
45
61
|
/**
|
|
46
|
-
*
|
|
47
|
-
*
|
|
62
|
+
* Root provider for a header-motion setup.
|
|
63
|
+
*
|
|
64
|
+
* It tracks the measured header layout, the active scroll position, and the
|
|
65
|
+
* derived `progress` shared value consumed by your animated header UI.
|
|
66
|
+
*
|
|
48
67
|
* @template T - The type of scroll ID string
|
|
49
68
|
*/
|
|
50
69
|
declare function HeaderMotionContextProvider<T extends string>({ progressThreshold, measureDynamic, measureDynamicMode, activeScrollId, progressExtrapolation, children, }: HeaderMotionProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HeaderMotion.d.ts","sourceRoot":"","sources":["../../../../src/components/HeaderMotion.tsx"],"names":[],"mappings":"AACA,OAAO,EAML,KAAK,iBAAiB,EACtB,KAAK,WAAW,EACjB,MAAM,yBAAyB,CAAC;AAEjC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"HeaderMotion.d.ts","sourceRoot":"","sources":["../../../../src/components/HeaderMotion.tsx"],"names":[],"mappings":"AACA,OAAO,EAML,KAAK,iBAAiB,EACtB,KAAK,WAAW,EACjB,MAAM,yBAAyB,CAAC;AAEjC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,KAAK,EAEV,qBAAqB,EAErB,iBAAiB,EAElB,MAAM,UAAU,CAAC;AAkClB,MAAM,WAAW,iBAAiB,CAAC,CAAC,SAAS,MAAM;IACjD;;;;;;;;;;OAUG;IACH,iBAAiB,CAAC,EAAE,iBAAiB,CAAC;IACtC;;;;;;;;;OASG;IACH,cAAc,CAAC,EAAE,qBAAqB,CAAC;IACvC;;;;;;;;;;;OAWG;IACH,kBAAkB,CAAC,EAAE,QAAQ,GAAG,OAAO,CAAC;IACxC;;;;;;OAMG;IACH,cAAc,CAAC,EAAE,WAAW,CAAC,CAAC,CAAC,CAAC;IAChC;;;;;;;OAOG;IACH,qBAAqB,CAAC,EAAE,iBAAiB,CAAC;IAC1C,6EAA6E;IAC7E,QAAQ,EAAE,SAAS,CAAC;CACrB;AAED;;;;;;;GAOG;AACH,iBAAS,2BAA2B,CAAC,CAAC,SAAS,MAAM,EAAE,EACrD,iBAA8C,EAC9C,cAAwC,EACxC,kBAA4B,EAC5B,cAAc,EACd,qBAA2C,EAC3C,QAAQ,GACT,EAAE,iBAAiB,CAAC,CAAC,CAAC,2CAgItB;AAED,OAAO,EAAE,2BAA2B,EAAE,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { type ReactElement } from 'react';
|
|
2
|
+
import type { HeaderPanDecayConfig, HeaderMotionBridgeValue } from '../types';
|
|
3
|
+
type HeaderPanBoundaryProps = Pick<HeaderMotionBridgeValue, 'scrollToRef' | 'headerPanMomentumOffset'> & {
|
|
4
|
+
children: ReactElement;
|
|
5
|
+
pannable?: boolean;
|
|
6
|
+
panDecayConfig?: HeaderPanDecayConfig;
|
|
7
|
+
withGestureHandlerRootView?: boolean;
|
|
8
|
+
};
|
|
9
|
+
export declare function HeaderPanBoundary({ children, pannable, panDecayConfig, scrollToRef, headerPanMomentumOffset, withGestureHandlerRootView, }: HeaderPanBoundaryProps): import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
export {};
|
|
11
|
+
//# sourceMappingURL=HeaderPanBoundary.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"HeaderPanBoundary.d.ts","sourceRoot":"","sources":["../../../../src/components/HeaderPanBoundary.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAW,KAAK,YAAY,EAAE,MAAM,OAAO,CAAC;AAQnD,OAAO,KAAK,EACV,oBAAoB,EAEpB,uBAAuB,EACxB,MAAM,UAAU,CAAC;AAOlB,KAAK,sBAAsB,GAAG,IAAI,CAChC,uBAAuB,EACvB,aAAa,GAAG,yBAAyB,CAC1C,GAAG;IACF,QAAQ,EAAE,YAAY,CAAC;IACvB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,cAAc,CAAC,EAAE,oBAAoB,CAAC;IACtC,0BAA0B,CAAC,EAAE,OAAO,CAAC;CACtC,CAAC;AAEF,wBAAgB,iBAAiB,CAAC,EAChC,QAAQ,EACR,QAAgB,EAChB,cAAc,EACd,WAAW,EACX,uBAAuB,EACvB,0BAAkC,GACnC,EAAE,sBAAsB,2CAsCxB"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
import type { HeaderMotionBridgeValue } from '../types';
|
|
3
|
+
export interface HeaderMotionNavigationBridgeProps {
|
|
4
|
+
/**
|
|
5
|
+
* Previously captured HeaderMotion context value to re-provide in another
|
|
6
|
+
* subtree.
|
|
7
|
+
*/
|
|
8
|
+
value: HeaderMotionBridgeValue;
|
|
9
|
+
/** Subtree that should regain access to HeaderMotion context. */
|
|
10
|
+
children: ReactNode;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Re-provides HeaderMotion context in a different part of the React tree.
|
|
14
|
+
*
|
|
15
|
+
* This is primarily useful for navigation libraries that render headers outside
|
|
16
|
+
* the screen subtree where `HeaderMotion` itself lives.
|
|
17
|
+
*/
|
|
18
|
+
export declare function NavigationBridge({ value, children, }: HeaderMotionNavigationBridgeProps): import("react/jsx-runtime").JSX.Element;
|
|
19
|
+
//# sourceMappingURL=NavigationBridge.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NavigationBridge.d.ts","sourceRoot":"","sources":["../../../../src/components/NavigationBridge.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,UAAU,CAAC;AAExD,MAAM,WAAW,iCAAiC;IAChD;;;OAGG;IACH,KAAK,EAAE,uBAAuB,CAAC;IAC/B,iEAAiE;IACjE,QAAQ,EAAE,SAAS,CAAC;CACrB;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,EAC/B,KAAK,EACL,QAAQ,GACT,EAAE,iCAAiC,2CAMnC"}
|
|
@@ -1,37 +1,30 @@
|
|
|
1
|
+
import { type UseScrollManagerOptions } from '../hooks';
|
|
1
2
|
import type { ScrollManagerConfig } from '../types';
|
|
2
|
-
import type { ResolveRefreshControlOptions } from '../hooks/refreshControl';
|
|
3
3
|
import type { ReactNode } from 'react';
|
|
4
|
-
import type {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
export interface HeaderMotionScrollManagerProps extends Omit<ResolveRefreshControlOptions, 'progressViewOffset'>, ConsumerScrollEventHandlers {
|
|
4
|
+
import type { InstanceOrElement } from 'react-native-reanimated/lib/typescript/commonTypes';
|
|
5
|
+
type ScrollManagerRenderChildren<TRef extends InstanceOrElement = any> = (scrollableProps: ScrollManagerConfig<TRef>['scrollableProps'], options: ScrollManagerConfig<TRef>['headerMotionContext']) => ReactNode;
|
|
6
|
+
export interface HeaderMotionScrollManagerProps<TRef extends InstanceOrElement = any> extends UseScrollManagerOptions<TRef> {
|
|
8
7
|
/**
|
|
9
|
-
*
|
|
10
|
-
*
|
|
8
|
+
* Unique identifier for this scrollable in multi-scroll setups.
|
|
9
|
+
*
|
|
10
|
+
* Omit it for single-scroll screens.
|
|
11
11
|
*/
|
|
12
12
|
scrollId?: string;
|
|
13
13
|
/**
|
|
14
|
-
*
|
|
15
|
-
*
|
|
14
|
+
* Render function that receives:
|
|
15
|
+
* - the props to spread onto your scrollable
|
|
16
|
+
* - the layout values needed to offset content below the header
|
|
16
17
|
*/
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* Optional refresh progress offset override.
|
|
20
|
-
* When provided, it takes precedence over the automatic offset based on header height.
|
|
21
|
-
*/
|
|
22
|
-
progressViewOffset?: ResolveRefreshControlOptions['progressViewOffset'];
|
|
23
|
-
/**
|
|
24
|
-
* Render function that receives scroll props and header context.
|
|
25
|
-
* Use this to create custom scroll implementations that integrate with HeaderMotion.
|
|
26
|
-
*/
|
|
27
|
-
children: ScrollManagerRenderChildren;
|
|
18
|
+
children: ScrollManagerRenderChildren<TRef>;
|
|
28
19
|
}
|
|
29
20
|
/**
|
|
30
|
-
*
|
|
31
|
-
*
|
|
21
|
+
* Render-prop wrapper around `useScrollManager()`.
|
|
22
|
+
*
|
|
23
|
+
* **Most code should prefer `createHeaderMotionScrollable()` instead.**
|
|
32
24
|
*
|
|
33
|
-
*
|
|
34
|
-
*
|
|
25
|
+
* Use `ScrollManager` only when the factory approach is not enough and you
|
|
26
|
+
* still need HeaderMotion to manage a custom scrollable through render-prop
|
|
27
|
+
* composition.
|
|
35
28
|
*
|
|
36
29
|
* @example
|
|
37
30
|
* ```tsx
|
|
@@ -48,6 +41,6 @@ export interface HeaderMotionScrollManagerProps extends Omit<ResolveRefreshContr
|
|
|
48
41
|
* </HeaderMotion>
|
|
49
42
|
* ```
|
|
50
43
|
*/
|
|
51
|
-
export declare function
|
|
44
|
+
export declare function ScrollManager<TRef extends InstanceOrElement = any>({ children, scrollId, animatedRef, refreshControl, refreshing, onRefresh, progressViewOffset, onScroll, onScrollBeginDrag, onScrollEndDrag, onMomentumScrollBegin, onMomentumScrollEnd, }: HeaderMotionScrollManagerProps<TRef>): ReactNode;
|
|
52
45
|
export {};
|
|
53
46
|
//# sourceMappingURL=ScrollManager.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ScrollManager.d.ts","sourceRoot":"","sources":["../../../../src/components/ScrollManager.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ScrollManager.d.ts","sourceRoot":"","sources":["../../../../src/components/ScrollManager.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAoB,KAAK,uBAAuB,EAAE,MAAM,UAAU,CAAC;AAC1E,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AACpD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,oDAAoD,CAAC;AAE5F,KAAK,2BAA2B,CAAC,IAAI,SAAS,iBAAiB,GAAG,GAAG,IAAI,CACvE,eAAe,EAAE,mBAAmB,CAAC,IAAI,CAAC,CAAC,iBAAiB,CAAC,EAC7D,OAAO,EAAE,mBAAmB,CAAC,IAAI,CAAC,CAAC,qBAAqB,CAAC,KACtD,SAAS,CAAC;AAEf,MAAM,WAAW,8BAA8B,CAC7C,IAAI,SAAS,iBAAiB,GAAG,GAAG,CACpC,SAAQ,uBAAuB,CAAC,IAAI,CAAC;IACrC;;;;OAIG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;;OAIG;IACH,QAAQ,EAAE,2BAA2B,CAAC,IAAI,CAAC,CAAC;CAC7C;AAED;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,aAAa,CAAC,IAAI,SAAS,iBAAiB,GAAG,GAAG,EAAE,EAClE,QAAQ,EACR,QAAQ,EACR,WAAW,EACX,cAAc,EACd,UAAU,EACV,SAAS,EACT,kBAAkB,EAClB,QAAQ,EACR,iBAAiB,EACjB,eAAe,EACf,qBAAqB,EACrB,mBAAmB,GACpB,EAAE,8BAA8B,CAAC,IAAI,CAAC,aAwBtC"}
|
|
@@ -1,16 +1,8 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
*/
|
|
7
|
-
scrollId?: string;
|
|
8
|
-
/**
|
|
9
|
-
* Optional animated ref to use for the scroll view.
|
|
10
|
-
* When provided, the scroll manager will use this ref instead of creating its own.
|
|
11
|
-
*/
|
|
12
|
-
animatedRef?: AnimatedRef<any>;
|
|
13
|
-
};
|
|
1
|
+
import type { ReactElement } from 'react';
|
|
2
|
+
import Animated, { type AnimatedScrollViewProps } from 'react-native-reanimated';
|
|
3
|
+
import { type HeaderMotionScrollableOwnProps } from './createHeaderMotionScrollable';
|
|
4
|
+
export type HeaderMotionScrollViewProps = AnimatedScrollViewProps & HeaderMotionScrollableOwnProps<Animated.ScrollView>;
|
|
5
|
+
type HeaderMotionScrollViewComponent = (props: HeaderMotionScrollViewProps) => ReactElement | null;
|
|
14
6
|
/**
|
|
15
7
|
* Animated ScrollView component that integrates with HeaderMotion.
|
|
16
8
|
* Automatically handles scroll tracking and header animation synchronization.
|
|
@@ -25,5 +17,6 @@ export type HeaderMotionScrollViewProps = AnimatedScrollViewProps & {
|
|
|
25
17
|
* </HeaderMotion>
|
|
26
18
|
* ```
|
|
27
19
|
*/
|
|
28
|
-
export declare
|
|
20
|
+
export declare const ScrollView: HeaderMotionScrollViewComponent;
|
|
21
|
+
export {};
|
|
29
22
|
//# sourceMappingURL=ScrollView.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ScrollView.d.ts","sourceRoot":"","sources":["../../../../src/components/ScrollView.tsx"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"ScrollView.d.ts","sourceRoot":"","sources":["../../../../src/components/ScrollView.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AAC1C,OAAO,QAAQ,EAAE,EACf,KAAK,uBAAuB,EAC7B,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAEL,KAAK,8BAA8B,EACpC,MAAM,gCAAgC,CAAC;AAExC,MAAM,MAAM,2BAA2B,GAAG,uBAAuB,GAC/D,8BAA8B,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC;AAEtD,KAAK,+BAA+B,GAAG,CACrC,KAAK,EAAE,2BAA2B,KAC/B,YAAY,GAAG,IAAI,CAAC;AAEzB;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,UAAU,EAIjB,+BAA+B,CAAC"}
|