react-native-lumen 1.0.0 → 1.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/README.md +763 -231
- package/lib/module/components/TourOverlay.js +43 -3
- package/lib/module/components/TourOverlay.js.map +1 -1
- package/lib/module/components/TourProvider.js +318 -63
- package/lib/module/components/TourProvider.js.map +1 -1
- package/lib/module/components/TourTooltip.js +121 -79
- package/lib/module/components/TourTooltip.js.map +1 -1
- package/lib/module/components/TourZone.js +186 -119
- package/lib/module/components/TourZone.js.map +1 -1
- package/lib/module/constants/defaults.js +43 -0
- package/lib/module/constants/defaults.js.map +1 -1
- package/lib/module/context/TourContext.js +5 -0
- package/lib/module/context/TourContext.js.map +1 -0
- package/lib/module/hooks/useTour.js +1 -1
- package/lib/module/hooks/useTour.js.map +1 -1
- package/lib/module/hooks/useTourScrollView.js +71 -0
- package/lib/module/hooks/useTourScrollView.js.map +1 -0
- package/lib/module/index.js +6 -0
- package/lib/module/index.js.map +1 -1
- package/lib/module/utils/storage.js +188 -0
- package/lib/module/utils/storage.js.map +1 -0
- package/lib/typescript/src/components/TourOverlay.d.ts.map +1 -1
- package/lib/typescript/src/components/TourProvider.d.ts +21 -4
- package/lib/typescript/src/components/TourProvider.d.ts.map +1 -1
- package/lib/typescript/src/components/TourTooltip.d.ts.map +1 -1
- package/lib/typescript/src/components/TourZone.d.ts +19 -1
- package/lib/typescript/src/components/TourZone.d.ts.map +1 -1
- package/lib/typescript/src/constants/defaults.d.ts +10 -0
- package/lib/typescript/src/constants/defaults.d.ts.map +1 -1
- package/lib/typescript/src/context/TourContext.d.ts +3 -0
- package/lib/typescript/src/context/TourContext.d.ts.map +1 -0
- package/lib/typescript/src/hooks/useTourScrollView.d.ts +65 -0
- package/lib/typescript/src/hooks/useTourScrollView.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +4 -0
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/types/index.d.ts +296 -1
- package/lib/typescript/src/types/index.d.ts.map +1 -1
- package/lib/typescript/src/utils/storage.d.ts +51 -0
- package/lib/typescript/src/utils/storage.d.ts.map +1 -0
- package/package.json +173 -171
- package/src/components/TourOverlay.tsx +45 -2
- package/src/components/TourProvider.tsx +409 -57
- package/src/components/TourTooltip.tsx +151 -74
- package/src/components/TourZone.tsx +238 -141
- package/src/constants/defaults.ts +51 -0
- package/src/context/TourContext.ts +4 -0
- package/src/hooks/useTour.ts +1 -1
- package/src/hooks/useTourScrollView.ts +111 -0
- package/src/index.tsx +27 -0
- package/src/types/index.ts +306 -1
- package/src/utils/storage.ts +226 -0
package/package.json
CHANGED
|
@@ -1,171 +1,173 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "react-native-lumen",
|
|
3
|
-
"version": "1.
|
|
4
|
-
"description": "A customizable app tour library for React Native",
|
|
5
|
-
"main": "./lib/module/index.js",
|
|
6
|
-
"types": "./lib/typescript/src/index.d.ts",
|
|
7
|
-
"exports": {
|
|
8
|
-
".": {
|
|
9
|
-
"source": "./src/index.tsx",
|
|
10
|
-
"types": "./lib/typescript/src/index.d.ts",
|
|
11
|
-
"default": "./lib/module/index.js"
|
|
12
|
-
},
|
|
13
|
-
"./package.json": "./package.json"
|
|
14
|
-
},
|
|
15
|
-
"files": [
|
|
16
|
-
"src",
|
|
17
|
-
"lib",
|
|
18
|
-
"android",
|
|
19
|
-
"ios",
|
|
20
|
-
"cpp",
|
|
21
|
-
"*.podspec",
|
|
22
|
-
"react-native.config.js",
|
|
23
|
-
"!ios/build",
|
|
24
|
-
"!android/build",
|
|
25
|
-
"!android/gradle",
|
|
26
|
-
"!android/gradlew",
|
|
27
|
-
"!android/gradlew.bat",
|
|
28
|
-
"!android/local.properties",
|
|
29
|
-
"!**/__tests__",
|
|
30
|
-
"!**/__fixtures__",
|
|
31
|
-
"!**/__mocks__",
|
|
32
|
-
"!**/.*"
|
|
33
|
-
],
|
|
34
|
-
"scripts": {
|
|
35
|
-
"example": "yarn workspace react-native-lumen-example",
|
|
36
|
-
"clean": "del-cli lib",
|
|
37
|
-
"prepare": "bob build",
|
|
38
|
-
"typecheck": "tsc",
|
|
39
|
-
"lint": "eslint \"**/*.{js,ts,tsx}\"",
|
|
40
|
-
"test": "jest",
|
|
41
|
-
"release": "release-it --only-version"
|
|
42
|
-
},
|
|
43
|
-
"keywords": [
|
|
44
|
-
"react-native",
|
|
45
|
-
"ios",
|
|
46
|
-
"android"
|
|
47
|
-
],
|
|
48
|
-
"repository": {
|
|
49
|
-
"type": "git",
|
|
50
|
-
"url": "git+https://github.com/thedev204/react-native-lumen.git"
|
|
51
|
-
},
|
|
52
|
-
"author": "thedev204 <116882323+thedev204@users.noreply.github.com> (https://github.com/thedev204)",
|
|
53
|
-
"license": "MIT",
|
|
54
|
-
"bugs": {
|
|
55
|
-
"url": "https://github.com/thedev204/react-native-lumen/issues"
|
|
56
|
-
},
|
|
57
|
-
"homepage": "https://github.com/thedev204/react-native-lumen#readme",
|
|
58
|
-
"publishConfig": {
|
|
59
|
-
"registry": "https://registry.npmjs.org/"
|
|
60
|
-
},
|
|
61
|
-
"devDependencies": {
|
|
62
|
-
"@commitlint/config-conventional": "^19.8.1",
|
|
63
|
-
"@eslint/compat": "^1.3.2",
|
|
64
|
-
"@eslint/eslintrc": "^3.3.1",
|
|
65
|
-
"@eslint/js": "^9.35.0",
|
|
66
|
-
"@react-native/babel-preset": "0.83.0",
|
|
67
|
-
"@react-native/eslint-config": "0.83.0",
|
|
68
|
-
"@release-it/conventional-changelog": "^10.0.1",
|
|
69
|
-
"@types/jest": "^29.5.14",
|
|
70
|
-
"@types/react": "^19.1.12",
|
|
71
|
-
"commitlint": "^19.8.1",
|
|
72
|
-
"del-cli": "^6.0.0",
|
|
73
|
-
"eslint": "^9.39.2",
|
|
74
|
-
"eslint-config-prettier": "^9.0.0",
|
|
75
|
-
"eslint-plugin-
|
|
76
|
-
"
|
|
77
|
-
"
|
|
78
|
-
"
|
|
79
|
-
"
|
|
80
|
-
"
|
|
81
|
-
"react
|
|
82
|
-
"react-native
|
|
83
|
-
"react-native-
|
|
84
|
-
"react-native-
|
|
85
|
-
"
|
|
86
|
-
"
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
"react
|
|
92
|
-
"react-native
|
|
93
|
-
"react-native-
|
|
94
|
-
"react-native-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
"
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
"
|
|
122
|
-
"
|
|
123
|
-
"
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
"
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
"
|
|
163
|
-
"
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
1
|
+
{
|
|
2
|
+
"name": "react-native-lumen",
|
|
3
|
+
"version": "1.1.0",
|
|
4
|
+
"description": "A customizable app tour library for React Native",
|
|
5
|
+
"main": "./lib/module/index.js",
|
|
6
|
+
"types": "./lib/typescript/src/index.d.ts",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": {
|
|
9
|
+
"source": "./src/index.tsx",
|
|
10
|
+
"types": "./lib/typescript/src/index.d.ts",
|
|
11
|
+
"default": "./lib/module/index.js"
|
|
12
|
+
},
|
|
13
|
+
"./package.json": "./package.json"
|
|
14
|
+
},
|
|
15
|
+
"files": [
|
|
16
|
+
"src",
|
|
17
|
+
"lib",
|
|
18
|
+
"android",
|
|
19
|
+
"ios",
|
|
20
|
+
"cpp",
|
|
21
|
+
"*.podspec",
|
|
22
|
+
"react-native.config.js",
|
|
23
|
+
"!ios/build",
|
|
24
|
+
"!android/build",
|
|
25
|
+
"!android/gradle",
|
|
26
|
+
"!android/gradlew",
|
|
27
|
+
"!android/gradlew.bat",
|
|
28
|
+
"!android/local.properties",
|
|
29
|
+
"!**/__tests__",
|
|
30
|
+
"!**/__fixtures__",
|
|
31
|
+
"!**/__mocks__",
|
|
32
|
+
"!**/.*"
|
|
33
|
+
],
|
|
34
|
+
"scripts": {
|
|
35
|
+
"example": "yarn workspace react-native-lumen-example",
|
|
36
|
+
"clean": "del-cli lib",
|
|
37
|
+
"prepare": "bob build",
|
|
38
|
+
"typecheck": "tsc",
|
|
39
|
+
"lint": "eslint \"**/*.{js,ts,tsx}\"",
|
|
40
|
+
"test": "jest",
|
|
41
|
+
"release": "release-it --only-version"
|
|
42
|
+
},
|
|
43
|
+
"keywords": [
|
|
44
|
+
"react-native",
|
|
45
|
+
"ios",
|
|
46
|
+
"android"
|
|
47
|
+
],
|
|
48
|
+
"repository": {
|
|
49
|
+
"type": "git",
|
|
50
|
+
"url": "git+https://github.com/thedev204/react-native-lumen.git"
|
|
51
|
+
},
|
|
52
|
+
"author": "thedev204 <116882323+thedev204@users.noreply.github.com> (https://github.com/thedev204)",
|
|
53
|
+
"license": "MIT",
|
|
54
|
+
"bugs": {
|
|
55
|
+
"url": "https://github.com/thedev204/react-native-lumen/issues"
|
|
56
|
+
},
|
|
57
|
+
"homepage": "https://github.com/thedev204/react-native-lumen#readme",
|
|
58
|
+
"publishConfig": {
|
|
59
|
+
"registry": "https://registry.npmjs.org/"
|
|
60
|
+
},
|
|
61
|
+
"devDependencies": {
|
|
62
|
+
"@commitlint/config-conventional": "^19.8.1",
|
|
63
|
+
"@eslint/compat": "^1.3.2",
|
|
64
|
+
"@eslint/eslintrc": "^3.3.1",
|
|
65
|
+
"@eslint/js": "^9.35.0",
|
|
66
|
+
"@react-native/babel-preset": "0.83.0",
|
|
67
|
+
"@react-native/eslint-config": "0.83.0",
|
|
68
|
+
"@release-it/conventional-changelog": "^10.0.1",
|
|
69
|
+
"@types/jest": "^29.5.14",
|
|
70
|
+
"@types/react": "^19.1.12",
|
|
71
|
+
"commitlint": "^19.8.1",
|
|
72
|
+
"del-cli": "^6.0.0",
|
|
73
|
+
"eslint": "^9.39.2",
|
|
74
|
+
"eslint-config-prettier": "^9.0.0",
|
|
75
|
+
"eslint-plugin-ft-flow": "^3.0.11",
|
|
76
|
+
"eslint-plugin-prettier": "^5.0.0",
|
|
77
|
+
"eslint-plugin-react-native": "^5.0.0",
|
|
78
|
+
"jest": "^29.7.0",
|
|
79
|
+
"lefthook": "^2.0.3",
|
|
80
|
+
"prettier": "^3.0.0",
|
|
81
|
+
"react": "19.1.0",
|
|
82
|
+
"react-native": "0.81.5",
|
|
83
|
+
"react-native-builder-bob": "^0.40.13",
|
|
84
|
+
"react-native-gesture-handler": "^2.16.0",
|
|
85
|
+
"react-native-reanimated": "^3.0.0",
|
|
86
|
+
"react-native-svg": "^12.0.0",
|
|
87
|
+
"release-it": "^19.0.4",
|
|
88
|
+
"typescript": "~5.7.0"
|
|
89
|
+
},
|
|
90
|
+
"peerDependencies": {
|
|
91
|
+
"react": "*",
|
|
92
|
+
"react-native": "*",
|
|
93
|
+
"react-native-gesture-handler": ">=2.0.0",
|
|
94
|
+
"react-native-reanimated": ">=3.0.0",
|
|
95
|
+
"react-native-svg": ">=12.0.0",
|
|
96
|
+
"react-native-worklets": ">=0.3.0"
|
|
97
|
+
},
|
|
98
|
+
"workspaces": [
|
|
99
|
+
"example"
|
|
100
|
+
],
|
|
101
|
+
"packageManager": "yarn@4.11.0",
|
|
102
|
+
"react-native-builder-bob": {
|
|
103
|
+
"source": "src",
|
|
104
|
+
"output": "lib",
|
|
105
|
+
"targets": [
|
|
106
|
+
[
|
|
107
|
+
"module",
|
|
108
|
+
{
|
|
109
|
+
"esm": true
|
|
110
|
+
}
|
|
111
|
+
],
|
|
112
|
+
[
|
|
113
|
+
"typescript",
|
|
114
|
+
{
|
|
115
|
+
"project": "tsconfig.build.json"
|
|
116
|
+
}
|
|
117
|
+
]
|
|
118
|
+
]
|
|
119
|
+
},
|
|
120
|
+
"prettier": {
|
|
121
|
+
"quoteProps": "consistent",
|
|
122
|
+
"singleQuote": true,
|
|
123
|
+
"tabWidth": 2,
|
|
124
|
+
"trailingComma": "es5",
|
|
125
|
+
"useTabs": false
|
|
126
|
+
},
|
|
127
|
+
"jest": {
|
|
128
|
+
"preset": "react-native",
|
|
129
|
+
"modulePathIgnorePatterns": [
|
|
130
|
+
"<rootDir>/example/node_modules",
|
|
131
|
+
"<rootDir>/lib/"
|
|
132
|
+
]
|
|
133
|
+
},
|
|
134
|
+
"commitlint": {
|
|
135
|
+
"extends": [
|
|
136
|
+
"@commitlint/config-conventional"
|
|
137
|
+
]
|
|
138
|
+
},
|
|
139
|
+
"release-it": {
|
|
140
|
+
"git": {
|
|
141
|
+
"commitMessage": "chore: release ${version}",
|
|
142
|
+
"tagName": "v${version}"
|
|
143
|
+
},
|
|
144
|
+
"npm": {
|
|
145
|
+
"publish": true
|
|
146
|
+
},
|
|
147
|
+
"github": {
|
|
148
|
+
"release": true
|
|
149
|
+
},
|
|
150
|
+
"plugins": {
|
|
151
|
+
"@release-it/conventional-changelog": {
|
|
152
|
+
"preset": {
|
|
153
|
+
"name": "angular"
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
},
|
|
158
|
+
"create-react-native-library": {
|
|
159
|
+
"type": "library",
|
|
160
|
+
"languages": "js",
|
|
161
|
+
"tools": [
|
|
162
|
+
"eslint",
|
|
163
|
+
"jest",
|
|
164
|
+
"lefthook",
|
|
165
|
+
"release-it"
|
|
166
|
+
],
|
|
167
|
+
"version": "0.57.0"
|
|
168
|
+
},
|
|
169
|
+
"resolutions": {
|
|
170
|
+
"@types/react": "^19.1.12",
|
|
171
|
+
"typescript": "5.7.3"
|
|
172
|
+
}
|
|
173
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { memo, type ComponentType } from 'react';
|
|
1
|
+
import { memo, type ComponentType, useMemo } from 'react';
|
|
2
2
|
import { StyleSheet, Dimensions } from 'react-native';
|
|
3
3
|
import Svg, { Path } from 'react-native-svg';
|
|
4
4
|
import Animated, {
|
|
@@ -7,6 +7,7 @@ import Animated, {
|
|
|
7
7
|
} from 'react-native-reanimated';
|
|
8
8
|
import { useTour } from '../hooks/useTour';
|
|
9
9
|
import type { InternalTourContextType } from '../types';
|
|
10
|
+
import { DEFAULT_ZONE_STYLE } from '../constants/defaults';
|
|
10
11
|
|
|
11
12
|
const { width: SCREEN_WIDTH, height: SCREEN_HEIGHT } = Dimensions.get('window');
|
|
12
13
|
|
|
@@ -49,11 +50,22 @@ export const TourOverlay = memo(() => {
|
|
|
49
50
|
targetHeight,
|
|
50
51
|
targetRadius,
|
|
51
52
|
opacity,
|
|
53
|
+
zoneBorderWidth,
|
|
52
54
|
config,
|
|
53
55
|
currentStep,
|
|
54
56
|
steps,
|
|
57
|
+
currentZoneStyle,
|
|
55
58
|
} = useTour() as InternalTourContextType;
|
|
56
59
|
|
|
60
|
+
// Get resolved zone style for styling the glow/border
|
|
61
|
+
const zoneStyle = useMemo(() => {
|
|
62
|
+
return {
|
|
63
|
+
...DEFAULT_ZONE_STYLE,
|
|
64
|
+
...config?.zoneStyle,
|
|
65
|
+
...currentZoneStyle,
|
|
66
|
+
};
|
|
67
|
+
}, [config?.zoneStyle, currentZoneStyle]);
|
|
68
|
+
|
|
57
69
|
// Create the d string for the mask
|
|
58
70
|
// Outer rectangle covers the whole screen
|
|
59
71
|
// Inner shape is the "hole"
|
|
@@ -101,7 +113,9 @@ export const TourOverlay = memo(() => {
|
|
|
101
113
|
// - Overlay shouldn't block anything?
|
|
102
114
|
// - pointerEvents='none' on the whole container.
|
|
103
115
|
|
|
104
|
-
|
|
116
|
+
// Check per-step preventInteraction first, then fall back to global config
|
|
117
|
+
const shouldBlockOutside =
|
|
118
|
+
step?.preventInteraction ?? config?.preventInteraction ?? false;
|
|
105
119
|
|
|
106
120
|
// If we don't want to block outside, we just let everything pass.
|
|
107
121
|
// But wait, if we let everything pass, we can't implement 'clickable=false' strictness?
|
|
@@ -125,6 +139,31 @@ export const TourOverlay = memo(() => {
|
|
|
125
139
|
};
|
|
126
140
|
});
|
|
127
141
|
|
|
142
|
+
// Animated style for the zone border/glow ring
|
|
143
|
+
const zoneBorderStyle = useAnimatedStyle(() => {
|
|
144
|
+
const isGlowEnabled = config?.enableGlow === true;
|
|
145
|
+
const borderW = zoneBorderWidth?.value ?? zoneStyle.borderWidth;
|
|
146
|
+
|
|
147
|
+
return {
|
|
148
|
+
position: 'absolute' as const,
|
|
149
|
+
left: targetX.value,
|
|
150
|
+
top: targetY.value,
|
|
151
|
+
width: targetWidth.value,
|
|
152
|
+
height: targetHeight.value,
|
|
153
|
+
borderRadius: targetRadius.value,
|
|
154
|
+
borderWidth: borderW,
|
|
155
|
+
borderColor: zoneStyle.borderColor,
|
|
156
|
+
backgroundColor: 'transparent',
|
|
157
|
+
...(isGlowEnabled && {
|
|
158
|
+
// Glow effect using React Native 0.76+ boxShadow API
|
|
159
|
+
boxShadow: `${zoneStyle.glowOffsetX}px ${zoneStyle.glowOffsetY}px ${zoneStyle.glowRadius}px ${zoneStyle.glowSpread}px ${zoneStyle.glowColor}`,
|
|
160
|
+
}),
|
|
161
|
+
};
|
|
162
|
+
});
|
|
163
|
+
|
|
164
|
+
// Determine if we should show the border/glow
|
|
165
|
+
const showBorder = config?.enableGlow === true || zoneStyle.borderWidth > 0;
|
|
166
|
+
|
|
128
167
|
return (
|
|
129
168
|
<AnimatedView
|
|
130
169
|
pointerEvents={containerPointerEvents}
|
|
@@ -148,6 +187,10 @@ export const TourOverlay = memo(() => {
|
|
|
148
187
|
// backgroundColor="transparent" // Default
|
|
149
188
|
/>
|
|
150
189
|
)}
|
|
190
|
+
{/* Border/Glow ring around the zone */}
|
|
191
|
+
{showBorder && currentStep && (
|
|
192
|
+
<AnimatedView style={zoneBorderStyle} pointerEvents="none" />
|
|
193
|
+
)}
|
|
151
194
|
</AnimatedView>
|
|
152
195
|
);
|
|
153
196
|
});
|