@campxdev/react-native-blueprint 0.1.7 → 0.1.9
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 +111 -69
- package/package.json +15 -6
package/README.md
CHANGED
|
@@ -105,7 +105,9 @@ module.exports = {
|
|
|
105
105
|
};
|
|
106
106
|
```
|
|
107
107
|
|
|
108
|
-
### 5. Configure Metro
|
|
108
|
+
### 5. Configure Bundler (Metro or Re.Pack)
|
|
109
|
+
|
|
110
|
+
**Option A: Metro (Standard)**
|
|
109
111
|
|
|
110
112
|
Update `metro.config.js`:
|
|
111
113
|
|
|
@@ -118,6 +120,39 @@ const config = getDefaultConfig(__dirname);
|
|
|
118
120
|
module.exports = withNativeWind(config, { input: './global.css' });
|
|
119
121
|
```
|
|
120
122
|
|
|
123
|
+
**Option B: Re.Pack + Rspack (5x Faster - Used in Example App)**
|
|
124
|
+
|
|
125
|
+
The example app in this repository uses [Re.Pack 5](https://re-pack.dev) with Rspack for **5x faster builds**. See [MIGRATION_REPACK.md](MIGRATION_REPACK.md) for details.
|
|
126
|
+
|
|
127
|
+
If you want to use Re.Pack in your project:
|
|
128
|
+
|
|
129
|
+
1. Install Re.Pack:
|
|
130
|
+
|
|
131
|
+
```sh
|
|
132
|
+
npx @callstack/repack-init
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
2. Install NativeWind plugin:
|
|
136
|
+
|
|
137
|
+
```sh
|
|
138
|
+
npm install @callstack/repack-plugin-nativewind
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
3. Update `rspack.config.js`:
|
|
142
|
+
|
|
143
|
+
```js
|
|
144
|
+
import { NativeWindPlugin } from '@callstack/repack-plugin-nativewind';
|
|
145
|
+
|
|
146
|
+
export default (env) => ({
|
|
147
|
+
// ... other config
|
|
148
|
+
plugins: [
|
|
149
|
+
new NativeWindPlugin({
|
|
150
|
+
input: './global.css',
|
|
151
|
+
}),
|
|
152
|
+
],
|
|
153
|
+
});
|
|
154
|
+
```
|
|
155
|
+
|
|
121
156
|
## Usage
|
|
122
157
|
|
|
123
158
|
### Basic Example
|
|
@@ -126,7 +161,13 @@ module.exports = withNativeWind(config, { input: './global.css' });
|
|
|
126
161
|
// Import CSS at the top of your app entry point (do this ONCE)
|
|
127
162
|
import '@campxdev/react-native-blueprint/global.css';
|
|
128
163
|
|
|
129
|
-
import {
|
|
164
|
+
import {
|
|
165
|
+
Button,
|
|
166
|
+
Card,
|
|
167
|
+
Text,
|
|
168
|
+
Input,
|
|
169
|
+
Alert,
|
|
170
|
+
} from '@campxdev/react-native-blueprint';
|
|
130
171
|
import { View } from 'react-native';
|
|
131
172
|
|
|
132
173
|
function App() {
|
|
@@ -135,7 +176,9 @@ function App() {
|
|
|
135
176
|
<Card>
|
|
136
177
|
<Card.Header>
|
|
137
178
|
<Card.Title>Welcome</Card.Title>
|
|
138
|
-
<Card.Description>
|
|
179
|
+
<Card.Description>
|
|
180
|
+
Get started with react-native-blueprint
|
|
181
|
+
</Card.Description>
|
|
139
182
|
</Card.Header>
|
|
140
183
|
<Card.Content>
|
|
141
184
|
<Input placeholder="Enter your name" />
|
|
@@ -149,9 +192,7 @@ function App() {
|
|
|
149
192
|
|
|
150
193
|
<Alert>
|
|
151
194
|
<Alert.Title>Info</Alert.Title>
|
|
152
|
-
<Alert.Description>
|
|
153
|
-
This is a sample alert component.
|
|
154
|
-
</Alert.Description>
|
|
195
|
+
<Alert.Description>This is a sample alert component.</Alert.Description>
|
|
155
196
|
</Alert>
|
|
156
197
|
</View>
|
|
157
198
|
);
|
|
@@ -161,12 +202,14 @@ function App() {
|
|
|
161
202
|
## Available Components
|
|
162
203
|
|
|
163
204
|
### Layout & Structure
|
|
205
|
+
|
|
164
206
|
- **Button** - Customizable button with variants (default, destructive, outline, ghost, link)
|
|
165
207
|
- **Card** - Container with header, content, and footer sections
|
|
166
208
|
- **Separator** - Horizontal or vertical divider
|
|
167
209
|
- **Skeleton** - Loading placeholder with shimmer effect
|
|
168
210
|
|
|
169
211
|
### Form Components
|
|
212
|
+
|
|
170
213
|
- **Input** - Text input field
|
|
171
214
|
- **Textarea** - Multi-line text input
|
|
172
215
|
- **Checkbox** - Checkbox with label support
|
|
@@ -177,12 +220,14 @@ function App() {
|
|
|
177
220
|
- **Slider** - Range slider input
|
|
178
221
|
|
|
179
222
|
### Navigation
|
|
223
|
+
|
|
180
224
|
- **Tabs** - Tab navigation component
|
|
181
225
|
- **Accordion** - Collapsible content sections
|
|
182
226
|
- **Collapsible** - Expandable/collapsible content
|
|
183
227
|
- **Menubar** - Menu bar with nested items
|
|
184
228
|
|
|
185
229
|
### Overlays & Dialogs
|
|
230
|
+
|
|
186
231
|
- **Dialog** - Modal dialog
|
|
187
232
|
- **Alert Dialog** - Alert/confirmation dialog
|
|
188
233
|
- **Popover** - Floating popover
|
|
@@ -192,18 +237,21 @@ function App() {
|
|
|
192
237
|
- **Hover Card** - Card that appears on hover
|
|
193
238
|
|
|
194
239
|
### Feedback & Status
|
|
240
|
+
|
|
195
241
|
- **Alert** - Informational alert box
|
|
196
242
|
- **Toast** - Toast notification
|
|
197
243
|
- **Progress** - Progress bar
|
|
198
244
|
- **Badge** - Status badge
|
|
199
245
|
|
|
200
246
|
### Data Display
|
|
247
|
+
|
|
201
248
|
- **Table** - Data table with sorting
|
|
202
249
|
- **Avatar** - User avatar with fallback
|
|
203
250
|
- **Text** - Typography component with variants
|
|
204
251
|
- **Icon** - Icon component (powered by lucide-react-native)
|
|
205
252
|
|
|
206
253
|
### Utilities
|
|
254
|
+
|
|
207
255
|
- **Aspect Ratio** - Container with fixed aspect ratio
|
|
208
256
|
- **Toggle** - Toggle button
|
|
209
257
|
- **Toggle Group** - Group of toggle buttons
|
|
@@ -214,10 +262,10 @@ Components use CSS variables for theming. Customize your app's appearance by mod
|
|
|
214
262
|
|
|
215
263
|
```css
|
|
216
264
|
:root {
|
|
217
|
-
--primary: 220 90% 56%;
|
|
218
|
-
--secondary: 280 70% 60%;
|
|
219
|
-
--destructive: 0 84% 60%;
|
|
220
|
-
--radius: 0.75rem;
|
|
265
|
+
--primary: 220 90% 56%; /* Blue */
|
|
266
|
+
--secondary: 280 70% 60%; /* Purple */
|
|
267
|
+
--destructive: 0 84% 60%; /* Red */
|
|
268
|
+
--radius: 0.75rem; /* Border radius */
|
|
221
269
|
}
|
|
222
270
|
```
|
|
223
271
|
|
|
@@ -241,15 +289,41 @@ function App() {
|
|
|
241
289
|
|
|
242
290
|
## Example App
|
|
243
291
|
|
|
244
|
-
Check out the `/example` directory for a complete demo app showcasing all components
|
|
292
|
+
Check out the `/example` directory for a complete demo app showcasing all components with **Storybook integration** and **Re.Pack + Rspack** for 5x faster builds.
|
|
293
|
+
|
|
294
|
+
### Run Normal App Mode
|
|
245
295
|
|
|
246
296
|
```sh
|
|
297
|
+
yarn example:app # From root (recommended)
|
|
298
|
+
# or
|
|
247
299
|
cd example
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
npm run android # Run on Android emulator
|
|
300
|
+
yarn app:ios # Run on iOS simulator
|
|
301
|
+
yarn app:android # Run on Android emulator
|
|
251
302
|
```
|
|
252
303
|
|
|
304
|
+
### Run Storybook Mode
|
|
305
|
+
|
|
306
|
+
The example app includes 16 interactive component stories using [Storybook for React Native](https://storybook.js.org/tutorials/intro-to-storybook/react-native/):
|
|
307
|
+
|
|
308
|
+
```sh
|
|
309
|
+
yarn example:storybook # From root (recommended)
|
|
310
|
+
# or
|
|
311
|
+
cd example
|
|
312
|
+
yarn storybook:ios # Run Storybook on iOS
|
|
313
|
+
yarn storybook:android # Run Storybook on Android
|
|
314
|
+
```
|
|
315
|
+
|
|
316
|
+
### Build Performance
|
|
317
|
+
|
|
318
|
+
The example app uses **Re.Pack 5 + Rspack** instead of Metro for:
|
|
319
|
+
|
|
320
|
+
- ⚡ **5x faster cold builds**
|
|
321
|
+
- ⚡ **5x faster hot module reload (HMR)**
|
|
322
|
+
- 📦 **Zero package duplications**
|
|
323
|
+
- 🎨 **Full NativeWind support**
|
|
324
|
+
|
|
325
|
+
See [MIGRATION_REPACK.md](MIGRATION_REPACK.md) for complete migration details and architecture.
|
|
326
|
+
|
|
253
327
|
## TypeScript Support
|
|
254
328
|
|
|
255
329
|
All components are fully typed with TypeScript. Import types as needed:
|
|
@@ -263,6 +337,7 @@ import type { ButtonProps, CardProps } from '@campxdev/react-native-blueprint';
|
|
|
263
337
|
### "Cannot find module '@campxdev/react-native-blueprint/global.css'"
|
|
264
338
|
|
|
265
339
|
Make sure you've:
|
|
340
|
+
|
|
266
341
|
1. Installed NativeWind: `npm install nativewind tailwindcss`
|
|
267
342
|
2. Configured Metro with NativeWind plugin (see Installation Step 5)
|
|
268
343
|
3. Imported the CSS in your app entry point
|
|
@@ -340,6 +415,7 @@ Contributions are welcome! Please follow these steps:
|
|
|
340
415
|
### Development Workflow
|
|
341
416
|
|
|
342
417
|
1. Clone the repo and install dependencies:
|
|
418
|
+
|
|
343
419
|
```sh
|
|
344
420
|
git clone https://github.com/campx-org/react-native-blueprint.git
|
|
345
421
|
cd react-native-blueprint
|
|
@@ -347,15 +423,27 @@ Contributions are welcome! Please follow these steps:
|
|
|
347
423
|
```
|
|
348
424
|
|
|
349
425
|
2. Run the example app:
|
|
426
|
+
|
|
427
|
+
**Normal App Mode:**
|
|
428
|
+
|
|
350
429
|
```sh
|
|
351
|
-
yarn example
|
|
352
|
-
#
|
|
353
|
-
|
|
430
|
+
yarn example:app # Start dev server
|
|
431
|
+
cd example && yarn app:ios # Or run on iOS
|
|
432
|
+
cd example && yarn app:android # Or run on Android
|
|
433
|
+
```
|
|
434
|
+
|
|
435
|
+
**Storybook Mode (Component Library):**
|
|
436
|
+
|
|
437
|
+
```sh
|
|
438
|
+
yarn example:storybook # Start Storybook
|
|
439
|
+
cd example && yarn storybook:ios # Or run on iOS
|
|
440
|
+
cd example && yarn storybook:android # Or run on Android
|
|
354
441
|
```
|
|
355
442
|
|
|
356
443
|
3. Make your changes in `/src`
|
|
357
444
|
|
|
358
445
|
4. Run type checking and linting:
|
|
446
|
+
|
|
359
447
|
```sh
|
|
360
448
|
yarn typecheck
|
|
361
449
|
yarn lint
|
|
@@ -366,60 +454,14 @@ Contributions are welcome! Please follow these steps:
|
|
|
366
454
|
yarn prepare
|
|
367
455
|
```
|
|
368
456
|
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
For maintainers who need to publish new versions of the package, we provide a comprehensive automated script.
|
|
372
|
-
|
|
373
|
-
### Publishing Script
|
|
374
|
-
|
|
375
|
-
The [publish.sh](scripts/publish.sh) script handles the entire publishing workflow with comprehensive error handling.
|
|
376
|
-
|
|
377
|
-
#### What it does:
|
|
378
|
-
|
|
379
|
-
1. **Cleans cache** - Removes `node_modules`, `lib`, and clears yarn cache
|
|
380
|
-
2. **Installs dependencies** - Runs `yarn install` to ensure everything is up to date
|
|
381
|
-
3. **Checks CLI tools** - Verifies React Native CLI and Reusables CLI availability
|
|
382
|
-
4. **Builds the library** - Runs `yarn prepare` (bob build) - *Note: TypeScript typecheck is skipped due to className issues*
|
|
383
|
-
5. **Verifies build outputs** - Ensures type declarations, source files, and module outputs are correctly generated
|
|
384
|
-
6. **Increments version** - Interactive prompts for patch/minor/major/custom version increments
|
|
385
|
-
7. **Git operations** - Commits changes with proper message and pushes to remote
|
|
386
|
-
8. **Publishes to npm** - Publishes the package with confirmation prompt
|
|
387
|
-
|
|
388
|
-
#### Usage:
|
|
389
|
-
|
|
390
|
-
```sh
|
|
391
|
-
# Run directly
|
|
392
|
-
./scripts/publish.sh
|
|
393
|
-
|
|
394
|
-
# Or via yarn
|
|
395
|
-
yarn publish-package
|
|
396
|
-
```
|
|
397
|
-
|
|
398
|
-
#### Prerequisites:
|
|
399
|
-
|
|
400
|
-
- Node.js and yarn installed
|
|
401
|
-
- Git configured with credentials
|
|
402
|
-
- Logged in to npm (`npm login`)
|
|
403
|
-
- Publish permissions for the `@campxdev` scope
|
|
404
|
-
|
|
405
|
-
#### Error Handling:
|
|
406
|
-
|
|
407
|
-
The script provides detailed error messages and resolution steps for common failures:
|
|
408
|
-
|
|
409
|
-
- **Cache/Install Issues** - Guides on cleaning and reinstalling dependencies
|
|
410
|
-
- **CLI Missing** - Instructions to install required CLI tools
|
|
411
|
-
- **Build Failures** - Steps to debug bob build issues
|
|
412
|
-
- **Git Issues** - Help with credentials, permissions, and branch management
|
|
413
|
-
- **NPM Issues** - Authentication and publish permission troubleshooting
|
|
414
|
-
|
|
415
|
-
#### Important Notes:
|
|
457
|
+
### Example App Tech Stack
|
|
416
458
|
|
|
417
|
-
|
|
418
|
-
- Manual confirmation is required before publishing to prevent accidents
|
|
419
|
-
- Commits are made with the configured git user (should be satya@campx.in)
|
|
420
|
-
- The script pushes to your current branch - ensure you're on the correct branch
|
|
459
|
+
The example app showcases modern React Native development with:
|
|
421
460
|
|
|
422
|
-
|
|
461
|
+
- **Re.Pack 5 + Rspack** - 5x faster than Metro bundler
|
|
462
|
+
- **Storybook React Native** - Interactive component development
|
|
463
|
+
- **NativeWind v4** - Tailwind CSS for React Native
|
|
464
|
+
- **Command-based mode switching** - Easy switching between app and Storybook modes
|
|
423
465
|
|
|
424
466
|
## License
|
|
425
467
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@campxdev/react-native-blueprint",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.9",
|
|
4
4
|
"description": "This is a react-native package for mobile apps",
|
|
5
5
|
"main": "./lib/module/index.js",
|
|
6
6
|
"types": "./lib/typescript/src/index.d.ts",
|
|
@@ -35,15 +35,16 @@
|
|
|
35
35
|
],
|
|
36
36
|
"scripts": {
|
|
37
37
|
"example": "yarn workspace react-native-blueprint-example",
|
|
38
|
+
"example:app": "yarn example app",
|
|
39
|
+
"example:storybook": "yarn example storybook",
|
|
38
40
|
"test": "jest",
|
|
39
41
|
"typecheck": "tsc",
|
|
40
42
|
"lint": "eslint \"**/*.{js,ts,tsx}\"",
|
|
41
43
|
"clean": "del-cli lib",
|
|
44
|
+
"clean:all": "rm -rf node_modules example/node_modules && yarn install",
|
|
42
45
|
"prepare": "bob build",
|
|
43
46
|
"release": "release-it --only-version",
|
|
44
|
-
"publish-package": "./scripts/publish.sh"
|
|
45
|
-
"android": "expo run:android",
|
|
46
|
-
"ios": "expo run:ios"
|
|
47
|
+
"publish-package": "./scripts/publish.sh"
|
|
47
48
|
},
|
|
48
49
|
"keywords": [
|
|
49
50
|
"react-native",
|
|
@@ -103,6 +104,16 @@
|
|
|
103
104
|
"example"
|
|
104
105
|
],
|
|
105
106
|
"packageManager": "yarn@3.6.1",
|
|
107
|
+
"resolutions": {
|
|
108
|
+
"react": "19.1.0",
|
|
109
|
+
"react-dom": "19.1.0",
|
|
110
|
+
"react-native": "0.81.4",
|
|
111
|
+
"nativewind": "4.2.1",
|
|
112
|
+
"tailwindcss": "3.4.17",
|
|
113
|
+
"tailwindcss-animate": "1.0.7",
|
|
114
|
+
"@rspack/core": "1.5.8",
|
|
115
|
+
"@babel/core": "^7.28.4"
|
|
116
|
+
},
|
|
106
117
|
"jest": {
|
|
107
118
|
"preset": "react-native",
|
|
108
119
|
"modulePathIgnorePatterns": [
|
|
@@ -202,8 +213,6 @@
|
|
|
202
213
|
"expo-font": "^14.0.9",
|
|
203
214
|
"figma-squircle": "^1.1.0",
|
|
204
215
|
"lucide-react-native": "^0.546.0",
|
|
205
|
-
"react": "19.1.0",
|
|
206
|
-
"react-native": "0.81.4",
|
|
207
216
|
"react-native-figma-squircle": "^0.4.0",
|
|
208
217
|
"react-native-floating-action": "^1.22.0",
|
|
209
218
|
"react-native-gesture-handler": "^2.28.0",
|