react-native-collapsible-sticky-header 0.0.0-stage → 0.1.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/LICENSE +21 -0
- package/README.md +569 -2
- package/lib/commonjs/Badge.js +65 -0
- package/lib/commonjs/Badge.js.map +1 -0
- package/lib/commonjs/CollapsibleStickyHeaderScreen.js +386 -0
- package/lib/commonjs/CollapsibleStickyHeaderScreen.js.map +1 -0
- package/lib/commonjs/HeaderGreeting.js +122 -0
- package/lib/commonjs/HeaderGreeting.js.map +1 -0
- package/lib/commonjs/HeaderNavBar.js +219 -0
- package/lib/commonjs/HeaderNavBar.js.map +1 -0
- package/lib/commonjs/ImageOrNode.js +40 -0
- package/lib/commonjs/ImageOrNode.js.map +1 -0
- package/lib/commonjs/animations.js +34 -0
- package/lib/commonjs/animations.js.map +1 -0
- package/lib/commonjs/index.js +122 -0
- package/lib/commonjs/index.js.map +1 -0
- package/lib/commonjs/optionalGradient.js +24 -0
- package/lib/commonjs/optionalGradient.js.map +1 -0
- package/lib/commonjs/package.json +1 -0
- package/lib/commonjs/theme.js +93 -0
- package/lib/commonjs/theme.js.map +1 -0
- package/lib/commonjs/types.js +6 -0
- package/lib/commonjs/types.js.map +1 -0
- package/lib/commonjs/useStickyHeader.js +143 -0
- package/lib/commonjs/useStickyHeader.js.map +1 -0
- package/lib/commonjs/utils.js +90 -0
- package/lib/commonjs/utils.js.map +1 -0
- package/lib/module/Badge.js +61 -0
- package/lib/module/Badge.js.map +1 -0
- package/lib/module/CollapsibleStickyHeaderScreen.js +379 -0
- package/lib/module/CollapsibleStickyHeaderScreen.js.map +1 -0
- package/lib/module/HeaderGreeting.js +118 -0
- package/lib/module/HeaderGreeting.js.map +1 -0
- package/lib/module/HeaderNavBar.js +215 -0
- package/lib/module/HeaderNavBar.js.map +1 -0
- package/lib/module/ImageOrNode.js +36 -0
- package/lib/module/ImageOrNode.js.map +1 -0
- package/lib/module/animations.js +28 -0
- package/lib/module/animations.js.map +1 -0
- package/lib/module/index.js +11 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/optionalGradient.js +20 -0
- package/lib/module/optionalGradient.js.map +1 -0
- package/lib/module/package.json +1 -0
- package/lib/module/theme.js +88 -0
- package/lib/module/theme.js.map +1 -0
- package/lib/module/types.js +4 -0
- package/lib/module/types.js.map +1 -0
- package/lib/module/useStickyHeader.js +138 -0
- package/lib/module/useStickyHeader.js.map +1 -0
- package/lib/module/utils.js +78 -0
- package/lib/module/utils.js.map +1 -0
- package/lib/typescript/commonjs/package.json +1 -0
- package/lib/typescript/commonjs/src/Badge.d.ts +20 -0
- package/lib/typescript/commonjs/src/Badge.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/CollapsibleStickyHeaderScreen.d.ts +10 -0
- package/lib/typescript/commonjs/src/CollapsibleStickyHeaderScreen.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/HeaderGreeting.d.ts +33 -0
- package/lib/typescript/commonjs/src/HeaderGreeting.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/HeaderNavBar.d.ts +48 -0
- package/lib/typescript/commonjs/src/HeaderNavBar.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/ImageOrNode.d.ts +16 -0
- package/lib/typescript/commonjs/src/ImageOrNode.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/animations.d.ts +9 -0
- package/lib/typescript/commonjs/src/animations.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/index.d.ts +10 -0
- package/lib/typescript/commonjs/src/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/optionalGradient.d.ts +13 -0
- package/lib/typescript/commonjs/src/optionalGradient.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/theme.d.ts +81 -0
- package/lib/typescript/commonjs/src/theme.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/types.d.ts +244 -0
- package/lib/typescript/commonjs/src/types.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/useStickyHeader.d.ts +12 -0
- package/lib/typescript/commonjs/src/useStickyHeader.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/utils.d.ts +30 -0
- package/lib/typescript/commonjs/src/utils.d.ts.map +1 -0
- package/lib/typescript/module/package.json +1 -0
- package/lib/typescript/module/src/Badge.d.ts +20 -0
- package/lib/typescript/module/src/Badge.d.ts.map +1 -0
- package/lib/typescript/module/src/CollapsibleStickyHeaderScreen.d.ts +10 -0
- package/lib/typescript/module/src/CollapsibleStickyHeaderScreen.d.ts.map +1 -0
- package/lib/typescript/module/src/HeaderGreeting.d.ts +33 -0
- package/lib/typescript/module/src/HeaderGreeting.d.ts.map +1 -0
- package/lib/typescript/module/src/HeaderNavBar.d.ts +48 -0
- package/lib/typescript/module/src/HeaderNavBar.d.ts.map +1 -0
- package/lib/typescript/module/src/ImageOrNode.d.ts +16 -0
- package/lib/typescript/module/src/ImageOrNode.d.ts.map +1 -0
- package/lib/typescript/module/src/animations.d.ts +9 -0
- package/lib/typescript/module/src/animations.d.ts.map +1 -0
- package/lib/typescript/module/src/index.d.ts +10 -0
- package/lib/typescript/module/src/index.d.ts.map +1 -0
- package/lib/typescript/module/src/optionalGradient.d.ts +13 -0
- package/lib/typescript/module/src/optionalGradient.d.ts.map +1 -0
- package/lib/typescript/module/src/theme.d.ts +81 -0
- package/lib/typescript/module/src/theme.d.ts.map +1 -0
- package/lib/typescript/module/src/types.d.ts +244 -0
- package/lib/typescript/module/src/types.d.ts.map +1 -0
- package/lib/typescript/module/src/useStickyHeader.d.ts +12 -0
- package/lib/typescript/module/src/useStickyHeader.d.ts.map +1 -0
- package/lib/typescript/module/src/utils.d.ts +30 -0
- package/lib/typescript/module/src/utils.d.ts.map +1 -0
- package/package.json +142 -4
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { ImageSourcePropType } from 'react-native';
|
|
2
|
+
import type { HeaderAction } from './types.js';
|
|
3
|
+
/** Counts above this render as `"{max}+"` unless overridden. */
|
|
4
|
+
export declare const DEFAULT_BADGE_MAX = 9;
|
|
5
|
+
/** The most icon buttons a header bar renders. */
|
|
6
|
+
export declare const MAX_HEADER_ACTIONS = 3;
|
|
7
|
+
/**
|
|
8
|
+
* Scroll offset at which the header is considered collapsed:
|
|
9
|
+
* `topInset + navBarHeight + offset`. Returns 0 while the nav bar has not
|
|
10
|
+
* been measured, which keeps the sticky bar hidden.
|
|
11
|
+
*/
|
|
12
|
+
export declare function computeThreshold(navBarHeight: number, topInset: number, offset?: number): number;
|
|
13
|
+
/** 0 at the top, 1 once `scrollY` reaches the threshold. */
|
|
14
|
+
export declare function getCollapseProgress(scrollY: number, threshold: number): number;
|
|
15
|
+
/**
|
|
16
|
+
* 0 before `threshold - fadeDistance`, 1 at the threshold. A fade distance
|
|
17
|
+
* of 0 makes the transition instant.
|
|
18
|
+
*/
|
|
19
|
+
export declare function getStickyProgress(scrollY: number, threshold: number, fadeDistance: number): number;
|
|
20
|
+
/** Whether the sticky bar should receive touches / be read by screen readers. */
|
|
21
|
+
export declare function isStickyAt(scrollY: number, threshold: number, pointerOffset: number): boolean;
|
|
22
|
+
export declare function isImageSource(value: unknown): value is ImageSourcePropType;
|
|
23
|
+
/** Drops hidden actions and keeps the first `MAX_HEADER_ACTIONS`. */
|
|
24
|
+
export declare function limitActions(actions: HeaderAction[] | undefined): {
|
|
25
|
+
actions: HeaderAction[];
|
|
26
|
+
overflow: number;
|
|
27
|
+
};
|
|
28
|
+
export declare function warnActionOverflow(overflow: number): void;
|
|
29
|
+
export declare function formatBadgeCount(count: number, max: number): string;
|
|
30
|
+
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../src/utils.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AACxD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAS,CAAC;AAE5C,gEAAgE;AAChE,eAAO,MAAM,iBAAiB,IAAI,CAAC;AAEnC,kDAAkD;AAClD,eAAO,MAAM,kBAAkB,IAAI,CAAC;AAOpC;;;;GAIG;AACH,wBAAgB,gBAAgB,CAC9B,YAAY,EAAE,MAAM,EACpB,QAAQ,EAAE,MAAM,EAChB,MAAM,SAAI,GACT,MAAM,CAIR;AAED,4DAA4D;AAC5D,wBAAgB,mBAAmB,CACjC,OAAO,EAAE,MAAM,EACf,SAAS,EAAE,MAAM,GAChB,MAAM,CAIR;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAC/B,OAAO,EAAE,MAAM,EACf,SAAS,EAAE,MAAM,EACjB,YAAY,EAAE,MAAM,GACnB,MAAM,CAKR;AAED,iFAAiF;AACjF,wBAAgB,UAAU,CACxB,OAAO,EAAE,MAAM,EACf,SAAS,EAAE,MAAM,EACjB,aAAa,EAAE,MAAM,GACpB,OAAO,CAGT;AAED,wBAAgB,aAAa,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,mBAAmB,CAO1E;AAED,qEAAqE;AACrE,wBAAgB,YAAY,CAAC,OAAO,EAAE,YAAY,EAAE,GAAG,SAAS,GAAG;IACjE,OAAO,EAAE,YAAY,EAAE,CAAC;IACxB,QAAQ,EAAE,MAAM,CAAC;CAClB,CAMA;AAED,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,CASzD;AAED,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,CAEnE"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,144 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-collapsible-sticky-header",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "A fully configurable collapsing hero header with a sticky compact bar for React Native (iOS & Android), powered by Reanimated.",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"react-native",
|
|
7
|
+
"ios",
|
|
8
|
+
"android",
|
|
9
|
+
"expo",
|
|
10
|
+
"header",
|
|
11
|
+
"sticky-header",
|
|
12
|
+
"collapsible-header",
|
|
13
|
+
"collapsing-toolbar",
|
|
14
|
+
"reanimated",
|
|
15
|
+
"flatlist",
|
|
16
|
+
"collapsing-header",
|
|
17
|
+
"parallax-header",
|
|
18
|
+
"scroll-header",
|
|
19
|
+
"animated-header",
|
|
20
|
+
"large-title",
|
|
21
|
+
"react-native-reanimated",
|
|
22
|
+
"expo-compatible",
|
|
23
|
+
"typescript",
|
|
24
|
+
"toolbar",
|
|
25
|
+
"appbar",
|
|
26
|
+
"navbar"
|
|
27
|
+
],
|
|
28
|
+
"license": "MIT",
|
|
29
|
+
"author": {
|
|
30
|
+
"name": "Santhosh James",
|
|
31
|
+
"url": "https://github.com/santhoshjamesc"
|
|
32
|
+
},
|
|
33
|
+
"repository": {
|
|
34
|
+
"type": "git",
|
|
35
|
+
"url": "git+https://github.com/santhoshjamesc/react-native-collapsible-sticky-header.git"
|
|
36
|
+
},
|
|
37
|
+
"bugs": {
|
|
38
|
+
"url": "https://github.com/santhoshjamesc/react-native-collapsible-sticky-header/issues"
|
|
39
|
+
},
|
|
40
|
+
"homepage": "https://github.com/santhoshjamesc/react-native-collapsible-sticky-header#readme",
|
|
41
|
+
"main": "./lib/commonjs/index.js",
|
|
42
|
+
"module": "./lib/module/index.js",
|
|
43
|
+
"types": "./lib/typescript/commonjs/src/index.d.ts",
|
|
44
|
+
"react-native": "./lib/module/index.js",
|
|
45
|
+
"exports": {
|
|
46
|
+
".": {
|
|
47
|
+
"import": {
|
|
48
|
+
"types": "./lib/typescript/module/src/index.d.ts",
|
|
49
|
+
"default": "./lib/module/index.js"
|
|
50
|
+
},
|
|
51
|
+
"require": {
|
|
52
|
+
"types": "./lib/typescript/commonjs/src/index.d.ts",
|
|
53
|
+
"default": "./lib/commonjs/index.js"
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
"./package.json": "./package.json"
|
|
57
|
+
},
|
|
58
|
+
"files": [
|
|
59
|
+
"lib",
|
|
60
|
+
"!**/__tests__",
|
|
61
|
+
"!**/__fixtures__",
|
|
62
|
+
"!**/__mocks__",
|
|
63
|
+
"!**/*.tsbuildinfo"
|
|
64
|
+
],
|
|
65
|
+
"sideEffects": false,
|
|
66
|
+
"scripts": {
|
|
67
|
+
"build": "bob build",
|
|
68
|
+
"prepare": "bob build",
|
|
69
|
+
"clean": "rm -rf lib",
|
|
70
|
+
"typecheck": "tsc --noEmit",
|
|
71
|
+
"lint": "eslint \"src/**/*.{ts,tsx}\" \"example/**/*.{ts,tsx}\"",
|
|
72
|
+
"format": "prettier --write \"{src,example}/**/*.{ts,tsx,js,json}\" \"*.{md,json,js,mjs}\"",
|
|
73
|
+
"format:check": "prettier --check \"{src,example}/**/*.{ts,tsx,js}\"",
|
|
74
|
+
"test": "jest",
|
|
75
|
+
"example": "npm --prefix example run",
|
|
76
|
+
"prepublishOnly": "npm run typecheck && npm run lint && npm test && npm run build"
|
|
77
|
+
},
|
|
78
|
+
"peerDependencies": {
|
|
79
|
+
"expo-linear-gradient": "*",
|
|
80
|
+
"react": ">=18.0.0",
|
|
81
|
+
"react-native": ">=0.76.0",
|
|
82
|
+
"react-native-reanimated": ">=3.0.0",
|
|
83
|
+
"react-native-safe-area-context": ">=4.0.0"
|
|
84
|
+
},
|
|
85
|
+
"peerDependenciesMeta": {
|
|
86
|
+
"expo-linear-gradient": {
|
|
87
|
+
"optional": true
|
|
88
|
+
}
|
|
89
|
+
},
|
|
90
|
+
"engines": {
|
|
91
|
+
"node": ">=20.19.0"
|
|
92
|
+
},
|
|
93
|
+
"react-native-builder-bob": {
|
|
94
|
+
"source": "src",
|
|
95
|
+
"output": "lib",
|
|
96
|
+
"exclude": "**/{__tests__,__fixtures__,__mocks__}/**",
|
|
97
|
+
"targets": [
|
|
98
|
+
[
|
|
99
|
+
"commonjs",
|
|
100
|
+
{
|
|
101
|
+
"esm": true
|
|
102
|
+
}
|
|
103
|
+
],
|
|
104
|
+
[
|
|
105
|
+
"module",
|
|
106
|
+
{
|
|
107
|
+
"esm": true
|
|
108
|
+
}
|
|
109
|
+
],
|
|
110
|
+
[
|
|
111
|
+
"typescript",
|
|
112
|
+
{
|
|
113
|
+
"project": "tsconfig.build.json"
|
|
114
|
+
}
|
|
115
|
+
]
|
|
116
|
+
]
|
|
117
|
+
},
|
|
118
|
+
"publishConfig": {
|
|
119
|
+
"access": "public",
|
|
120
|
+
"registry": "https://registry.npmjs.org/"
|
|
121
|
+
},
|
|
122
|
+
"devDependencies": {
|
|
123
|
+
"@eslint/js": "^10.0.1",
|
|
124
|
+
"@react-native/babel-preset": "^0.88.0",
|
|
125
|
+
"@react-native/jest-preset": "^0.88.0",
|
|
126
|
+
"@testing-library/react-native": "^14.1.0",
|
|
127
|
+
"@types/jest": "^30.0.0",
|
|
128
|
+
"@types/react": "~19.3.0",
|
|
129
|
+
"eslint": "^10.13.0",
|
|
130
|
+
"eslint-plugin-react-hooks": "^7.1.1",
|
|
131
|
+
"globals": "^17.13.0",
|
|
132
|
+
"jest": "^30.5.2",
|
|
133
|
+
"prettier": "^3.9.10",
|
|
134
|
+
"react": "^19.3.0",
|
|
135
|
+
"react-native": "^0.88.0",
|
|
136
|
+
"react-native-builder-bob": "^0.43.2",
|
|
137
|
+
"react-native-reanimated": "^4.7.1",
|
|
138
|
+
"react-native-safe-area-context": "^5.10.1",
|
|
139
|
+
"react-native-worklets": "^0.13.0",
|
|
140
|
+
"test-renderer": "^1.3.1",
|
|
141
|
+
"typescript": "~6.0.3",
|
|
142
|
+
"typescript-eslint": "^8.71.2"
|
|
143
|
+
}
|
|
144
|
+
}
|