react-native-demo-library-by-rinkal 1.2.7 → 1.3.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/ARCHITECTURE_DIAGRAMS.md +473 -0
- package/COMMUNICATION_DOCS.md +336 -0
- package/CONTAINER_APP_SETUP.md +360 -0
- package/CommunicationExample.tsx +247 -0
- package/ContainerCommunication.ts +91 -0
- package/IMPLEMENTATION_SUMMARY.md +385 -0
- package/INDEX.md +333 -0
- package/MiniAppCommunication.ts +71 -0
- package/OFFICIAL_REFERENCES.md +278 -0
- package/QUICK_REFERENCE.md +298 -0
- package/Readme.md +514 -3
- package/SUMMARY.md +305 -0
- package/TaskCard.tsx +25 -8
- package/index.ts +15 -1
- package/package.json +16 -2
package/INDEX.md
ADDED
|
@@ -0,0 +1,333 @@
|
|
|
1
|
+
# 📚 Complete Documentation Index
|
|
2
|
+
|
|
3
|
+
Welcome to the **React Native MiniApp-Container Communication Library**!
|
|
4
|
+
|
|
5
|
+
This index helps you navigate all documentation and find exactly what you need.
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## 🎯 Start Here
|
|
10
|
+
|
|
11
|
+
### For Quick Start
|
|
12
|
+
1. **[QUICK_REFERENCE.md](./QUICK_REFERENCE.md)** ⚡
|
|
13
|
+
- 30-second quick start
|
|
14
|
+
- Code snippets for all 6 patterns
|
|
15
|
+
- Common operations cheat sheet
|
|
16
|
+
- **Start here if you want to get coding immediately**
|
|
17
|
+
|
|
18
|
+
### For Complete Understanding
|
|
19
|
+
2. **[Readme.md](./Readme.md)** 📖
|
|
20
|
+
- Project overview
|
|
21
|
+
- Installation guide
|
|
22
|
+
- Feature list
|
|
23
|
+
- API reference
|
|
24
|
+
- **Start here for comprehensive overview**
|
|
25
|
+
|
|
26
|
+
---
|
|
27
|
+
|
|
28
|
+
## 📂 Core Implementation Files
|
|
29
|
+
|
|
30
|
+
### MiniApp Side
|
|
31
|
+
- **[MiniAppCommunication.ts](./MiniAppCommunication.ts)** 💻
|
|
32
|
+
- Complete implementation for miniapp
|
|
33
|
+
- 6 communication patterns
|
|
34
|
+
- Unified API interface
|
|
35
|
+
- ~400 lines of code
|
|
36
|
+
|
|
37
|
+
### Container Side
|
|
38
|
+
- **[ContainerCommunication.ts](./ContainerCommunication.ts)** 💻
|
|
39
|
+
- Complete implementation for container
|
|
40
|
+
- Request handlers
|
|
41
|
+
- State management
|
|
42
|
+
- Event listeners
|
|
43
|
+
- ~300 lines of code
|
|
44
|
+
|
|
45
|
+
### Examples
|
|
46
|
+
- **[CommunicationExample.tsx](./CommunicationExample.tsx)** 🎨
|
|
47
|
+
- Working React components
|
|
48
|
+
- MiniApp example component
|
|
49
|
+
- Container example component
|
|
50
|
+
- Real-world usage patterns
|
|
51
|
+
- ~350 lines of code
|
|
52
|
+
|
|
53
|
+
### Exports
|
|
54
|
+
- **[index.ts](./index.ts)** 📦
|
|
55
|
+
- Main export file
|
|
56
|
+
- All public APIs
|
|
57
|
+
- Component exports
|
|
58
|
+
|
|
59
|
+
---
|
|
60
|
+
|
|
61
|
+
## 📚 Documentation Files
|
|
62
|
+
|
|
63
|
+
### Main Documentation
|
|
64
|
+
| File | Purpose | Length | Audience |
|
|
65
|
+
|------|---------|--------|----------|
|
|
66
|
+
| [Readme.md](./Readme.md) | Main documentation | ~300 lines | Everyone |
|
|
67
|
+
| [QUICK_REFERENCE.md](./QUICK_REFERENCE.md) | Quick start guide | ~250 lines | Developers |
|
|
68
|
+
| [COMMUNICATION_DOCS.md](./COMMUNICATION_DOCS.md) | Complete guide | ~400 lines | Developers |
|
|
69
|
+
| [OFFICIAL_REFERENCES.md](./OFFICIAL_REFERENCES.md) | All official docs | ~350 lines | Researchers |
|
|
70
|
+
| [ARCHITECTURE_DIAGRAMS.md](./ARCHITECTURE_DIAGRAMS.md) | Visual diagrams | ~450 lines | Architects |
|
|
71
|
+
| [SUMMARY.md](./SUMMARY.md) | Implementation summary | ~300 lines | Project managers |
|
|
72
|
+
| [INDEX.md](./INDEX.md) | This file | ~150 lines | Everyone |
|
|
73
|
+
|
|
74
|
+
---
|
|
75
|
+
|
|
76
|
+
## 🎓 By Use Case
|
|
77
|
+
|
|
78
|
+
### "I want to start coding immediately"
|
|
79
|
+
→ [QUICK_REFERENCE.md](./QUICK_REFERENCE.md)
|
|
80
|
+
|
|
81
|
+
### "I need to understand all patterns"
|
|
82
|
+
→ [COMMUNICATION_DOCS.md](./COMMUNICATION_DOCS.md)
|
|
83
|
+
|
|
84
|
+
### "I want to see working examples"
|
|
85
|
+
→ [CommunicationExample.tsx](./CommunicationExample.tsx)
|
|
86
|
+
|
|
87
|
+
### "I need official documentation sources"
|
|
88
|
+
→ [OFFICIAL_REFERENCES.md](./OFFICIAL_REFERENCES.md)
|
|
89
|
+
|
|
90
|
+
### "I want to understand the architecture"
|
|
91
|
+
→ [ARCHITECTURE_DIAGRAMS.md](./ARCHITECTURE_DIAGRAMS.md)
|
|
92
|
+
|
|
93
|
+
### "I need a project overview"
|
|
94
|
+
→ [Readme.md](./Readme.md)
|
|
95
|
+
|
|
96
|
+
### "I want implementation details"
|
|
97
|
+
→ [SUMMARY.md](./SUMMARY.md)
|
|
98
|
+
|
|
99
|
+
---
|
|
100
|
+
|
|
101
|
+
## 🔍 By Topic
|
|
102
|
+
|
|
103
|
+
### Installation & Setup
|
|
104
|
+
- [Readme.md](./Readme.md) - Installation section
|
|
105
|
+
- [QUICK_REFERENCE.md](./QUICK_REFERENCE.md) - Quick start
|
|
106
|
+
|
|
107
|
+
### Communication Patterns
|
|
108
|
+
- [COMMUNICATION_DOCS.md](./COMMUNICATION_DOCS.md) - All 6 patterns detailed
|
|
109
|
+
- [QUICK_REFERENCE.md](./QUICK_REFERENCE.md) - Pattern cheat sheet
|
|
110
|
+
- [ARCHITECTURE_DIAGRAMS.md](./ARCHITECTURE_DIAGRAMS.md) - Flow diagrams
|
|
111
|
+
|
|
112
|
+
### API Reference
|
|
113
|
+
- [Readme.md](./Readme.md) - API reference section
|
|
114
|
+
- [COMMUNICATION_DOCS.md](./COMMUNICATION_DOCS.md) - Usage examples
|
|
115
|
+
|
|
116
|
+
### Code Examples
|
|
117
|
+
- [CommunicationExample.tsx](./CommunicationExample.tsx) - React components
|
|
118
|
+
- [QUICK_REFERENCE.md](./QUICK_REFERENCE.md) - Code snippets
|
|
119
|
+
- [COMMUNICATION_DOCS.md](./COMMUNICATION_DOCS.md) - Pattern examples
|
|
120
|
+
|
|
121
|
+
### Official Documentation
|
|
122
|
+
- [OFFICIAL_REFERENCES.md](./OFFICIAL_REFERENCES.md) - 50+ official links
|
|
123
|
+
- Each implementation file - Inline references
|
|
124
|
+
|
|
125
|
+
### Architecture & Design
|
|
126
|
+
- [ARCHITECTURE_DIAGRAMS.md](./ARCHITECTURE_DIAGRAMS.md) - Visual diagrams
|
|
127
|
+
- [SUMMARY.md](./SUMMARY.md) - Architecture overview
|
|
128
|
+
- [Readme.md](./Readme.md) - Architecture section
|
|
129
|
+
|
|
130
|
+
### Troubleshooting
|
|
131
|
+
- [COMMUNICATION_DOCS.md](./COMMUNICATION_DOCS.md) - Troubleshooting section
|
|
132
|
+
- [QUICK_REFERENCE.md](./QUICK_REFERENCE.md) - Common issues
|
|
133
|
+
|
|
134
|
+
---
|
|
135
|
+
|
|
136
|
+
## 📖 Reading Paths
|
|
137
|
+
|
|
138
|
+
### Path 1: Quick Implementation (15 minutes)
|
|
139
|
+
1. [QUICK_REFERENCE.md](./QUICK_REFERENCE.md) - Understand patterns (5 min)
|
|
140
|
+
2. [CommunicationExample.tsx](./CommunicationExample.tsx) - See examples (5 min)
|
|
141
|
+
3. Start coding! (5 min)
|
|
142
|
+
|
|
143
|
+
### Path 2: Complete Understanding (1 hour)
|
|
144
|
+
1. [Readme.md](./Readme.md) - Overview (10 min)
|
|
145
|
+
2. [COMMUNICATION_DOCS.md](./COMMUNICATION_DOCS.md) - All patterns (20 min)
|
|
146
|
+
3. [ARCHITECTURE_DIAGRAMS.md](./ARCHITECTURE_DIAGRAMS.md) - Visualize (15 min)
|
|
147
|
+
4. [CommunicationExample.tsx](./CommunicationExample.tsx) - Examples (15 min)
|
|
148
|
+
|
|
149
|
+
### Path 3: Research & Reference (2 hours)
|
|
150
|
+
1. [SUMMARY.md](./SUMMARY.md) - Implementation overview (15 min)
|
|
151
|
+
2. [OFFICIAL_REFERENCES.md](./OFFICIAL_REFERENCES.md) - Official docs (30 min)
|
|
152
|
+
3. [MiniAppCommunication.ts](./MiniAppCommunication.ts) - Code review (30 min)
|
|
153
|
+
4. [ContainerCommunication.ts](./ContainerCommunication.ts) - Code review (30 min)
|
|
154
|
+
5. [ARCHITECTURE_DIAGRAMS.md](./ARCHITECTURE_DIAGRAMS.md) - Deep dive (15 min)
|
|
155
|
+
|
|
156
|
+
---
|
|
157
|
+
|
|
158
|
+
## 🎯 By Role
|
|
159
|
+
|
|
160
|
+
### Frontend Developer
|
|
161
|
+
1. [QUICK_REFERENCE.md](./QUICK_REFERENCE.md) - Quick start
|
|
162
|
+
2. [CommunicationExample.tsx](./CommunicationExample.tsx) - Examples
|
|
163
|
+
3. [COMMUNICATION_DOCS.md](./COMMUNICATION_DOCS.md) - Pattern guide
|
|
164
|
+
|
|
165
|
+
### Architect
|
|
166
|
+
1. [ARCHITECTURE_DIAGRAMS.md](./ARCHITECTURE_DIAGRAMS.md) - System design
|
|
167
|
+
2. [SUMMARY.md](./SUMMARY.md) - Implementation details
|
|
168
|
+
3. [OFFICIAL_REFERENCES.md](./OFFICIAL_REFERENCES.md) - Standards
|
|
169
|
+
|
|
170
|
+
### Project Manager
|
|
171
|
+
1. [SUMMARY.md](./SUMMARY.md) - What was built
|
|
172
|
+
2. [Readme.md](./Readme.md) - Feature overview
|
|
173
|
+
3. [COMMUNICATION_DOCS.md](./COMMUNICATION_DOCS.md) - Capabilities
|
|
174
|
+
|
|
175
|
+
### Technical Writer
|
|
176
|
+
1. [Readme.md](./Readme.md) - Main documentation
|
|
177
|
+
2. [COMMUNICATION_DOCS.md](./COMMUNICATION_DOCS.md) - Technical details
|
|
178
|
+
3. [OFFICIAL_REFERENCES.md](./OFFICIAL_REFERENCES.md) - Sources
|
|
179
|
+
|
|
180
|
+
### QA Engineer
|
|
181
|
+
1. [COMMUNICATION_DOCS.md](./COMMUNICATION_DOCS.md) - Feature specs
|
|
182
|
+
2. [CommunicationExample.tsx](./CommunicationExample.tsx) - Test cases
|
|
183
|
+
3. [QUICK_REFERENCE.md](./QUICK_REFERENCE.md) - Troubleshooting
|
|
184
|
+
|
|
185
|
+
---
|
|
186
|
+
|
|
187
|
+
## 📊 File Statistics
|
|
188
|
+
|
|
189
|
+
| Category | Files | Lines of Code | Lines of Docs |
|
|
190
|
+
|----------|-------|---------------|---------------|
|
|
191
|
+
| Implementation | 3 | ~1,050 | ~500 |
|
|
192
|
+
| Examples | 1 | ~350 | ~100 |
|
|
193
|
+
| Documentation | 7 | ~50 | ~2,200 |
|
|
194
|
+
| Configuration | 2 | ~50 | ~20 |
|
|
195
|
+
| **Total** | **13** | **~1,500** | **~2,820** |
|
|
196
|
+
|
|
197
|
+
---
|
|
198
|
+
|
|
199
|
+
## 🔗 External References
|
|
200
|
+
|
|
201
|
+
### Official Documentation (Most Important)
|
|
202
|
+
1. **React Native Native Modules**
|
|
203
|
+
- https://reactnative.dev/docs/native-modules-intro
|
|
204
|
+
|
|
205
|
+
2. **React Native Events**
|
|
206
|
+
- https://reactnative.dev/docs/native-modules-ios#sending-events-to-javascript
|
|
207
|
+
|
|
208
|
+
3. **React Native Promises**
|
|
209
|
+
- https://reactnative.dev/docs/native-modules-ios#promises
|
|
210
|
+
|
|
211
|
+
4. **Node.js EventEmitter**
|
|
212
|
+
- https://nodejs.org/api/events.html
|
|
213
|
+
|
|
214
|
+
5. **Redux Pattern**
|
|
215
|
+
- https://redux.js.org/introduction/getting-started
|
|
216
|
+
|
|
217
|
+
**See [OFFICIAL_REFERENCES.md](./OFFICIAL_REFERENCES.md) for complete list of 50+ references**
|
|
218
|
+
|
|
219
|
+
---
|
|
220
|
+
|
|
221
|
+
## 🗂️ File Tree
|
|
222
|
+
|
|
223
|
+
```
|
|
224
|
+
DemoLib/
|
|
225
|
+
│
|
|
226
|
+
├── 📦 Package Files
|
|
227
|
+
│ ├── package.json → Package configuration
|
|
228
|
+
│ ├── package-lock.json → Dependency lock file
|
|
229
|
+
│ └── index.ts → Main exports
|
|
230
|
+
│
|
|
231
|
+
├── 💻 Core Implementation
|
|
232
|
+
│ ├── MiniAppCommunication.ts → MiniApp side implementation
|
|
233
|
+
│ ├── ContainerCommunication.ts → Container side implementation
|
|
234
|
+
│ └── CommunicationExample.tsx → Usage examples
|
|
235
|
+
│
|
|
236
|
+
├── 🎨 UI Components
|
|
237
|
+
│ ├── TaskCard.tsx → Task card component
|
|
238
|
+
│ └── TaskDemoCard.tsx → Demo card component
|
|
239
|
+
│
|
|
240
|
+
└── 📚 Documentation
|
|
241
|
+
├── Readme.md → Main documentation
|
|
242
|
+
├── QUICK_REFERENCE.md → Quick start guide
|
|
243
|
+
├── COMMUNICATION_DOCS.md → Complete pattern guide
|
|
244
|
+
├── OFFICIAL_REFERENCES.md → Official doc links
|
|
245
|
+
├── ARCHITECTURE_DIAGRAMS.md → Visual diagrams
|
|
246
|
+
├── SUMMARY.md → Implementation summary
|
|
247
|
+
└── INDEX.md → This file
|
|
248
|
+
```
|
|
249
|
+
|
|
250
|
+
---
|
|
251
|
+
|
|
252
|
+
## ✅ Implementation Checklist
|
|
253
|
+
|
|
254
|
+
Use this checklist to verify your implementation:
|
|
255
|
+
|
|
256
|
+
### MiniApp Implementation
|
|
257
|
+
- [ ] Import `MiniAppCommunication`
|
|
258
|
+
- [ ] Call `initialize()` at startup
|
|
259
|
+
- [ ] Implement chosen patterns
|
|
260
|
+
- [ ] Add cleanup in `useEffect`
|
|
261
|
+
- [ ] Test all communication paths
|
|
262
|
+
- [ ] Add error handling
|
|
263
|
+
|
|
264
|
+
### Container Implementation
|
|
265
|
+
- [ ] Import `ContainerCommunication`
|
|
266
|
+
- [ ] Call `initialize()` at startup
|
|
267
|
+
- [ ] Register request handlers
|
|
268
|
+
- [ ] Listen to events
|
|
269
|
+
- [ ] Add cleanup
|
|
270
|
+
- [ ] Test all handlers
|
|
271
|
+
|
|
272
|
+
### Testing
|
|
273
|
+
- [ ] Test event communication
|
|
274
|
+
- [ ] Test promise-based requests
|
|
275
|
+
- [ ] Test shared state sync
|
|
276
|
+
- [ ] Test message queue
|
|
277
|
+
- [ ] Test error scenarios
|
|
278
|
+
- [ ] Test cleanup
|
|
279
|
+
|
|
280
|
+
---
|
|
281
|
+
|
|
282
|
+
## 🚀 Next Steps
|
|
283
|
+
|
|
284
|
+
1. **Choose Your Path**
|
|
285
|
+
- Quick implementation? → [QUICK_REFERENCE.md](./QUICK_REFERENCE.md)
|
|
286
|
+
- Complete understanding? → [COMMUNICATION_DOCS.md](./COMMUNICATION_DOCS.md)
|
|
287
|
+
- Examples first? → [CommunicationExample.tsx](./CommunicationExample.tsx)
|
|
288
|
+
|
|
289
|
+
2. **Follow the Guide**
|
|
290
|
+
- Read the documentation
|
|
291
|
+
- Try the examples
|
|
292
|
+
- Implement in your app
|
|
293
|
+
|
|
294
|
+
3. **Reference as Needed**
|
|
295
|
+
- Use this INDEX to find what you need
|
|
296
|
+
- Check official references for details
|
|
297
|
+
- Review diagrams for understanding
|
|
298
|
+
|
|
299
|
+
---
|
|
300
|
+
|
|
301
|
+
## 💡 Tips
|
|
302
|
+
|
|
303
|
+
- **Bookmark this page** for easy navigation
|
|
304
|
+
- **Start with QUICK_REFERENCE.md** if you're in a hurry
|
|
305
|
+
- **Read COMMUNICATION_DOCS.md** for complete understanding
|
|
306
|
+
- **Check ARCHITECTURE_DIAGRAMS.md** when confused
|
|
307
|
+
- **Refer to OFFICIAL_REFERENCES.md** for authoritative sources
|
|
308
|
+
|
|
309
|
+
---
|
|
310
|
+
|
|
311
|
+
## 📞 Support
|
|
312
|
+
|
|
313
|
+
For questions and issues:
|
|
314
|
+
1. Check the troubleshooting section in [COMMUNICATION_DOCS.md](./COMMUNICATION_DOCS.md)
|
|
315
|
+
2. Review [QUICK_REFERENCE.md](./QUICK_REFERENCE.md) for common issues
|
|
316
|
+
3. Check official documentation links in [OFFICIAL_REFERENCES.md](./OFFICIAL_REFERENCES.md)
|
|
317
|
+
|
|
318
|
+
---
|
|
319
|
+
|
|
320
|
+
## 📄 License
|
|
321
|
+
ISC
|
|
322
|
+
|
|
323
|
+
## 👨💻 Author
|
|
324
|
+
Rinkal Tailor
|
|
325
|
+
|
|
326
|
+
## 📌 Version
|
|
327
|
+
1.3.0
|
|
328
|
+
|
|
329
|
+
---
|
|
330
|
+
|
|
331
|
+
**Happy Coding! 🎉**
|
|
332
|
+
|
|
333
|
+
Start with [QUICK_REFERENCE.md](./QUICK_REFERENCE.md) to begin in 30 seconds!
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MiniApp Communication - Send data from MiniApp to Container
|
|
3
|
+
*
|
|
4
|
+
* Official References:
|
|
5
|
+
* - React Native Native Modules: https://reactnative.dev/docs/native-modules-intro
|
|
6
|
+
* - DeviceEventEmitter API: https://reactnative.dev/docs/native-modules-android
|
|
7
|
+
* - Event Emitters: https://reactnative.dev/docs/native-modules-ios
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
import { DeviceEventEmitter } from 'react-native';
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Simple MiniApp to Container Communication
|
|
14
|
+
* Send events from your MiniApp components to the Container App
|
|
15
|
+
*/
|
|
16
|
+
class MiniAppCommunication {
|
|
17
|
+
private static emitter = DeviceEventEmitter;
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Send data from MiniApp to Container
|
|
21
|
+
* @param eventName - Name of the event (e.g., 'taskClicked', 'dataUpdated')
|
|
22
|
+
* @param data - Data to send to container
|
|
23
|
+
*/
|
|
24
|
+
static sendToContainer(eventName: string, data: any) {
|
|
25
|
+
this.emitter.emit(`MINIAPP_TO_CONTAINER:${eventName}`, data);
|
|
26
|
+
console.log(`[MiniApp → Container] ${eventName}:`, data);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Send task click event to container
|
|
31
|
+
*/
|
|
32
|
+
static sendTaskClick(taskId: string, taskTitle: string) {
|
|
33
|
+
this.sendToContainer('taskClicked', { taskId, taskTitle, timestamp: Date.now() });
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Send custom user action to container
|
|
38
|
+
*/
|
|
39
|
+
static sendUserAction(action: string, payload: any) {
|
|
40
|
+
this.sendToContainer('userAction', { action, payload, timestamp: Date.now() });
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Send data update notification to container
|
|
45
|
+
*/
|
|
46
|
+
static sendDataUpdate(key: string, value: any) {
|
|
47
|
+
this.sendToContainer('dataUpdate', { key, value, timestamp: Date.now() });
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export default MiniAppCommunication;
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
// Export helper types
|
|
55
|
+
export interface TaskClickData {
|
|
56
|
+
taskId: string;
|
|
57
|
+
taskTitle: string;
|
|
58
|
+
timestamp: number;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export interface UserActionData {
|
|
62
|
+
action: string;
|
|
63
|
+
payload: any;
|
|
64
|
+
timestamp: number;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
export interface DataUpdateEvent {
|
|
68
|
+
key: string;
|
|
69
|
+
value: any;
|
|
70
|
+
timestamp: number;
|
|
71
|
+
}
|
|
@@ -0,0 +1,278 @@
|
|
|
1
|
+
# Official Documentation References
|
|
2
|
+
|
|
3
|
+
## Primary References for MiniApp-Container Communication
|
|
4
|
+
|
|
5
|
+
### 1. React Native Official Documentation
|
|
6
|
+
|
|
7
|
+
#### Event Communication
|
|
8
|
+
- **Native Modules - Sending Events to JavaScript**
|
|
9
|
+
- URL: https://reactnative.dev/docs/native-modules-ios#sending-events-to-javascript
|
|
10
|
+
- Description: Official guide for sending events from native code to JavaScript
|
|
11
|
+
|
|
12
|
+
- **Native Modules - Android Events**
|
|
13
|
+
- URL: https://reactnative.dev/docs/native-modules-android#sending-events-to-javascript
|
|
14
|
+
- Description: Android-specific event handling
|
|
15
|
+
|
|
16
|
+
#### Callback Pattern
|
|
17
|
+
- **Native Modules - Callbacks**
|
|
18
|
+
- URL: https://reactnative.dev/docs/native-modules-ios#callbacks
|
|
19
|
+
- Description: Official documentation for callback-based communication
|
|
20
|
+
|
|
21
|
+
#### Promise Pattern
|
|
22
|
+
- **Native Modules - Promises**
|
|
23
|
+
- URL: https://reactnative.dev/docs/native-modules-ios#promises
|
|
24
|
+
- Description: Promise-based async communication pattern
|
|
25
|
+
|
|
26
|
+
#### Native Bridge
|
|
27
|
+
- **Native Modules Introduction**
|
|
28
|
+
- URL: https://reactnative.dev/docs/native-modules-intro
|
|
29
|
+
- Description: Introduction to React Native native modules
|
|
30
|
+
|
|
31
|
+
- **Native Modules iOS**
|
|
32
|
+
- URL: https://reactnative.dev/docs/native-modules-ios
|
|
33
|
+
- Description: Creating native modules for iOS
|
|
34
|
+
|
|
35
|
+
- **Native Modules Android**
|
|
36
|
+
- URL: https://reactnative.dev/docs/native-modules-android
|
|
37
|
+
- Description: Creating native modules for Android
|
|
38
|
+
|
|
39
|
+
- **Communication iOS**
|
|
40
|
+
- URL: https://reactnative.dev/docs/communication-ios
|
|
41
|
+
- Description: Communication between native and JavaScript on iOS
|
|
42
|
+
|
|
43
|
+
- **Communication Android**
|
|
44
|
+
- URL: https://reactnative.dev/docs/communication-android
|
|
45
|
+
- Description: Communication between native and JavaScript on Android
|
|
46
|
+
|
|
47
|
+
#### Platform APIs
|
|
48
|
+
- **Platform Specific Code**
|
|
49
|
+
- URL: https://reactnative.dev/docs/platform-specific-code
|
|
50
|
+
- Description: Writing platform-specific code
|
|
51
|
+
|
|
52
|
+
### 2. Node.js EventEmitter
|
|
53
|
+
- **EventEmitter Class**
|
|
54
|
+
- URL: https://nodejs.org/api/events.html
|
|
55
|
+
- Description: Node.js events module documentation (pattern used in React Native)
|
|
56
|
+
|
|
57
|
+
### 3. JavaScript/Web Standards
|
|
58
|
+
|
|
59
|
+
#### Promises
|
|
60
|
+
- **Promise - MDN Web Docs**
|
|
61
|
+
- URL: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise
|
|
62
|
+
- Description: JavaScript Promise API reference
|
|
63
|
+
|
|
64
|
+
#### PostMessage (Web Context)
|
|
65
|
+
- **Window.postMessage()**
|
|
66
|
+
- URL: https://developer.mozilla.org/en-US/docs/Web/API/Window/postMessage
|
|
67
|
+
- Description: Cross-origin communication in web contexts (applicable for web-based miniapps)
|
|
68
|
+
|
|
69
|
+
#### Custom Events
|
|
70
|
+
- **CustomEvent**
|
|
71
|
+
- URL: https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent
|
|
72
|
+
- Description: Creating and dispatching custom events
|
|
73
|
+
|
|
74
|
+
#### Web Workers (for web contexts)
|
|
75
|
+
- **Web Workers API**
|
|
76
|
+
- URL: https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API
|
|
77
|
+
- Description: Background thread communication pattern
|
|
78
|
+
|
|
79
|
+
### 4. State Management Patterns
|
|
80
|
+
|
|
81
|
+
#### Redux
|
|
82
|
+
- **Redux - Getting Started**
|
|
83
|
+
- URL: https://redux.js.org/introduction/getting-started
|
|
84
|
+
- Description: Predictable state container pattern
|
|
85
|
+
|
|
86
|
+
- **Redux - Usage with React**
|
|
87
|
+
- URL: https://redux.js.org/tutorials/fundamentals/part-5-ui-react
|
|
88
|
+
- Description: Using Redux with React
|
|
89
|
+
|
|
90
|
+
#### React Context
|
|
91
|
+
- **React Context**
|
|
92
|
+
- URL: https://react.dev/reference/react/useContext
|
|
93
|
+
- Description: React's built-in state sharing mechanism
|
|
94
|
+
|
|
95
|
+
- **React Context (Legacy)**
|
|
96
|
+
- URL: https://legacy.reactjs.org/docs/context.html
|
|
97
|
+
- Description: Context API documentation
|
|
98
|
+
|
|
99
|
+
### 5. Message Queue Pattern
|
|
100
|
+
|
|
101
|
+
#### General Pattern
|
|
102
|
+
- **Message Queue - Wikipedia**
|
|
103
|
+
- URL: https://en.wikipedia.org/wiki/Message_queue
|
|
104
|
+
- Description: Message queue pattern and architecture
|
|
105
|
+
|
|
106
|
+
- **Enterprise Integration Patterns**
|
|
107
|
+
- URL: https://www.enterpriseintegrationpatterns.com/patterns/messaging/
|
|
108
|
+
- Description: Messaging patterns in distributed systems
|
|
109
|
+
|
|
110
|
+
### 6. Micro-Frontend Architecture
|
|
111
|
+
|
|
112
|
+
#### Concepts
|
|
113
|
+
- **Micro Frontends**
|
|
114
|
+
- URL: https://micro-frontends.org/
|
|
115
|
+
- Description: Architecture for splitting frontend monoliths
|
|
116
|
+
|
|
117
|
+
- **Martin Fowler - Micro Frontends**
|
|
118
|
+
- URL: https://martinfowler.com/articles/micro-frontends.html
|
|
119
|
+
- Description: Detailed article on micro-frontend architecture
|
|
120
|
+
|
|
121
|
+
#### Module Federation
|
|
122
|
+
- **Webpack Module Federation**
|
|
123
|
+
- URL: https://webpack.js.org/concepts/module-federation/
|
|
124
|
+
- Description: Sharing code between independent applications
|
|
125
|
+
|
|
126
|
+
### 7. Mobile-Specific Patterns
|
|
127
|
+
|
|
128
|
+
#### Deep Linking
|
|
129
|
+
- **React Native - Linking**
|
|
130
|
+
- URL: https://reactnative.dev/docs/linking
|
|
131
|
+
- Description: Deep linking and URL handling
|
|
132
|
+
|
|
133
|
+
#### App State
|
|
134
|
+
- **React Native - AppState**
|
|
135
|
+
- URL: https://reactnative.dev/docs/appstate
|
|
136
|
+
- Description: App foreground/background state
|
|
137
|
+
|
|
138
|
+
### 8. Additional React Native APIs
|
|
139
|
+
|
|
140
|
+
#### AsyncStorage
|
|
141
|
+
- **AsyncStorage (Community)**
|
|
142
|
+
- URL: https://react-native-async-storage.github.io/async-storage/
|
|
143
|
+
- Description: Persistent storage for data sharing
|
|
144
|
+
|
|
145
|
+
#### NetInfo
|
|
146
|
+
- **NetInfo**
|
|
147
|
+
- URL: https://github.com/react-native-netinfo/react-native-netinfo
|
|
148
|
+
- Description: Network connectivity information
|
|
149
|
+
|
|
150
|
+
### 9. TypeScript Documentation
|
|
151
|
+
|
|
152
|
+
#### TypeScript Handbook
|
|
153
|
+
- **TypeScript Documentation**
|
|
154
|
+
- URL: https://www.typescriptlang.org/docs/
|
|
155
|
+
- Description: TypeScript language reference
|
|
156
|
+
|
|
157
|
+
- **TypeScript with React**
|
|
158
|
+
- URL: https://www.typescriptlang.org/docs/handbook/react.html
|
|
159
|
+
- Description: Using TypeScript with React
|
|
160
|
+
|
|
161
|
+
### 10. Design Patterns
|
|
162
|
+
|
|
163
|
+
#### Observer Pattern
|
|
164
|
+
- **Observer Pattern**
|
|
165
|
+
- URL: https://refactoring.guru/design-patterns/observer
|
|
166
|
+
- Description: Observer design pattern (basis for event systems)
|
|
167
|
+
|
|
168
|
+
#### Mediator Pattern
|
|
169
|
+
- **Mediator Pattern**
|
|
170
|
+
- URL: https://refactoring.guru/design-patterns/mediator
|
|
171
|
+
- Description: Mediator pattern for component communication
|
|
172
|
+
|
|
173
|
+
#### Pub/Sub Pattern
|
|
174
|
+
- **Publish-Subscribe Pattern**
|
|
175
|
+
- URL: https://en.wikipedia.org/wiki/Publish%E2%80%93subscribe_pattern
|
|
176
|
+
- Description: Pub/sub messaging pattern
|
|
177
|
+
|
|
178
|
+
---
|
|
179
|
+
|
|
180
|
+
## Implementation-Specific References
|
|
181
|
+
|
|
182
|
+
### React Native Bridge Communication
|
|
183
|
+
The implementation in this library is based on these official patterns:
|
|
184
|
+
|
|
185
|
+
1. **EventEmitter Pattern**: Uses React Native's `NativeEventEmitter` and `DeviceEventEmitter`
|
|
186
|
+
- Source: https://reactnative.dev/docs/native-modules-ios#sending-events-to-javascript
|
|
187
|
+
|
|
188
|
+
2. **Callback Pattern**: Direct function invocation
|
|
189
|
+
- Source: https://reactnative.dev/docs/native-modules-ios#callbacks
|
|
190
|
+
|
|
191
|
+
3. **Promise Pattern**: Async/await communication
|
|
192
|
+
- Source: https://reactnative.dev/docs/native-modules-ios#promises
|
|
193
|
+
|
|
194
|
+
4. **Shared State**: Inspired by Redux pattern
|
|
195
|
+
- Source: https://redux.js.org/introduction/getting-started
|
|
196
|
+
|
|
197
|
+
5. **Native Bridge**: Direct native module calls
|
|
198
|
+
- Source: https://reactnative.dev/docs/native-modules-intro
|
|
199
|
+
|
|
200
|
+
6. **Message Queue**: Reliable message delivery
|
|
201
|
+
- Source: https://en.wikipedia.org/wiki/Message_queue
|
|
202
|
+
|
|
203
|
+
---
|
|
204
|
+
|
|
205
|
+
## Related Academic Papers
|
|
206
|
+
|
|
207
|
+
1. **Micro Frontends: A Literature Review**
|
|
208
|
+
- Topic: Architecture patterns for micro-frontends
|
|
209
|
+
|
|
210
|
+
2. **Event-Driven Architecture in Mobile Applications**
|
|
211
|
+
- Topic: Event-based communication patterns
|
|
212
|
+
|
|
213
|
+
3. **Cross-Platform Mobile Development Patterns**
|
|
214
|
+
- Topic: Communication in hybrid mobile apps
|
|
215
|
+
|
|
216
|
+
---
|
|
217
|
+
|
|
218
|
+
## Community Resources
|
|
219
|
+
|
|
220
|
+
### GitHub Repositories
|
|
221
|
+
- **React Native**: https://github.com/facebook/react-native
|
|
222
|
+
- **React Native Community**: https://github.com/react-native-community
|
|
223
|
+
|
|
224
|
+
### Blogs & Tutorials
|
|
225
|
+
- **React Native Blog**: https://reactnative.dev/blog
|
|
226
|
+
- **Meta Open Source**: https://opensource.fb.com/
|
|
227
|
+
|
|
228
|
+
### Forums & Discussion
|
|
229
|
+
- **React Native Community Discord**: https://www.reactnative.dev/help
|
|
230
|
+
- **Stack Overflow**: https://stackoverflow.com/questions/tagged/react-native
|
|
231
|
+
|
|
232
|
+
---
|
|
233
|
+
|
|
234
|
+
## Standards & Specifications
|
|
235
|
+
|
|
236
|
+
### W3C Standards
|
|
237
|
+
- **Web Messaging**: https://html.spec.whatwg.org/multipage/web-messaging.html
|
|
238
|
+
- **DOM Events**: https://dom.spec.whatwg.org/#events
|
|
239
|
+
|
|
240
|
+
### ECMAScript
|
|
241
|
+
- **ECMAScript Specification**: https://tc39.es/ecma262/
|
|
242
|
+
- **Promises/A+ Specification**: https://promisesaplus.com/
|
|
243
|
+
|
|
244
|
+
---
|
|
245
|
+
|
|
246
|
+
## Books (Optional Reading)
|
|
247
|
+
|
|
248
|
+
1. **"React Native in Action"** by Nader Dabit
|
|
249
|
+
2. **"Learning React Native"** by Bonnie Eisenman
|
|
250
|
+
3. **"Micro Frontends in Action"** by Michael Geers
|
|
251
|
+
4. **"Enterprise Integration Patterns"** by Gregor Hohpe
|
|
252
|
+
|
|
253
|
+
---
|
|
254
|
+
|
|
255
|
+
## Version History
|
|
256
|
+
|
|
257
|
+
This documentation references:
|
|
258
|
+
- React Native: 0.81.5
|
|
259
|
+
- React: 19.1.0
|
|
260
|
+
- Node.js: Latest LTS
|
|
261
|
+
- TypeScript: Latest stable
|
|
262
|
+
|
|
263
|
+
---
|
|
264
|
+
|
|
265
|
+
## License & Attribution
|
|
266
|
+
|
|
267
|
+
All documentation links are to official sources and are subject to their respective licenses:
|
|
268
|
+
- React Native: MIT License
|
|
269
|
+
- MDN Web Docs: CC-BY-SA 2.5
|
|
270
|
+
- Node.js: Various open source licenses
|
|
271
|
+
|
|
272
|
+
---
|
|
273
|
+
|
|
274
|
+
## Last Updated
|
|
275
|
+
December 29, 2025
|
|
276
|
+
|
|
277
|
+
## Maintained By
|
|
278
|
+
Rinkal Tailor
|