react-native-live-widgets 1.2.0 → 1.2.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 (50) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/README.md +40 -1
  3. package/android/src/main/java/com/reactnativeliveactivity/renderer/DynamicWidgetCanvasRenderer.kt +443 -46
  4. package/android/src/main/java/com/reactnativeliveactivity/storage/DynamicWidgetStateStore.kt +86 -28
  5. package/android/src/main/java/com/reactnativeliveactivity/widgets/DynamicHomeScreenWidgetProvider.kt +126 -56
  6. package/android/src/main/res/layout/rn_live_widget_hit_zone.xml +16 -0
  7. package/android/src/main/res/layout/rn_live_widget_host.xml +16 -87
  8. package/docs/GUIDE-EN.md +241 -0
  9. package/docs/GUIDE-VI.md +266 -0
  10. package/docs/index.html +1140 -259
  11. package/docs/llms-full.txt +26 -0
  12. package/docs/llms.txt +8 -0
  13. package/ios/Models/DynamicLayoutModels.swift +6 -1
  14. package/ios/Renderer/DynamicNodeView.swift +169 -14
  15. package/ios/Widgets/DynamicHomeScreenWidget.swift +5 -0
  16. package/lib/builder.d.ts.map +1 -1
  17. package/lib/builder.js +65 -11
  18. package/lib/builder.js.map +1 -1
  19. package/lib/dispatcher.js +16 -10
  20. package/lib/dispatcher.js.map +1 -1
  21. package/lib/hooks.js +36 -31
  22. package/lib/hooks.js.map +1 -1
  23. package/lib/index.d.ts +17 -2
  24. package/lib/index.d.ts.map +1 -1
  25. package/lib/index.js +124 -50
  26. package/lib/index.js.map +1 -1
  27. package/lib/ir.d.ts +15 -0
  28. package/lib/ir.d.ts.map +1 -0
  29. package/lib/ir.js +379 -0
  30. package/lib/ir.js.map +1 -0
  31. package/lib/jsx.d.ts +9 -1
  32. package/lib/jsx.d.ts.map +1 -1
  33. package/lib/jsx.js +131 -84
  34. package/lib/jsx.js.map +1 -1
  35. package/lib/preview.d.ts +0 -23
  36. package/lib/preview.d.ts.map +1 -1
  37. package/lib/preview.js +373 -104
  38. package/lib/preview.js.map +1 -1
  39. package/lib/types.d.ts +204 -12
  40. package/lib/types.d.ts.map +1 -1
  41. package/lib/types.js +2 -1
  42. package/lib/types.js.map +1 -1
  43. package/package.json +2 -1
  44. package/src/builder.ts +57 -2
  45. package/src/index.ts +66 -1
  46. package/src/ir.ts +430 -0
  47. package/src/jsx.tsx +30 -0
  48. package/src/preview.tsx +356 -32
  49. package/src/react-native-env.d.ts +1 -0
  50. package/src/types.ts +253 -13
package/CHANGELOG.md CHANGED
@@ -2,6 +2,13 @@
2
2
 
3
3
  All notable changes to `react-native-live-widgets` will be documented in this file.
4
4
 
5
+ ## [1.2.1] - 2026-11-17
6
+ ### Fixed
7
+ - **iOS Swift 6 Compatibility**: Resolved `@ViewBuilder` type inference and closure encapsulation for `renderText()`, `DynamicNodeAccessibilityModifier`, and `ContainerStyleModifier` to prevent `type '()' cannot conform to 'View'` compiler error.
8
+ - **Android Exact Hit Layer**: Replaced fixed grid layout with dynamic `FrameLayout` hit zones (`rn_hit_layer`), accurately mapping bitmap coordinates with launcher aspect ratio letterboxing to eliminate touch offsets and misclicks.
9
+ - **Android Live Chronometer**: Integrated native `android.widget.Chronometer` with `setChronometerCountDown(true)` for smooth, real-time 1s countdown ticking without redrawing bitmaps.
10
+ - **Dynamic Variable Interpolation**: Added dynamic template variable resolution (`{{id}}`, `{{title}}`, counter values) and `defaultChecked` persistence in `DynamicWidgetStateStore`.
11
+
5
12
  ## [1.2.0] - 2026-11-16
6
13
  ### Added
7
14
  - **JSX / TSX Declarative DSL**: Support building Widgets and Live Activities directly using intuitive React JSX syntax (`<VStack>`, `<HStack>`, `<ZStack>`, `<Grid>`, `<Text>`, `<Button>`, `<Badge>`, `<Progress>`, `<Timer>`, `<Image>`, `<Spacer>`, `<Divider>`) instead of nested function calls `UI.VStack(...)`.
package/README.md CHANGED
@@ -150,7 +150,7 @@ Until now, adding **Live Activities** or **Home Screen Widgets** to a React Nati
150
150
  ```
151
151
  - The native Extension fetches fresh JSON and dynamically replaces `{{variables}}` in your widget layout in the background.
152
152
 
153
- ### 5. 🔔 APNs & FCM Token Management
153
+ ### 6. 🔔 APNs & FCM Token Management
154
154
  - One-call retrieval for all push tokens:
155
155
  ```ts
156
156
  const tokens = await LiveActivity.getAllPushTokens();
@@ -159,6 +159,45 @@ Until now, adding **Live Activities** or **Home Screen Widgets** to a React Nati
159
159
  // tokens.activityUpdateToken
160
160
  ```
161
161
 
162
+ ### 7. 🎨 Advanced Styling Modifiers & Platform Capability Matrix
163
+
164
+ Build deep, rich widgets with design system foundations across both platforms:
165
+
166
+ - **🌈 Gradients**: Linear and radial gradients on Containers, Cards, and Buttons:
167
+ ```tsx
168
+ <VStack gradient={{ colors: ['#1E3A8A', '#3B82F6'], angle: 90 }} padding={14}>
169
+ ```
170
+ - **🔲 Borders & Dashed Lines**: Full control over width, color, and stroke styles (`'solid' | 'dashed' | 'dotted'`).
171
+ - **🌑 Shadows & Depth**: Elevate cards with `shadowColor`, `shadowRadius`, `shadowOpacity`, and `shadowOffset`.
172
+ - **🔤 Typography & Dynamic Type**: Semantic scale (`largeTitle`, `title`, `headline`, `subheadline`, `body`, `caption`, `footnote`) with auto-scaling for OS Accessibility font sizes.
173
+ - **🌗 Light, Dark & Tinted Mode**: Support for iOS 18 Tinted Home Screen icons and Android Material You dynamic coloring via `{ light: '#FFF', dark: '#0F172A', tinted: '#38BDF8' }`.
174
+ - **🌍 RTL Internationalization**: Automatic reverse row alignment (`direction: 'rtl'` or `isRTL: true`) for Arabic, Hebrew, and other RTL locales.
175
+ - **♿ Accessibility & Semantics**: First-class TalkBack & VoiceOver support via `accessible`, `accessibilityLabel`, `accessibilityHint`, `accessibilityRole`, and `accessibilityValue`. Android Canvas generates an aggregated semantic summary on the canvas and individual `contentDescription` on interactive hit-zones.
176
+
177
+ #### 📊 Platform Capability & Fallback Matrix
178
+
179
+ Rather than making unverified claims of "100% parity", the engine provides an explicit, transparent capability matrix paired with automatic **Graceful Fallbacks**:
180
+
181
+ | Feature / Modifier | iOS WidgetKit | iOS Live Activity | Android Ongoing Notification | Android Home Widget | Graceful Fallback Mechanism |
182
+ | :--- | :---: | :---: | :---: | :---: | :--- |
183
+ | **Declarative Layouts (`VStack`/`HStack`/`Grid`)** | ✅ Native | ✅ Native | ✅ Canvas | ✅ 2D Canvas | 100% pixel-aligned across all platforms |
184
+ | **Accessibility (TalkBack / VoiceOver)** | ✅ Native VoiceOver | ✅ Native VoiceOver | ✅ Notification Text | ✅ A11y Summary + Hit-Zones | Aggregated `contentDescription` ensures full screen-reader readability |
185
+ | **Linear / Radial Gradients** | ✅ SwiftUI | ✅ SwiftUI | ✅ Shader | ✅ Shader | Automatically falls back to dominant solid `backgroundColor` |
186
+ | **Card & Text Shadows** | ✅ SwiftUI | ✅ SwiftUI | ⚠️ Text Only | ✅ `setShadowLayer` | Falls back to elevation or thin border stroke |
187
+ | **Dashed / Dotted Borders** | ✅ StrokeStyle | ✅ StrokeStyle | ⚠️ Solid | ✅ `DashPathEffect` | Automatically falls back to solid border |
188
+ | **Dynamic Type (Accessibility)** | ✅ Native | ✅ Native | ✅ `fontScale` | ✅ `fontScale` | Preserves accessibility scale factor across devices |
189
+ | **RTL Layout Mirroring** | ✅ Native | ✅ Native | ✅ RTL | ✅ RTL | Reverses flex order and flips text alignment |
190
+ | **iOS 18 Tinted Mode** | ✅ Accentable | N/A | N/A | ✅ Material You | Resolves `tinted` key on iOS 18; falls back to dark/light color |
191
+ | **Interactive Background Intents** | ✅ iOS 17+ | ✅ iOS 17+ | ✅ Native Intent | ✅ Native Intent | Updates local Shared Storage and refreshes timeline |
192
+
193
+ #### 🔍 Checking Runtime Capabilities Programmatically
194
+ ```ts
195
+ const caps = await Widget.getCapabilities();
196
+ if (caps.supportsGradients) {
197
+ console.log('Device supports native gradients!');
198
+ }
199
+ ```
200
+
162
201
  ---
163
202
 
164
203
  ## ⚡ Quick Start