react-native-tuto-showcase 1.0.0 โ†’ 1.0.1

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 (2) hide show
  1. package/README.md +236 -0
  2. package/package.json +4 -3
package/README.md CHANGED
@@ -0,0 +1,236 @@
1
+ ---
2
+
3
+ # ๐Ÿ“˜ **react-native-tuto-showcase**
4
+
5
+ ### ๐Ÿ”ฆ A fully customizable Spotlight / Tutorial / Coachmark overlay for React Native
6
+
7
+ Perfect for onboarding flows, feature tours, highlighting UI elements, and guiding users interactively.
8
+
9
+ ---
10
+
11
+ # โœจ Features
12
+
13
+ * ๐ŸŽฏ Highlight any UI element using **circle or rounded-rectangle spotlight**
14
+ * ๐Ÿ“ Auto-calculated spotlight position using `measureInWindow`
15
+ * ๐Ÿ” Show once / persistent keys using AsyncStorage
16
+ * ๐ŸŽž Lottie animation support above target
17
+ * ๐Ÿ•ณ Multiple shapes per screen (multi-step tutorial)
18
+ * โœ‹ Gesture hints (swipe left/right, scroll)
19
+ * ๐ŸŽจ Customizable:
20
+
21
+ * Overlay background color
22
+ * Button text, color, style
23
+ * Title & description
24
+ * Lottie size & position
25
+ * ๐Ÿ“ฑ Works on both **iOS & Android**
26
+ * โšก Supports React Native 0.72+
27
+
28
+ ---
29
+
30
+ # ๐Ÿ“ฆ Installation
31
+
32
+ ```sh
33
+ npm install react-native-tuto-showcase
34
+ # or
35
+ yarn add react-native-tuto-showcase
36
+ ```
37
+
38
+ > Make sure you have `react-native-svg` installed (auto-installed as dependency).
39
+
40
+ ---
41
+
42
+ # ๐Ÿš€ Usage Example
43
+
44
+ ### **Highlight a component inside your screen**
45
+
46
+ ```tsx
47
+ import React, { useRef } from 'react';
48
+ import { View, Text, Pressable } from 'react-native';
49
+ import TutoShowcase, { TutoShowcaseHandle } from 'react-native-tuto-showcase';
50
+
51
+ export default function HomeScreen() {
52
+ const tutoRef = useRef<TutoShowcaseHandle>(null);
53
+ const boxRef = useRef<View>(null);
54
+
55
+ return (
56
+ <>
57
+ <TutoShowcase
58
+ ref={tutoRef}
59
+ title={<Text style={{ color: '#fff', fontSize: 22 }}>ุชุฑุชูŠุจ ุงู„ุฃู‚ุณุงู…</Text>}
60
+ description={
61
+ 'ูŠู…ูƒู†ูƒ ุณุญุจ ู‡ุฐุง ุงู„ู‚ุณู… ู„ุฃุนู„ู‰ ุฃูˆ ู„ุฃุณูู„ ู„ุชุบูŠูŠุฑ ุชุฑุชูŠุจู‡ ููŠ ุงู„ุตูุญุฉ.\n' +
62
+ 'ุณูŠุชู… ุญูุธ ุงู„ุชุฑุชูŠุจ ุงู„ุฌุฏูŠุฏ ุชู„ู‚ุงุฆูŠู‹ุง.'
63
+ }
64
+ buttonText="ุชู…ุงู…"
65
+ overlayBackgroundColor="rgba(0,0,0,0.85)"
66
+ buttonContainerStyle={{ backgroundColor: '#ff9800' }}
67
+ buttonTextStyle={{ color: '#000', fontWeight: 'bold' }}
68
+ />
69
+
70
+ <View ref={boxRef} style={{ marginTop: 100, backgroundColor: '#eee', padding: 20 }}>
71
+ <Text>Drag Me</Text>
72
+ </View>
73
+
74
+ <Pressable
75
+ onPress={() => {
76
+ tutoRef.current
77
+ ?.on(boxRef)
78
+ .addRoundRect()
79
+ .withBorder()
80
+ .showOnce('highlight-box');
81
+ }}>
82
+ <Text>Start Tutorial</Text>
83
+ </Pressable>
84
+ </>
85
+ );
86
+ }
87
+ ```
88
+
89
+ ---
90
+
91
+ # ๐Ÿงฉ API Documentation
92
+
93
+ ## `<TutoShowcase />` Props
94
+
95
+ | Prop | Type | Default | Description |
96
+ | ------------------------ | --------------------- | ------------------ | ---------------------------------- |
97
+ | `title` | `ReactNode` | โ€” | Title element (supports JSX & RTL) |
98
+ | `description` | `string \| ReactNode` | โ€” | Description text |
99
+ | `buttonText` | `string` | `"GOT IT"` | CTA button label |
100
+ | `buttonTextStyle` | `TextStyle` | โ€” | Custom style for CTA text |
101
+ | `buttonContainerStyle` | `ViewStyle` | โ€” | Custom style for CTA container |
102
+ | `overlayBackgroundColor` | `string` | `rgba(0,0,0,0.78)` | Background dim color |
103
+ | `onGotIt` | `() => void` | โ€” | Called when user presses CTA |
104
+ | `lottie` | `ReactElement` | โ€” | Lottie animation above target |
105
+
106
+ ---
107
+
108
+ # ๐ŸŽ› Ref API (Controller)
109
+
110
+ Returned via:
111
+
112
+ ```ts
113
+ const tutoRef = useRef<TutoShowcaseHandle>(null);
114
+ ```
115
+
116
+ Then:
117
+
118
+ ```ts
119
+ tutoRef.current?.on(targetRef)
120
+ ```
121
+
122
+ ### Methods
123
+
124
+ | Method | Description |
125
+ | -------------------------------------- | -------------------------------------------- |
126
+ | `on(ref)` | Select target element |
127
+ | `show()` | Show the spotlight |
128
+ | `dismiss()` | Hide the overlay |
129
+ | `addCircle(ratio?)` | Add circle spotlight |
130
+ | `addRoundRect(ratio?, radius?, opts?)` | Add rounded-rect spotlight |
131
+ | `displaySwipableLeft()` | Show left gesture hint |
132
+ | `displaySwipableRight()` | Show right gesture hint |
133
+ | `displayScrollable()` | Show scroll gesture hint |
134
+ | `withBorder()` | Add border around spotlight |
135
+ | `onClick(cb)` | Make spotlight clickable |
136
+ | `showOnce(key)` | Show once only (persistent via AsyncStorage) |
137
+ | `resetShowOnce(key)` | Clear โ€œshow onceโ€ key |
138
+ | `isShowOnce(key)` | Check stored key |
139
+
140
+ ---
141
+
142
+ # ๐ŸŽฌ Lottie Support
143
+
144
+ ```tsx
145
+ <TutoShowcase
146
+ ref={tutoRef}
147
+ lottie={
148
+ <LottieView
149
+ source={require('./hand.json')}
150
+ style={{ width: 120, height: 120 }}
151
+ autoPlay
152
+ loop
153
+ />
154
+ }
155
+ />
156
+ ```
157
+
158
+ Lottie will automatically be positioned above the target highlight.
159
+
160
+ ---
161
+
162
+ # ๐ŸŽจ Customizing Button Style
163
+
164
+ ```tsx
165
+ <TutoShowcase
166
+ buttonContainerStyle={{
167
+ backgroundColor: '#FFD700',
168
+ paddingVertical: 10,
169
+ borderRadius: 8,
170
+ }}
171
+ buttonTextStyle={{
172
+ color: '#000',
173
+ fontWeight: 'bold',
174
+ }}
175
+ />
176
+ ```
177
+
178
+ ---
179
+
180
+ # โš™ Spotlight Shape Options
181
+
182
+ ### Circle Spotlight
183
+
184
+ ```ts
185
+ .on(ref)
186
+ .addCircle(1.2) // ratio
187
+ .show()
188
+ ```
189
+
190
+ ### Rounded Rectangle Spotlight
191
+
192
+ ```ts
193
+ .on(ref)
194
+ .addRoundRect(1.1, 20, { pad: 30, dx: 0, dy: 0 })
195
+ .show()
196
+ ```
197
+
198
+ ---
199
+
200
+ # ๐Ÿ—‚ Show Once Logic
201
+
202
+ ```ts
203
+ tutoRef.current
204
+ ?.on(someRef)
205
+ .addCircle()
206
+ .showOnce('home-feature');
207
+ ```
208
+
209
+ Key stored automatically in AsyncStorage โ†’ wonโ€™t show again.
210
+
211
+ ---
212
+
213
+ # ๐Ÿ“ฆ TypeScript Support
214
+
215
+ Bundled `.d.ts` typings included automatically:
216
+
217
+ ```ts
218
+ import type { TutoShowcaseHandle } from 'react-native-tuto-showcase';
219
+ ```
220
+
221
+ ---
222
+
223
+ # ๐Ÿ“ Important Notes
224
+
225
+ * Must wrap elements you spotlight with a `ref`
226
+ * Uses `measureInWindow` โ†’ works inside ScrollView, Tabs, Modals, etc.
227
+ * Overlay is drawn using **react-native-svg**
228
+ * Fully RTL-compatible
229
+
230
+ ---
231
+
232
+ # ๐Ÿ“ License
233
+
234
+ MIT ยฉ **Ahmed Mohamed Ali Ali Hegazy**
235
+
236
+ ---
package/package.json CHANGED
@@ -1,11 +1,13 @@
1
1
  {
2
2
  "name": "react-native-tuto-showcase",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "description": "Customizable tutorial / spotlight overlay for React Native (onboarding, feature tours, coachmarks).",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
7
7
  "source": "src/index.tsx",
8
- "files": ["dist"],
8
+ "files": [
9
+ "dist"
10
+ ],
9
11
  "scripts": {
10
12
  "build": "tsc"
11
13
  },
@@ -34,5 +36,4 @@
34
36
  "@types/react-native": "^0.72.8",
35
37
  "typescript": "^5.9.3"
36
38
  }
37
-
38
39
  }