react-native-lumen 1.0.1 → 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.
Files changed (51) hide show
  1. package/README.md +763 -231
  2. package/lib/module/components/TourOverlay.js +43 -3
  3. package/lib/module/components/TourOverlay.js.map +1 -1
  4. package/lib/module/components/TourProvider.js +318 -61
  5. package/lib/module/components/TourProvider.js.map +1 -1
  6. package/lib/module/components/TourTooltip.js +113 -73
  7. package/lib/module/components/TourTooltip.js.map +1 -1
  8. package/lib/module/components/TourZone.js +186 -119
  9. package/lib/module/components/TourZone.js.map +1 -1
  10. package/lib/module/constants/defaults.js +43 -0
  11. package/lib/module/constants/defaults.js.map +1 -1
  12. package/lib/module/context/TourContext.js +5 -0
  13. package/lib/module/context/TourContext.js.map +1 -0
  14. package/lib/module/hooks/useTour.js +1 -1
  15. package/lib/module/hooks/useTour.js.map +1 -1
  16. package/lib/module/hooks/useTourScrollView.js +71 -0
  17. package/lib/module/hooks/useTourScrollView.js.map +1 -0
  18. package/lib/module/index.js +6 -0
  19. package/lib/module/index.js.map +1 -1
  20. package/lib/module/utils/storage.js +188 -0
  21. package/lib/module/utils/storage.js.map +1 -0
  22. package/lib/typescript/src/components/TourOverlay.d.ts.map +1 -1
  23. package/lib/typescript/src/components/TourProvider.d.ts +21 -4
  24. package/lib/typescript/src/components/TourProvider.d.ts.map +1 -1
  25. package/lib/typescript/src/components/TourTooltip.d.ts.map +1 -1
  26. package/lib/typescript/src/components/TourZone.d.ts +19 -1
  27. package/lib/typescript/src/components/TourZone.d.ts.map +1 -1
  28. package/lib/typescript/src/constants/defaults.d.ts +10 -0
  29. package/lib/typescript/src/constants/defaults.d.ts.map +1 -1
  30. package/lib/typescript/src/context/TourContext.d.ts +3 -0
  31. package/lib/typescript/src/context/TourContext.d.ts.map +1 -0
  32. package/lib/typescript/src/hooks/useTourScrollView.d.ts +65 -0
  33. package/lib/typescript/src/hooks/useTourScrollView.d.ts.map +1 -0
  34. package/lib/typescript/src/index.d.ts +4 -0
  35. package/lib/typescript/src/index.d.ts.map +1 -1
  36. package/lib/typescript/src/types/index.d.ts +296 -1
  37. package/lib/typescript/src/types/index.d.ts.map +1 -1
  38. package/lib/typescript/src/utils/storage.d.ts +51 -0
  39. package/lib/typescript/src/utils/storage.d.ts.map +1 -0
  40. package/package.json +173 -171
  41. package/src/components/TourOverlay.tsx +45 -2
  42. package/src/components/TourProvider.tsx +408 -56
  43. package/src/components/TourTooltip.tsx +144 -71
  44. package/src/components/TourZone.tsx +238 -140
  45. package/src/constants/defaults.ts +51 -0
  46. package/src/context/TourContext.ts +4 -0
  47. package/src/hooks/useTour.ts +1 -1
  48. package/src/hooks/useTourScrollView.ts +111 -0
  49. package/src/index.tsx +27 -0
  50. package/src/types/index.ts +306 -1
  51. package/src/utils/storage.ts +226 -0
package/package.json CHANGED
@@ -1,171 +1,173 @@
1
- {
2
- "name": "react-native-lumen",
3
- "version": "1.0.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-prettier": "^5.0.0",
76
- "jest": "^29.7.0",
77
- "lefthook": "^2.0.3",
78
- "prettier": "^3.0.0",
79
- "react": "19.1.0",
80
- "react-native": "0.81.5",
81
- "react-native-builder-bob": "^0.40.13",
82
- "react-native-gesture-handler": "^2.16.0",
83
- "react-native-reanimated": "^3.0.0",
84
- "react-native-svg": "^12.0.0",
85
- "release-it": "^19.0.4",
86
- "typescript": "~5.7.0"
87
- },
88
- "peerDependencies": {
89
- "react": "*",
90
- "react-native": "*",
91
- "react-native-gesture-handler": ">=2.0.0",
92
- "react-native-reanimated": ">=3.0.0",
93
- "react-native-svg": ">=12.0.0",
94
- "react-native-worklets": ">=0.3.0"
95
- },
96
- "workspaces": [
97
- "example"
98
- ],
99
- "packageManager": "yarn@4.11.0",
100
- "react-native-builder-bob": {
101
- "source": "src",
102
- "output": "lib",
103
- "targets": [
104
- [
105
- "module",
106
- {
107
- "esm": true
108
- }
109
- ],
110
- [
111
- "typescript",
112
- {
113
- "project": "tsconfig.build.json"
114
- }
115
- ]
116
- ]
117
- },
118
- "prettier": {
119
- "quoteProps": "consistent",
120
- "singleQuote": true,
121
- "tabWidth": 2,
122
- "trailingComma": "es5",
123
- "useTabs": false
124
- },
125
- "jest": {
126
- "preset": "react-native",
127
- "modulePathIgnorePatterns": [
128
- "<rootDir>/example/node_modules",
129
- "<rootDir>/lib/"
130
- ]
131
- },
132
- "commitlint": {
133
- "extends": [
134
- "@commitlint/config-conventional"
135
- ]
136
- },
137
- "release-it": {
138
- "git": {
139
- "commitMessage": "chore: release ${version}",
140
- "tagName": "v${version}"
141
- },
142
- "npm": {
143
- "publish": true
144
- },
145
- "github": {
146
- "release": true
147
- },
148
- "plugins": {
149
- "@release-it/conventional-changelog": {
150
- "preset": {
151
- "name": "angular"
152
- }
153
- }
154
- }
155
- },
156
- "create-react-native-library": {
157
- "type": "library",
158
- "languages": "js",
159
- "tools": [
160
- "eslint",
161
- "jest",
162
- "lefthook",
163
- "release-it"
164
- ],
165
- "version": "0.57.0"
166
- },
167
- "resolutions": {
168
- "@types/react": "^19.1.12",
169
- "typescript": "5.7.3"
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
- const shouldBlockOutside = config?.preventInteraction ?? false;
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
  });