react-native-header-motion 0.2.0 → 1.0.0-alpha.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 +126 -18
- package/lib/module/components/FlatList.js +12 -2
- package/lib/module/components/FlatList.js.map +1 -1
- package/lib/module/components/HeaderBase.js +53 -5
- package/lib/module/components/HeaderBase.js.map +1 -1
- package/lib/module/components/HeaderMotion.js +66 -24
- package/lib/module/components/HeaderMotion.js.map +1 -1
- package/lib/module/components/ScrollManager.js +10 -2
- package/lib/module/components/ScrollManager.js.map +1 -1
- package/lib/module/components/ScrollView.js +8 -0
- package/lib/module/components/ScrollView.js.map +1 -1
- package/lib/module/context.js.map +1 -1
- package/lib/module/hooks/useMotionProgress.js +6 -2
- package/lib/module/hooks/useMotionProgress.js.map +1 -1
- package/lib/module/hooks/useScrollManager.js +91 -29
- package/lib/module/hooks/useScrollManager.js.map +1 -1
- package/lib/module/utils/index.js +1 -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/FlatList.d.ts +2 -4
- package/lib/typescript/src/components/FlatList.d.ts.map +1 -1
- package/lib/typescript/src/components/HeaderBase.d.ts +9 -2
- package/lib/typescript/src/components/HeaderBase.d.ts.map +1 -1
- package/lib/typescript/src/components/HeaderMotion.d.ts +5 -1
- package/lib/typescript/src/components/HeaderMotion.d.ts.map +1 -1
- package/lib/typescript/src/components/ScrollManager.d.ts +6 -10
- package/lib/typescript/src/components/ScrollManager.d.ts.map +1 -1
- package/lib/typescript/src/components/ScrollView.d.ts +3 -3
- package/lib/typescript/src/components/ScrollView.d.ts.map +1 -1
- package/lib/typescript/src/context.d.ts +7 -3
- package/lib/typescript/src/context.d.ts.map +1 -1
- package/lib/typescript/src/hooks/useMotionProgress.d.ts.map +1 -1
- package/lib/typescript/src/hooks/useScrollManager.d.ts +10 -3
- package/lib/typescript/src/hooks/useScrollManager.d.ts.map +1 -1
- package/lib/typescript/src/types.d.ts +20 -4
- package/lib/typescript/src/types.d.ts.map +1 -1
- package/lib/typescript/src/utils/index.d.ts +1 -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 +7 -5
- package/src/components/FlatList.tsx +23 -9
- package/src/components/HeaderBase.tsx +93 -4
- package/src/components/HeaderMotion.tsx +102 -26
- package/src/components/ScrollManager.tsx +27 -17
- package/src/components/ScrollView.tsx +17 -3
- package/src/context.ts +9 -2
- package/src/hooks/useMotionProgress.ts +10 -2
- package/src/hooks/useScrollManager.ts +127 -35
- package/src/types.ts +22 -4
- package/src/utils/index.ts +1 -0
- package/src/utils/refreshControl.tsx +118 -0
- package/src/utils/values.ts +57 -1
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { type AnimatedRef } from 'react-native-reanimated';
|
|
2
2
|
import type { ScrollManagerConfig } from '../types';
|
|
3
|
+
import { type ResolveRefreshControlOptions } from '../utils';
|
|
4
|
+
import type { InstanceOrElement } from 'react-native-reanimated/lib/typescript/commonTypes';
|
|
3
5
|
/**
|
|
4
6
|
* Hook that manages scroll tracking and synchronization for header animations.
|
|
5
7
|
* Returns props to apply to scrollable components and additional values that help with adjusting styling of the scrollables to header's dimensions.
|
|
@@ -37,12 +39,17 @@ import type { ScrollManagerConfig } from '../types';
|
|
|
37
39
|
* }
|
|
38
40
|
* ```
|
|
39
41
|
*/
|
|
40
|
-
export interface UseScrollManagerOptions {
|
|
42
|
+
export interface UseScrollManagerOptions<TRef extends InstanceOrElement = any> extends Omit<ResolveRefreshControlOptions, 'progressViewOffset'> {
|
|
41
43
|
/**
|
|
42
44
|
* Optional animated ref to use instead of creating one internally.
|
|
43
45
|
* Useful when you need access to the scroll view ref from outside.
|
|
44
46
|
*/
|
|
45
|
-
animatedRef?: AnimatedRef<
|
|
47
|
+
animatedRef?: AnimatedRef<TRef>;
|
|
48
|
+
/**
|
|
49
|
+
* Optional refresh progress offset override.
|
|
50
|
+
* When provided, it takes precedence over the automatic offset based on header height.
|
|
51
|
+
*/
|
|
52
|
+
progressViewOffset?: ResolveRefreshControlOptions['progressViewOffset'];
|
|
46
53
|
}
|
|
47
|
-
export declare function useScrollManager(scrollId?: string, options?: UseScrollManagerOptions): ScrollManagerConfig
|
|
54
|
+
export declare function useScrollManager<TRef extends InstanceOrElement = any>(scrollId?: string, options?: UseScrollManagerOptions<TRef>): ScrollManagerConfig<TRef>;
|
|
48
55
|
//# sourceMappingURL=useScrollManager.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useScrollManager.d.ts","sourceRoot":"","sources":["../../../../src/hooks/useScrollManager.ts"],"names":[],"mappings":"AACA,OAAO,
|
|
1
|
+
{"version":3,"file":"useScrollManager.d.ts","sourceRoot":"","sources":["../../../../src/hooks/useScrollManager.ts"],"names":[],"mappings":"AACA,OAAO,EAQL,KAAK,WAAW,EAEjB,MAAM,yBAAyB,CAAC;AAGjC,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AACpD,OAAO,EAKL,KAAK,4BAA4B,EAClC,MAAM,UAAU,CAAC;AAClB,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,oDAAoD,CAAC;AAQ5F;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AACH,MAAM,WAAW,uBAAuB,CAAC,IAAI,SAAS,iBAAiB,GAAG,GAAG,CAC3E,SAAQ,IAAI,CAAC,4BAA4B,EAAE,oBAAoB,CAAC;IAChE;;;OAGG;IACH,WAAW,CAAC,EAAE,WAAW,CAAC,IAAI,CAAC,CAAC;IAChC;;;OAGG;IACH,kBAAkB,CAAC,EAAE,4BAA4B,CAAC,oBAAoB,CAAC,CAAC;CACzE;AAED,wBAAgB,gBAAgB,CAAC,IAAI,SAAS,iBAAiB,GAAG,GAAG,EACnE,QAAQ,CAAC,EAAE,MAAM,EACjB,OAAO,CAAC,EAAE,uBAAuB,CAAC,IAAI,CAAC,GACtC,mBAAmB,CAAC,IAAI,CAAC,CAiN3B"}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
+
import type { ReactElement } from 'react';
|
|
1
2
|
import type { LayoutChangeEvent, ScrollViewProps } from 'react-native';
|
|
2
3
|
import type { AnimatedRef, SharedValue } from 'react-native-reanimated';
|
|
3
4
|
import { DEFAULT_SCROLL_ID } from './utils/defaults';
|
|
5
|
+
import type { InstanceOrElement } from 'react-native-reanimated/lib/typescript/commonTypes';
|
|
4
6
|
export type Progress = SharedValue<number>;
|
|
5
7
|
export type ProgressThreshold = number | ((measuredHeaderValue: number) => number);
|
|
6
8
|
export type MeasureAnimatedHeader = (e: LayoutChangeEvent) => number;
|
|
@@ -24,20 +26,34 @@ export type WithCollapsiblePagedHeaderProps<Tab extends string = string, T exten
|
|
|
24
26
|
};
|
|
25
27
|
export interface MotionProgress {
|
|
26
28
|
progress: Progress;
|
|
27
|
-
progressThreshold: number
|
|
29
|
+
progressThreshold: SharedValue<number>;
|
|
28
30
|
measureTotalHeight: MeasureAnimatedHeaderAndSet;
|
|
29
31
|
measureDynamic: MeasureAnimatedHeaderAndSet;
|
|
32
|
+
animatedHeaderBaseProps: AnimatedHeaderBaseMotionProps;
|
|
33
|
+
activeScrollId: SharedValue<string> | undefined;
|
|
34
|
+
}
|
|
35
|
+
export interface AnimatedHeaderBaseMotionProps {
|
|
36
|
+
enableHeaderPan: boolean;
|
|
37
|
+
scrollToRef: React.RefObject<ScrollTo | null>;
|
|
38
|
+
headerPanMomentumOffset: SharedValue<number | null>;
|
|
30
39
|
}
|
|
31
40
|
export interface ScrollManagerHeaderMotionContext {
|
|
32
|
-
originalHeaderHeight: number
|
|
41
|
+
originalHeaderHeight: SharedValue<number>;
|
|
33
42
|
minHeightContentContainerStyle: {} | {
|
|
34
43
|
minHeight: number;
|
|
35
44
|
};
|
|
36
45
|
}
|
|
37
|
-
export interface ScrollManagerConfig {
|
|
46
|
+
export interface ScrollManagerConfig<TRef extends InstanceOrElement = any> {
|
|
38
47
|
scrollableProps: Required<Pick<ScrollViewProps, 'onScroll' | 'scrollEventThrottle'>> & {
|
|
39
|
-
|
|
48
|
+
refreshControl?: ReactElement;
|
|
49
|
+
ref: AnimatedRef<TRef>;
|
|
40
50
|
};
|
|
41
51
|
headerMotionContext: ScrollManagerHeaderMotionContext;
|
|
42
52
|
}
|
|
53
|
+
export type ScrollTo = (y: number, options?: ScrollToOptions) => void;
|
|
54
|
+
interface ScrollToOptions {
|
|
55
|
+
isValueDelta?: boolean;
|
|
56
|
+
animated?: boolean;
|
|
57
|
+
}
|
|
58
|
+
export {};
|
|
43
59
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AACvE,OAAO,KAAK,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AACxE,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AAC1C,OAAO,KAAK,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AACvE,OAAO,KAAK,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AACxE,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,oDAAoD,CAAC;AAE5F,MAAM,MAAM,QAAQ,GAAG,WAAW,CAAC,MAAM,CAAC,CAAC;AAE3C,MAAM,MAAM,iBAAiB,GACzB,MAAM,GACN,CAAC,CAAC,mBAAmB,EAAE,MAAM,KAAK,MAAM,CAAC,CAAC;AAC9C,MAAM,MAAM,qBAAqB,GAAG,CAAC,CAAC,EAAE,iBAAiB,KAAK,MAAM,CAAC;AACrE,MAAM,MAAM,2BAA2B,GAAG,CAAC,CAAC,EAAE,iBAAiB,KAAK,IAAI,CAAC;AAEzE,MAAM,MAAM,oBAAoB,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM,IAAI;IAC5D,KAAK,EAAE,CAAC,CAAC;IACT,EAAE,EAAE,WAAW,CAAC,CAAC,CAAC,CAAC;CACpB,CAAC;AACF,MAAM,MAAM,iBAAiB,CAAC,CAAC,SAAS,MAAM,IAAI,CAAC,KAAK,EAAE,CAAC,KAAK,IAAI,CAAC;AAErE,MAAM,WAAW,WAAW;IAC1B,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,EAAE,MAAM,CAAC;CACjB;AACD,MAAM,MAAM,YAAY,GAAG,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,GAAG;KACtD,GAAG,IAAI,OAAO,iBAAiB,CAAC,CAAC,EAAE,WAAW;CAChD,CAAC;AAEF,MAAM,MAAM,0BAA0B,CACpC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,IACzD,CAAC,GAAG,cAAc,CAAC;AAEvB,MAAM,MAAM,+BAA+B,CACzC,GAAG,SAAS,MAAM,GAAG,MAAM,EAC3B,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,IACzD,0BAA0B,CAAC,CAAC,CAAC,GAAG;IAClC,WAAW,EAAE,CAAC,MAAM,EAAE,GAAG,KAAK,IAAI,CAAC;IACnC,SAAS,EAAE,GAAG,CAAC;CAChB,CAAC;AAEF,MAAM,WAAW,cAAc;IAC7B,QAAQ,EAAE,QAAQ,CAAC;IACnB,iBAAiB,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IACvC,kBAAkB,EAAE,2BAA2B,CAAC;IAChD,cAAc,EAAE,2BAA2B,CAAC;IAC5C,uBAAuB,EAAE,6BAA6B,CAAC;IACvD,cAAc,EAAE,WAAW,CAAC,MAAM,CAAC,GAAG,SAAS,CAAC;CACjD;AAED,MAAM,WAAW,6BAA6B;IAC5C,eAAe,EAAE,OAAO,CAAC;IACzB,WAAW,EAAE,KAAK,CAAC,SAAS,CAAC,QAAQ,GAAG,IAAI,CAAC,CAAC;IAC9C,uBAAuB,EAAE,WAAW,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;CACrD;AAED,MAAM,WAAW,gCAAgC;IAC/C,oBAAoB,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IAC1C,8BAA8B,EAC1B,EAAE,GACF;QACE,SAAS,EAAE,MAAM,CAAC;KACnB,CAAC;CACP;AAED,MAAM,WAAW,mBAAmB,CAAC,IAAI,SAAS,iBAAiB,GAAG,GAAG;IACvE,eAAe,EAAE,QAAQ,CACvB,IAAI,CAAC,eAAe,EAAE,UAAU,GAAG,qBAAqB,CAAC,CAC1D,GAAG;QACF,cAAc,CAAC,EAAE,YAAY,CAAC;QAC9B,GAAG,EAAE,WAAW,CAAC,IAAI,CAAC,CAAC;KACxB,CAAC;IACF,mBAAmB,EAAE,gCAAgC,CAAC;CACvD;AAED,MAAM,MAAM,QAAQ,GAAG,CAAC,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,eAAe,KAAK,IAAI,CAAC;AAEtE,UAAU,eAAe;IACvB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,UAAU,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,UAAU,CAAC;AACzB,cAAc,kBAAkB,CAAC"}
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
import { type ReactElement } from 'react';
|
|
2
|
+
import { RefreshControl, type RefreshControlProps } from 'react-native';
|
|
3
|
+
import type { SharedValue } from 'react-native-reanimated';
|
|
4
|
+
declare const AnimatedRefreshControl: import("react-native-reanimated/lib/typescript/createAnimatedComponent").AnimatedComponentType<Readonly<Readonly<Omit<Readonly<Omit<Readonly<{
|
|
5
|
+
onAccessibilityAction?: ((event: import("react-native").AccessibilityActionEvent) => unknown) | undefined;
|
|
6
|
+
onAccessibilityTap?: (() => unknown) | undefined;
|
|
7
|
+
onLayout?: ((event: import("react-native").LayoutChangeEvent) => unknown) | undefined;
|
|
8
|
+
onMagicTap?: (() => unknown) | undefined;
|
|
9
|
+
onAccessibilityEscape?: (() => unknown) | undefined;
|
|
10
|
+
}>, "style" | "onMoveShouldSetResponder" | "onMoveShouldSetResponderCapture" | "onResponderGrant" | "onResponderMove" | "onResponderReject" | "onResponderRelease" | "onResponderStart" | "onResponderEnd" | "onResponderTerminate" | "onResponderTerminationRequest" | "onStartShouldSetResponder" | "onStartShouldSetResponderCapture" | "onMouseEnter" | "onMouseLeave" | "onClick" | "onClickCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onBlur" | "onBlurCapture" | "onFocus" | "onFocusCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "nativeBackgroundAndroid" | "nativeForegroundAndroid" | "renderToHardwareTextureAndroid" | "hasTVPreferredFocus" | "nextFocusDown" | "nextFocusForward" | "nextFocusLeft" | "nextFocusRight" | "nextFocusUp" | "focusable" | "tabIndex" | "shouldRasterizeIOS" | "accessibilityIgnoresInvertColors" | "accessibilityViewIsModal" | "accessibilityShowsLargeContentViewer" | "accessibilityLargeContentTitle" | "aria-modal" | "accessibilityElementsHidden" | "accessibilityLanguage" | "accessibilityRespondsToUserInteraction" | "accessible" | "accessibilityLabel" | "accessibilityHint" | "aria-label" | "accessibilityRole" | "role" | "accessibilityState" | "accessibilityValue" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "accessibilityActions" | "aria-busy" | "aria-checked" | "aria-disabled" | "aria-expanded" | "aria-selected" | "aria-hidden" | "accessibilityLabelledBy" | "aria-labelledby" | "accessibilityLiveRegion" | "aria-live" | "importantForAccessibility" | "screenReaderFocusable" | "children" | "collapsable" | "collapsableChildren" | "id" | "testID" | "nativeID" | "needsOffscreenAlphaCompositing" | "hitSlop" | "pointerEvents" | "removeClippedSubviews" | "experimental_accessibilityOrder"> & Omit<Readonly<{
|
|
11
|
+
onMoveShouldSetResponder?: ((e: import("react-native").GestureResponderEvent) => boolean) | undefined;
|
|
12
|
+
onMoveShouldSetResponderCapture?: ((e: import("react-native").GestureResponderEvent) => boolean) | undefined;
|
|
13
|
+
onResponderGrant?: ((e: import("react-native").GestureResponderEvent) => void | boolean) | undefined;
|
|
14
|
+
onResponderMove?: ((e: import("react-native").GestureResponderEvent) => void) | undefined;
|
|
15
|
+
onResponderReject?: ((e: import("react-native").GestureResponderEvent) => void) | undefined;
|
|
16
|
+
onResponderRelease?: ((e: import("react-native").GestureResponderEvent) => void) | undefined;
|
|
17
|
+
onResponderStart?: ((e: import("react-native").GestureResponderEvent) => void) | undefined;
|
|
18
|
+
onResponderEnd?: ((e: import("react-native").GestureResponderEvent) => void) | undefined;
|
|
19
|
+
onResponderTerminate?: ((e: import("react-native").GestureResponderEvent) => void) | undefined;
|
|
20
|
+
onResponderTerminationRequest?: ((e: import("react-native").GestureResponderEvent) => boolean) | undefined;
|
|
21
|
+
onStartShouldSetResponder?: ((e: import("react-native").GestureResponderEvent) => boolean) | undefined;
|
|
22
|
+
onStartShouldSetResponderCapture?: ((e: import("react-native").GestureResponderEvent) => boolean) | undefined;
|
|
23
|
+
}>, "style" | "onMouseEnter" | "onMouseLeave" | "onClick" | "onClickCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onBlur" | "onBlurCapture" | "onFocus" | "onFocusCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "nativeBackgroundAndroid" | "nativeForegroundAndroid" | "renderToHardwareTextureAndroid" | "hasTVPreferredFocus" | "nextFocusDown" | "nextFocusForward" | "nextFocusLeft" | "nextFocusRight" | "nextFocusUp" | "focusable" | "tabIndex" | "shouldRasterizeIOS" | "accessibilityIgnoresInvertColors" | "accessibilityViewIsModal" | "accessibilityShowsLargeContentViewer" | "accessibilityLargeContentTitle" | "aria-modal" | "accessibilityElementsHidden" | "accessibilityLanguage" | "accessibilityRespondsToUserInteraction" | "accessible" | "accessibilityLabel" | "accessibilityHint" | "aria-label" | "accessibilityRole" | "role" | "accessibilityState" | "accessibilityValue" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "accessibilityActions" | "aria-busy" | "aria-checked" | "aria-disabled" | "aria-expanded" | "aria-selected" | "aria-hidden" | "accessibilityLabelledBy" | "aria-labelledby" | "accessibilityLiveRegion" | "aria-live" | "importantForAccessibility" | "screenReaderFocusable" | "children" | "collapsable" | "collapsableChildren" | "id" | "testID" | "nativeID" | "needsOffscreenAlphaCompositing" | "hitSlop" | "pointerEvents" | "removeClippedSubviews" | "experimental_accessibilityOrder"> & Omit<Readonly<{
|
|
24
|
+
onMouseEnter?: ((event: import("react-native").MouseEvent) => void) | undefined;
|
|
25
|
+
onMouseLeave?: ((event: import("react-native").MouseEvent) => void) | undefined;
|
|
26
|
+
}>, "style" | "onClick" | "onClickCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onBlur" | "onBlurCapture" | "onFocus" | "onFocusCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "nativeBackgroundAndroid" | "nativeForegroundAndroid" | "renderToHardwareTextureAndroid" | "hasTVPreferredFocus" | "nextFocusDown" | "nextFocusForward" | "nextFocusLeft" | "nextFocusRight" | "nextFocusUp" | "focusable" | "tabIndex" | "shouldRasterizeIOS" | "accessibilityIgnoresInvertColors" | "accessibilityViewIsModal" | "accessibilityShowsLargeContentViewer" | "accessibilityLargeContentTitle" | "aria-modal" | "accessibilityElementsHidden" | "accessibilityLanguage" | "accessibilityRespondsToUserInteraction" | "accessible" | "accessibilityLabel" | "accessibilityHint" | "aria-label" | "accessibilityRole" | "role" | "accessibilityState" | "accessibilityValue" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "accessibilityActions" | "aria-busy" | "aria-checked" | "aria-disabled" | "aria-expanded" | "aria-selected" | "aria-hidden" | "accessibilityLabelledBy" | "aria-labelledby" | "accessibilityLiveRegion" | "aria-live" | "importantForAccessibility" | "screenReaderFocusable" | "children" | "collapsable" | "collapsableChildren" | "id" | "testID" | "nativeID" | "needsOffscreenAlphaCompositing" | "hitSlop" | "pointerEvents" | "removeClippedSubviews" | "experimental_accessibilityOrder"> & Omit<Readonly<{
|
|
27
|
+
onClick?: ((event: import("react-native").PointerEvent) => void) | undefined;
|
|
28
|
+
onClickCapture?: ((event: import("react-native").PointerEvent) => void) | undefined;
|
|
29
|
+
onPointerEnter?: ((event: import("react-native").PointerEvent) => void) | undefined;
|
|
30
|
+
onPointerEnterCapture?: ((event: import("react-native").PointerEvent) => void) | undefined;
|
|
31
|
+
onPointerLeave?: ((event: import("react-native").PointerEvent) => void) | undefined;
|
|
32
|
+
onPointerLeaveCapture?: ((event: import("react-native").PointerEvent) => void) | undefined;
|
|
33
|
+
onPointerMove?: ((event: import("react-native").PointerEvent) => void) | undefined;
|
|
34
|
+
onPointerMoveCapture?: ((event: import("react-native").PointerEvent) => void) | undefined;
|
|
35
|
+
onPointerCancel?: ((e: import("react-native").PointerEvent) => void) | undefined;
|
|
36
|
+
onPointerCancelCapture?: ((e: import("react-native").PointerEvent) => void) | undefined;
|
|
37
|
+
onPointerDown?: ((e: import("react-native").PointerEvent) => void) | undefined;
|
|
38
|
+
onPointerDownCapture?: ((e: import("react-native").PointerEvent) => void) | undefined;
|
|
39
|
+
onPointerUp?: ((e: import("react-native").PointerEvent) => void) | undefined;
|
|
40
|
+
onPointerUpCapture?: ((e: import("react-native").PointerEvent) => void) | undefined;
|
|
41
|
+
onPointerOver?: ((e: import("react-native").PointerEvent) => void) | undefined;
|
|
42
|
+
onPointerOverCapture?: ((e: import("react-native").PointerEvent) => void) | undefined;
|
|
43
|
+
onPointerOut?: ((e: import("react-native").PointerEvent) => void) | undefined;
|
|
44
|
+
onPointerOutCapture?: ((e: import("react-native").PointerEvent) => void) | undefined;
|
|
45
|
+
onGotPointerCapture?: ((e: import("react-native").PointerEvent) => void) | undefined;
|
|
46
|
+
onGotPointerCaptureCapture?: ((e: import("react-native").PointerEvent) => void) | undefined;
|
|
47
|
+
onLostPointerCapture?: ((e: import("react-native").PointerEvent) => void) | undefined;
|
|
48
|
+
onLostPointerCaptureCapture?: ((e: import("react-native").PointerEvent) => void) | undefined;
|
|
49
|
+
}>, "style" | "onClick" | "onBlur" | "onBlurCapture" | "onFocus" | "onFocusCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "nativeBackgroundAndroid" | "nativeForegroundAndroid" | "renderToHardwareTextureAndroid" | "hasTVPreferredFocus" | "nextFocusDown" | "nextFocusForward" | "nextFocusLeft" | "nextFocusRight" | "nextFocusUp" | "focusable" | "tabIndex" | "shouldRasterizeIOS" | "accessibilityIgnoresInvertColors" | "accessibilityViewIsModal" | "accessibilityShowsLargeContentViewer" | "accessibilityLargeContentTitle" | "aria-modal" | "accessibilityElementsHidden" | "accessibilityLanguage" | "accessibilityRespondsToUserInteraction" | "accessible" | "accessibilityLabel" | "accessibilityHint" | "aria-label" | "accessibilityRole" | "role" | "accessibilityState" | "accessibilityValue" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "accessibilityActions" | "aria-busy" | "aria-checked" | "aria-disabled" | "aria-expanded" | "aria-selected" | "aria-hidden" | "accessibilityLabelledBy" | "aria-labelledby" | "accessibilityLiveRegion" | "aria-live" | "importantForAccessibility" | "screenReaderFocusable" | "children" | "collapsable" | "collapsableChildren" | "id" | "testID" | "nativeID" | "needsOffscreenAlphaCompositing" | "hitSlop" | "pointerEvents" | "removeClippedSubviews" | "experimental_accessibilityOrder"> & Omit<Readonly<{
|
|
50
|
+
onBlur?: ((event: import("react-native").BlurEvent) => void) | undefined;
|
|
51
|
+
onBlurCapture?: ((event: import("react-native").BlurEvent) => void) | undefined;
|
|
52
|
+
onFocus?: ((event: import("react-native").FocusEvent) => void) | undefined;
|
|
53
|
+
onFocusCapture?: ((event: import("react-native").FocusEvent) => void) | undefined;
|
|
54
|
+
}>, "style" | "onClick" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "nativeBackgroundAndroid" | "nativeForegroundAndroid" | "renderToHardwareTextureAndroid" | "hasTVPreferredFocus" | "nextFocusDown" | "nextFocusForward" | "nextFocusLeft" | "nextFocusRight" | "nextFocusUp" | "focusable" | "tabIndex" | "shouldRasterizeIOS" | "accessibilityIgnoresInvertColors" | "accessibilityViewIsModal" | "accessibilityShowsLargeContentViewer" | "accessibilityLargeContentTitle" | "aria-modal" | "accessibilityElementsHidden" | "accessibilityLanguage" | "accessibilityRespondsToUserInteraction" | "accessible" | "accessibilityLabel" | "accessibilityHint" | "aria-label" | "accessibilityRole" | "role" | "accessibilityState" | "accessibilityValue" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "accessibilityActions" | "aria-busy" | "aria-checked" | "aria-disabled" | "aria-expanded" | "aria-selected" | "aria-hidden" | "accessibilityLabelledBy" | "aria-labelledby" | "accessibilityLiveRegion" | "aria-live" | "importantForAccessibility" | "screenReaderFocusable" | "children" | "collapsable" | "collapsableChildren" | "id" | "testID" | "nativeID" | "needsOffscreenAlphaCompositing" | "hitSlop" | "pointerEvents" | "removeClippedSubviews" | "experimental_accessibilityOrder"> & Omit<Readonly<{
|
|
55
|
+
onTouchCancel?: ((e: import("react-native").GestureResponderEvent) => void) | undefined;
|
|
56
|
+
onTouchCancelCapture?: ((e: import("react-native").GestureResponderEvent) => void) | undefined;
|
|
57
|
+
onTouchEnd?: ((e: import("react-native").GestureResponderEvent) => void) | undefined;
|
|
58
|
+
onTouchEndCapture?: ((e: import("react-native").GestureResponderEvent) => void) | undefined;
|
|
59
|
+
onTouchMove?: ((e: import("react-native").GestureResponderEvent) => void) | undefined;
|
|
60
|
+
onTouchMoveCapture?: ((e: import("react-native").GestureResponderEvent) => void) | undefined;
|
|
61
|
+
onTouchStart?: ((e: import("react-native").GestureResponderEvent) => void) | undefined;
|
|
62
|
+
onTouchStartCapture?: ((e: import("react-native").GestureResponderEvent) => void) | undefined;
|
|
63
|
+
}>, "style" | "onClick" | "nativeBackgroundAndroid" | "nativeForegroundAndroid" | "renderToHardwareTextureAndroid" | "hasTVPreferredFocus" | "nextFocusDown" | "nextFocusForward" | "nextFocusLeft" | "nextFocusRight" | "nextFocusUp" | "focusable" | "tabIndex" | "shouldRasterizeIOS" | "accessibilityIgnoresInvertColors" | "accessibilityViewIsModal" | "accessibilityShowsLargeContentViewer" | "accessibilityLargeContentTitle" | "aria-modal" | "accessibilityElementsHidden" | "accessibilityLanguage" | "accessibilityRespondsToUserInteraction" | "accessible" | "accessibilityLabel" | "accessibilityHint" | "aria-label" | "accessibilityRole" | "role" | "accessibilityState" | "accessibilityValue" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "accessibilityActions" | "aria-busy" | "aria-checked" | "aria-disabled" | "aria-expanded" | "aria-selected" | "aria-hidden" | "accessibilityLabelledBy" | "aria-labelledby" | "accessibilityLiveRegion" | "aria-live" | "importantForAccessibility" | "screenReaderFocusable" | "children" | "collapsable" | "collapsableChildren" | "id" | "testID" | "nativeID" | "needsOffscreenAlphaCompositing" | "hitSlop" | "pointerEvents" | "removeClippedSubviews" | "experimental_accessibilityOrder"> & Omit<Readonly<{
|
|
64
|
+
nativeBackgroundAndroid?: import("react-native/types_generated/Libraries/Components/View/ViewPropTypes").AndroidDrawable | undefined;
|
|
65
|
+
nativeForegroundAndroid?: import("react-native/types_generated/Libraries/Components/View/ViewPropTypes").AndroidDrawable | undefined;
|
|
66
|
+
renderToHardwareTextureAndroid?: boolean | undefined;
|
|
67
|
+
hasTVPreferredFocus?: boolean | undefined;
|
|
68
|
+
nextFocusDown?: number | undefined;
|
|
69
|
+
nextFocusForward?: number | undefined;
|
|
70
|
+
nextFocusLeft?: number | undefined;
|
|
71
|
+
nextFocusRight?: number | undefined;
|
|
72
|
+
nextFocusUp?: number | undefined;
|
|
73
|
+
focusable?: boolean | undefined;
|
|
74
|
+
tabIndex?: 0 | -1;
|
|
75
|
+
onClick?: ((event: import("react-native").GestureResponderEvent) => unknown) | undefined;
|
|
76
|
+
}>, "style" | "shouldRasterizeIOS" | "accessibilityIgnoresInvertColors" | "accessibilityViewIsModal" | "accessibilityShowsLargeContentViewer" | "accessibilityLargeContentTitle" | "aria-modal" | "accessibilityElementsHidden" | "accessibilityLanguage" | "accessibilityRespondsToUserInteraction" | "accessible" | "accessibilityLabel" | "accessibilityHint" | "aria-label" | "accessibilityRole" | "role" | "accessibilityState" | "accessibilityValue" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "accessibilityActions" | "aria-busy" | "aria-checked" | "aria-disabled" | "aria-expanded" | "aria-selected" | "aria-hidden" | "accessibilityLabelledBy" | "aria-labelledby" | "accessibilityLiveRegion" | "aria-live" | "importantForAccessibility" | "screenReaderFocusable" | "children" | "collapsable" | "collapsableChildren" | "id" | "testID" | "nativeID" | "needsOffscreenAlphaCompositing" | "hitSlop" | "pointerEvents" | "removeClippedSubviews" | "experimental_accessibilityOrder"> & Omit<Readonly<{
|
|
77
|
+
shouldRasterizeIOS?: boolean | undefined;
|
|
78
|
+
}>, "style" | "accessibilityIgnoresInvertColors" | "accessibilityViewIsModal" | "accessibilityShowsLargeContentViewer" | "accessibilityLargeContentTitle" | "aria-modal" | "accessibilityElementsHidden" | "accessibilityLanguage" | "accessibilityRespondsToUserInteraction" | "accessible" | "accessibilityLabel" | "accessibilityHint" | "aria-label" | "accessibilityRole" | "role" | "accessibilityState" | "accessibilityValue" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "accessibilityActions" | "aria-busy" | "aria-checked" | "aria-disabled" | "aria-expanded" | "aria-selected" | "aria-hidden" | "accessibilityLabelledBy" | "aria-labelledby" | "accessibilityLiveRegion" | "aria-live" | "importantForAccessibility" | "screenReaderFocusable" | "children" | "collapsable" | "collapsableChildren" | "id" | "testID" | "nativeID" | "needsOffscreenAlphaCompositing" | "hitSlop" | "pointerEvents" | "removeClippedSubviews" | "experimental_accessibilityOrder"> & Omit<Readonly<Omit<Readonly<{
|
|
79
|
+
accessibilityLabelledBy?: (string | undefined) | (Array<string> | undefined);
|
|
80
|
+
"aria-labelledby"?: string | undefined;
|
|
81
|
+
accessibilityLiveRegion?: ("none" | "polite" | "assertive") | undefined;
|
|
82
|
+
"aria-live"?: ("polite" | "assertive" | "off") | undefined;
|
|
83
|
+
importantForAccessibility?: ("auto" | "yes" | "no" | "no-hide-descendants") | undefined;
|
|
84
|
+
screenReaderFocusable?: boolean;
|
|
85
|
+
}>, "accessibilityIgnoresInvertColors" | "accessibilityViewIsModal" | "accessibilityShowsLargeContentViewer" | "accessibilityLargeContentTitle" | "aria-modal" | "accessibilityElementsHidden" | "accessibilityLanguage" | "accessibilityRespondsToUserInteraction" | "accessible" | "accessibilityLabel" | "accessibilityHint" | "aria-label" | "accessibilityRole" | "role" | "accessibilityState" | "accessibilityValue" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "accessibilityActions" | "aria-busy" | "aria-checked" | "aria-disabled" | "aria-expanded" | "aria-selected" | "aria-hidden"> & Omit<Readonly<{
|
|
86
|
+
accessibilityIgnoresInvertColors?: boolean | undefined;
|
|
87
|
+
accessibilityViewIsModal?: boolean | undefined;
|
|
88
|
+
accessibilityShowsLargeContentViewer?: boolean | undefined;
|
|
89
|
+
accessibilityLargeContentTitle?: string | undefined;
|
|
90
|
+
"aria-modal"?: boolean | undefined;
|
|
91
|
+
accessibilityElementsHidden?: boolean | undefined;
|
|
92
|
+
accessibilityLanguage?: string | undefined;
|
|
93
|
+
accessibilityRespondsToUserInteraction?: boolean | undefined;
|
|
94
|
+
}>, "accessible" | "accessibilityLabel" | "accessibilityHint" | "aria-label" | "accessibilityRole" | "role" | "accessibilityState" | "accessibilityValue" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "accessibilityActions" | "aria-busy" | "aria-checked" | "aria-disabled" | "aria-expanded" | "aria-selected" | "aria-hidden"> & {
|
|
95
|
+
accessible?: boolean | undefined;
|
|
96
|
+
accessibilityLabel?: string | undefined;
|
|
97
|
+
accessibilityHint?: string | undefined;
|
|
98
|
+
"aria-label"?: string | undefined;
|
|
99
|
+
accessibilityRole?: import("react-native").AccessibilityRole | undefined;
|
|
100
|
+
role?: import("react-native").Role | undefined;
|
|
101
|
+
accessibilityState?: import("react-native").AccessibilityState | undefined;
|
|
102
|
+
accessibilityValue?: import("react-native").AccessibilityValue | undefined;
|
|
103
|
+
"aria-valuemax"?: import("react-native").AccessibilityValue["max"] | undefined;
|
|
104
|
+
"aria-valuemin"?: import("react-native").AccessibilityValue["min"] | undefined;
|
|
105
|
+
"aria-valuenow"?: import("react-native").AccessibilityValue["now"] | undefined;
|
|
106
|
+
"aria-valuetext"?: import("react-native").AccessibilityValue["text"] | undefined;
|
|
107
|
+
accessibilityActions?: ReadonlyArray<import("react-native/types_generated/Libraries/Components/View/ViewAccessibility").AccessibilityActionInfo> | undefined;
|
|
108
|
+
"aria-busy"?: boolean | undefined;
|
|
109
|
+
"aria-checked"?: (boolean | undefined) | "mixed";
|
|
110
|
+
"aria-disabled"?: boolean | undefined;
|
|
111
|
+
"aria-expanded"?: boolean | undefined;
|
|
112
|
+
"aria-selected"?: boolean | undefined;
|
|
113
|
+
"aria-hidden"?: boolean | undefined;
|
|
114
|
+
}>, "style" | "children" | "collapsable" | "collapsableChildren" | "id" | "testID" | "nativeID" | "needsOffscreenAlphaCompositing" | "hitSlop" | "pointerEvents" | "removeClippedSubviews" | "experimental_accessibilityOrder"> & Omit<Readonly<{
|
|
115
|
+
children?: React.ReactNode;
|
|
116
|
+
style?: import("react-native/types_generated/Libraries/StyleSheet/StyleSheet").ViewStyleProp | undefined;
|
|
117
|
+
collapsable?: boolean | undefined;
|
|
118
|
+
collapsableChildren?: boolean | undefined;
|
|
119
|
+
id?: string;
|
|
120
|
+
testID?: string | undefined;
|
|
121
|
+
nativeID?: string | undefined;
|
|
122
|
+
needsOffscreenAlphaCompositing?: boolean | undefined;
|
|
123
|
+
hitSlop?: import("react-native/types_generated/Libraries/StyleSheet/EdgeInsetsPropType").EdgeInsetsOrSizeProp | undefined;
|
|
124
|
+
pointerEvents?: ("auto" | "box-none" | "box-only" | "none") | undefined;
|
|
125
|
+
removeClippedSubviews?: boolean | undefined;
|
|
126
|
+
experimental_accessibilityOrder?: Array<string> | undefined;
|
|
127
|
+
}>, never>>, "title" | "tintColor" | "titleColor" | "enabled" | "colors" | "progressBackgroundColor" | "size" | "onRefresh" | "refreshing" | "progressViewOffset"> & Omit<Readonly<{
|
|
128
|
+
tintColor?: import("react-native").ColorValue | undefined;
|
|
129
|
+
titleColor?: import("react-native").ColorValue | undefined;
|
|
130
|
+
title?: string | undefined;
|
|
131
|
+
}>, "enabled" | "colors" | "progressBackgroundColor" | "size" | "onRefresh" | "refreshing" | "progressViewOffset"> & Omit<Readonly<{
|
|
132
|
+
enabled?: boolean | undefined;
|
|
133
|
+
colors?: ReadonlyArray<import("react-native").ColorValue> | undefined;
|
|
134
|
+
progressBackgroundColor?: import("react-native").ColorValue | undefined;
|
|
135
|
+
size?: ("default" | "large") | undefined;
|
|
136
|
+
}>, "onRefresh" | "refreshing" | "progressViewOffset"> & Omit<Readonly<{
|
|
137
|
+
onRefresh?: (() => void | Promise<void>) | undefined;
|
|
138
|
+
refreshing: boolean;
|
|
139
|
+
progressViewOffset?: number | undefined;
|
|
140
|
+
}>, never>>>, typeof RefreshControl>;
|
|
141
|
+
type MaybeShared<T> = T | SharedValue<T | undefined>;
|
|
142
|
+
export interface ResolveRefreshControlOptions {
|
|
143
|
+
refreshControl?: MaybeShared<ReactElement<RefreshControlProps>>;
|
|
144
|
+
refreshing?: MaybeShared<boolean>;
|
|
145
|
+
onRefresh?: MaybeShared<() => void>;
|
|
146
|
+
progressViewOffset: MaybeShared<number> | SharedValue<number>;
|
|
147
|
+
}
|
|
148
|
+
export declare function resolveRefreshControl({ refreshControl, refreshing, onRefresh, progressViewOffset, }: ResolveRefreshControlOptions): ReactElement<RefreshControlProps | React.ComponentProps<typeof AnimatedRefreshControl>> | undefined;
|
|
149
|
+
export {};
|
|
150
|
+
//# sourceMappingURL=refreshControl.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"refreshControl.d.ts","sourceRoot":"","sources":["../../../../src/utils/refreshControl.tsx"],"names":[],"mappings":"AAAA,OAAO,EAIL,KAAK,YAAY,EAClB,MAAM,OAAO,CAAC;AACf,OAAO,EAAE,cAAc,EAAE,KAAK,mBAAmB,EAAE,MAAM,cAAc,CAAC;AACxE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAK3D,QAAA,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;oCAAmD,CAAC;AAEhF,KAAK,WAAW,CAAC,CAAC,IAAI,CAAC,GAAG,WAAW,CAAC,CAAC,GAAG,SAAS,CAAC,CAAC;AAErD,MAAM,WAAW,4BAA4B;IAC3C,cAAc,CAAC,EAAE,WAAW,CAAC,YAAY,CAAC,mBAAmB,CAAC,CAAC,CAAC;IAChE,UAAU,CAAC,EAAE,WAAW,CAAC,OAAO,CAAC,CAAC;IAClC,SAAS,CAAC,EAAE,WAAW,CAAC,MAAM,IAAI,CAAC,CAAC;IACpC,kBAAkB,EAAE,WAAW,CAAC,MAAM,CAAC,GAAG,WAAW,CAAC,MAAM,CAAC,CAAC;CAC/D;AAED,wBAAgB,qBAAqB,CAAC,EACpC,cAAc,EACd,UAAU,EACV,SAAS,EACT,kBAAkB,GACnB,EAAE,4BAA4B,GAC3B,YAAY,CACV,mBAAmB,GAAG,KAAK,CAAC,cAAc,CAAC,OAAO,sBAAsB,CAAC,CAC1E,GACD,SAAS,CAYZ"}
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { SharedValue } from 'react-native-reanimated';
|
|
2
|
+
import type { ScrollValue, ScrollValues } from '../types';
|
|
2
3
|
export declare function getInitialScrollValue(): ScrollValue;
|
|
4
|
+
export declare function ensureScrollValueRegistered(scrollValues: SharedValue<ScrollValues>, id: string): ScrollValues;
|
|
5
|
+
export declare function warnIfMissingActiveScrollId(scrollValues: ScrollValues, id: string, activeScrollId: string | undefined): void;
|
|
3
6
|
//# sourceMappingURL=values.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"values.d.ts","sourceRoot":"","sources":["../../../../src/utils/values.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"values.d.ts","sourceRoot":"","sources":["../../../../src/utils/values.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,KAAK,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAG1D,wBAAgB,qBAAqB,IAAI,WAAW,CAGnD;AAED,wBAAgB,2BAA2B,CACzC,YAAY,EAAE,WAAW,CAAC,YAAY,CAAC,EACvC,EAAE,EAAE,MAAM,GACT,YAAY,CAiBd;AAED,wBAAgB,2BAA2B,CACzC,YAAY,EAAE,YAAY,EAC1B,EAAE,EAAE,MAAM,EACV,cAAc,EAAE,MAAM,GAAG,SAAS,GACjC,IAAI,CA0BN"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-header-motion",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "1.0.0-alpha.0",
|
|
4
4
|
"description": "Smooth, animated collapsible headers with scroll-based motion control in React Native",
|
|
5
5
|
"main": "./lib/module/index.js",
|
|
6
6
|
"types": "./lib/typescript/src/index.d.ts",
|
|
@@ -76,17 +76,19 @@
|
|
|
76
76
|
"jest": "^29.7.0",
|
|
77
77
|
"lefthook": "^2.0.3",
|
|
78
78
|
"prettier": "^2.8.8",
|
|
79
|
-
"react": "19.
|
|
80
|
-
"react-native": "0.
|
|
79
|
+
"react": "19.2.0",
|
|
80
|
+
"react-native": "0.83.2",
|
|
81
81
|
"react-native-builder-bob": "^0.40.17",
|
|
82
|
-
"react-native-
|
|
83
|
-
"react-native-
|
|
82
|
+
"react-native-gesture-handler": "2.30.0",
|
|
83
|
+
"react-native-reanimated": "4.2.1",
|
|
84
|
+
"react-native-worklets": "0.7.2",
|
|
84
85
|
"release-it": "^19.0.4",
|
|
85
86
|
"typescript": "^5.9.2"
|
|
86
87
|
},
|
|
87
88
|
"peerDependencies": {
|
|
88
89
|
"react": "*",
|
|
89
90
|
"react-native": "*",
|
|
91
|
+
"react-native-gesture-handler": "^2.0.0",
|
|
90
92
|
"react-native-reanimated": ">=4.0.0",
|
|
91
93
|
"react-native-worklets": ">=0.4.0"
|
|
92
94
|
},
|
|
@@ -4,11 +4,9 @@ import { HeaderMotionScrollManager } from './ScrollManager';
|
|
|
4
4
|
|
|
5
5
|
import type { ScrollViewProps } from 'react-native';
|
|
6
6
|
|
|
7
|
-
type
|
|
7
|
+
export type HeaderMotionFlatListProps<T = any> = ComponentProps<
|
|
8
8
|
typeof Animated.FlatList<T>
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
export type HeaderMotionFlatListProps<T = any> = AnimatedFlatListProps<T> & {
|
|
9
|
+
> & {
|
|
12
10
|
/**
|
|
13
11
|
* Optional unique identifier for this scroll view.
|
|
14
12
|
* Use this when you have multiple scroll views (e.g. in tabs) to track them separately.
|
|
@@ -18,7 +16,7 @@ export type HeaderMotionFlatListProps<T = any> = AnimatedFlatListProps<T> & {
|
|
|
18
16
|
* Optional animated ref to use for the flat list.
|
|
19
17
|
* When provided, the scroll manager will use this ref instead of creating its own.
|
|
20
18
|
*/
|
|
21
|
-
animatedRef?: AnimatedRef<
|
|
19
|
+
animatedRef?: AnimatedRef<Animated.FlatList<T>> | AnimatedRef;
|
|
22
20
|
};
|
|
23
21
|
|
|
24
22
|
/**
|
|
@@ -45,18 +43,34 @@ export function HeaderMotionFlatList<T = any>({
|
|
|
45
43
|
...props
|
|
46
44
|
}: HeaderMotionFlatListProps<T>) {
|
|
47
45
|
return (
|
|
48
|
-
<HeaderMotionScrollManager
|
|
46
|
+
<HeaderMotionScrollManager
|
|
47
|
+
scrollId={scrollId}
|
|
48
|
+
animatedRef={animatedRef as AnimatedRef<Animated.FlatList<T>>}
|
|
49
|
+
refreshControl={props.refreshControl}
|
|
50
|
+
refreshing={props.refreshing}
|
|
51
|
+
onRefresh={props.onRefresh}
|
|
52
|
+
progressViewOffset={props.progressViewOffset}
|
|
53
|
+
>
|
|
49
54
|
{(
|
|
50
|
-
{
|
|
55
|
+
{
|
|
56
|
+
onScroll,
|
|
57
|
+
refreshControl: managedRefreshControl,
|
|
58
|
+
ref,
|
|
59
|
+
...scrollViewProps
|
|
60
|
+
},
|
|
51
61
|
{ originalHeaderHeight, minHeightContentContainerStyle }
|
|
52
62
|
) => (
|
|
53
63
|
<Animated.FlatList
|
|
54
64
|
{...scrollViewProps}
|
|
55
65
|
{...props}
|
|
66
|
+
ref={ref}
|
|
56
67
|
onScroll={onScroll}
|
|
57
|
-
|
|
68
|
+
{...(managedRefreshControl && {
|
|
69
|
+
refreshControl: managedRefreshControl,
|
|
70
|
+
})}
|
|
71
|
+
renderScrollComponent={(scrollComponentProps) => (
|
|
58
72
|
<AnimatedScrollContainer
|
|
59
|
-
{...
|
|
73
|
+
{...scrollComponentProps}
|
|
60
74
|
contentContainerStyle={[
|
|
61
75
|
minHeightContentContainerStyle,
|
|
62
76
|
{ paddingTop: originalHeaderHeight },
|
|
@@ -1,8 +1,32 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
1
|
+
import { useMemo } from 'react';
|
|
2
|
+
import { Platform, StyleSheet, View, type ViewProps } from 'react-native';
|
|
3
|
+
import {
|
|
4
|
+
Gesture,
|
|
5
|
+
GestureDetector,
|
|
6
|
+
GestureHandlerRootView,
|
|
7
|
+
} from 'react-native-gesture-handler';
|
|
8
|
+
import Animated, {
|
|
9
|
+
useAnimatedReaction,
|
|
10
|
+
withDecay,
|
|
11
|
+
type AnimatedProps,
|
|
12
|
+
} from 'react-native-reanimated';
|
|
13
|
+
|
|
14
|
+
const PLATFORM_PANNING_ENABLED = Platform.select({
|
|
15
|
+
default: true,
|
|
16
|
+
android: false,
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
import type { MotionProgress } from '../types';
|
|
3
20
|
|
|
4
21
|
export type HeaderBaseProps = ViewProps;
|
|
5
|
-
export type AnimatedHeaderBaseProps = AnimatedProps<ViewProps
|
|
22
|
+
export type AnimatedHeaderBaseProps = AnimatedProps<ViewProps> &
|
|
23
|
+
Pick<MotionProgress, 'animatedHeaderBaseProps'> & {
|
|
24
|
+
/**
|
|
25
|
+
* Wraps the header with GestureHandlerRootView.
|
|
26
|
+
* Keep this disabled when your app already has a root-level GestureHandlerRootView.
|
|
27
|
+
*/
|
|
28
|
+
withGestureHandlerRootView?: boolean;
|
|
29
|
+
};
|
|
6
30
|
|
|
7
31
|
/**
|
|
8
32
|
* Base header component with absolute positioning.
|
|
@@ -35,11 +59,74 @@ export function HeaderBase({ style, ...rest }: HeaderBaseProps) {
|
|
|
35
59
|
* </AnimatedHeaderBase>
|
|
36
60
|
* ```
|
|
37
61
|
*/
|
|
62
|
+
|
|
63
|
+
// TODO: Thinking about DX, perhaps creating another context in AnimatedHeaderBase or somewhere else could make sense
|
|
64
|
+
// Note: Depending on feedback, there might be a need to intercept ongoing scroll when starting to pan (perhaps even on the tap itself but to be checked what feels better when using)
|
|
65
|
+
// Note: Depending on feedback, there might be a need to block momentum by forcing scrollTo
|
|
38
66
|
export function AnimatedHeaderBase({
|
|
39
67
|
style,
|
|
68
|
+
animatedHeaderBaseProps,
|
|
69
|
+
withGestureHandlerRootView = false,
|
|
40
70
|
...rest
|
|
41
71
|
}: AnimatedHeaderBaseProps) {
|
|
42
|
-
|
|
72
|
+
if (!animatedHeaderBaseProps) {
|
|
73
|
+
throw new Error(
|
|
74
|
+
'AnimatedHeaderBase requires `animatedHeaderBaseProps`. Pass the value from HeaderMotion.Header or useMotionProgress.'
|
|
75
|
+
);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
const {
|
|
79
|
+
enableHeaderPan,
|
|
80
|
+
scrollToRef,
|
|
81
|
+
headerPanMomentumOffset: momentumScrollOffset,
|
|
82
|
+
} = animatedHeaderBaseProps;
|
|
83
|
+
|
|
84
|
+
useAnimatedReaction(
|
|
85
|
+
() => momentumScrollOffset.get(),
|
|
86
|
+
(offset, prevOffset) => {
|
|
87
|
+
if (offset !== null) {
|
|
88
|
+
const dy = offset - (prevOffset ?? 0);
|
|
89
|
+
scrollToRef.current?.(dy);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
);
|
|
93
|
+
|
|
94
|
+
const isPanEnabled = PLATFORM_PANNING_ENABLED && enableHeaderPan;
|
|
95
|
+
|
|
96
|
+
const pan = useMemo(
|
|
97
|
+
() =>
|
|
98
|
+
Gesture.Pan()
|
|
99
|
+
.enabled(isPanEnabled)
|
|
100
|
+
.onChange((e) => {
|
|
101
|
+
const dy = e.changeY;
|
|
102
|
+
scrollToRef.current?.(dy);
|
|
103
|
+
})
|
|
104
|
+
.onEnd((e) => {
|
|
105
|
+
momentumScrollOffset.set(
|
|
106
|
+
withDecay(
|
|
107
|
+
{
|
|
108
|
+
velocity: e.velocityY,
|
|
109
|
+
},
|
|
110
|
+
() => momentumScrollOffset.set(null)
|
|
111
|
+
)
|
|
112
|
+
);
|
|
113
|
+
})
|
|
114
|
+
.shouldCancelWhenOutside(false),
|
|
115
|
+
// Note: In first testing Android works without gesture handler whatsoever. If this functionality is needed, we can further control it with a prop in the future
|
|
116
|
+
[isPanEnabled, scrollToRef, momentumScrollOffset]
|
|
117
|
+
);
|
|
118
|
+
|
|
119
|
+
const content = (
|
|
120
|
+
<GestureDetector gesture={pan}>
|
|
121
|
+
<Animated.View style={[style, styles.container]} {...rest} />
|
|
122
|
+
</GestureDetector>
|
|
123
|
+
);
|
|
124
|
+
|
|
125
|
+
if (!withGestureHandlerRootView) {
|
|
126
|
+
return content;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
return <GestureHandlerRootView>{content}</GestureHandlerRootView>;
|
|
43
130
|
}
|
|
44
131
|
|
|
45
132
|
const styles = StyleSheet.create({
|
|
@@ -49,3 +136,5 @@ const styles = StyleSheet.create({
|
|
|
49
136
|
right: 0,
|
|
50
137
|
},
|
|
51
138
|
});
|
|
139
|
+
|
|
140
|
+
// TODO: Lib refactor: context repetition, make people use less boilerplate by just wrapping the header with <HeaderBaseOrSomethingElse ctx={headerProps} /> that does everything under the hood (measuring total for example). That will then allow for people to use context inside
|