expo-widgets 56.0.0 → 56.0.2

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/CHANGELOG.md CHANGED
@@ -10,6 +10,14 @@
10
10
 
11
11
  ### 💡 Others
12
12
 
13
+ ## 56.0.2 — 2026-05-06
14
+
15
+ _This version does not introduce any user-facing changes._
16
+
17
+ ## 56.0.1 — 2026-05-05
18
+
19
+ _This version does not introduce any user-facing changes._
20
+
13
21
  ## 56.0.0 — 2026-05-05
14
22
 
15
23
  ### 🛠 Breaking changes
@@ -23,6 +31,7 @@
23
31
  - Support `PlatformColor`. ([#44193](https://github.com/expo/expo/pull/44193) by [@jakex7](https://github.com/jakex7))
24
32
  - [plugin] Make incremental prebuilds work ([#45157](https://github.com/expo/expo/pull/45157) by [@jakex7](https://github.com/jakex7))
25
33
  - [android] Add stub methods. ([#45335](https://github.com/expo/expo/pull/45335) by [@jakex7](https://github.com/jakex7))
34
+ - Add widget RedBox. ([#45402](https://github.com/expo/expo/pull/45402) by [@jakex7](https://github.com/jakex7))
26
35
 
27
36
  ### 🐛 Bug fixes
28
37
 
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2015-present 650 Industries, Inc. (aka Expo)
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -1,6 +1,28 @@
1
1
  import AppIntents
2
2
  import WidgetKit
3
3
 
4
+ struct WidgetReload: AppIntent {
5
+ // title is not used for non-discoverable intents, but it is required
6
+ static var title: LocalizedStringResource = "Reload widget"
7
+ static var isDiscoverable: Bool = false
8
+ @Parameter(title: "source")
9
+ var source: String?
10
+
11
+ init() {}
12
+ init(source: String?) {
13
+ self.source = source
14
+ }
15
+
16
+ func perform() async throws -> some IntentResult {
17
+ guard let source else {
18
+ return .result()
19
+ }
20
+
21
+ WidgetCenter.shared.reloadTimelines(ofKind: source)
22
+ return .result()
23
+ }
24
+ }
25
+
4
26
  @available(iOS 16.0, *)
5
27
  struct WidgetUserInteraction: AppIntent {
6
28
  // title is not used for non-discoverable intents, but it is required
@@ -104,11 +104,21 @@ public struct WidgetsDynamicView: View, ExpoSwiftUI.AnyChild {
104
104
  render(FragmentView.self, FragmentProps.self, updateProps: updateChildren)
105
105
  case "LinkView":
106
106
  render(LinkView.self, LinkViewProps.self, updateProps: updateChildren)
107
+ #if DEBUG
108
+ case "RedBoxView":
109
+ render(RedBoxView.self, RedBoxViewProps.self) { redBoxProps in
110
+ redBoxProps.source = name
111
+ redBoxProps.kind = kind
112
+ }
107
113
  default:
108
114
  ZStack {
109
115
  Color.red.opacity(0.5)
110
116
  Text("Unable to get the view for: \(node["type"] as? String ?? "undefined")")
111
117
  }
118
+ #else
119
+ default:
120
+ EmptyView()
121
+ #endif
112
122
  }
113
123
  }
114
124
 
@@ -0,0 +1,83 @@
1
+ import ExpoModulesCore
2
+ import SwiftUI
3
+ import ExpoUI
4
+
5
+ public final class RedBoxViewProps: UIBaseViewProps {
6
+ @Field var message: String
7
+ @Field var source: String?
8
+ @Field var stack: String?
9
+ var kind: WidgetsKind = .widget
10
+ }
11
+
12
+ public struct RedBoxView: ExpoSwiftUI.View {
13
+ @ObservedObject public var props: RedBoxViewProps
14
+
15
+ public init(props: RedBoxViewProps) {
16
+ self.props = props
17
+ }
18
+
19
+ public var body: some View {
20
+ FullSizeZStack(kind: props.kind) {
21
+ Color.red
22
+ VStack(alignment: .leading, spacing: 2) {
23
+ HStack(spacing: 6) {
24
+ Image(systemName: "exclamationmark.triangle.fill")
25
+ Text("Error").font(.headline)
26
+ Spacer()
27
+ if #available(iOS 17.0, *) {
28
+ Button(intent: WidgetReload(source: props.source)) {
29
+ Image(systemName: "arrow.clockwise")
30
+ }
31
+ .buttonStyle(.plain)
32
+ .padding(4)
33
+ }
34
+ }
35
+ .foregroundStyle(.white)
36
+
37
+ Text(props.message)
38
+ .font(.system(size: 14).bold().monospaced())
39
+ .foregroundStyle(.white.opacity(0.9))
40
+ .modifier(RedBoxBody())
41
+
42
+ if let stack = props.stack, !stack.isEmpty {
43
+ Text(stack)
44
+ .font(.system(size: 11).monospaced())
45
+ .foregroundStyle(.white.opacity(0.75))
46
+ .modifier(RedBoxBody())
47
+ }
48
+ }
49
+ .padding(12)
50
+ .frame(maxWidth: .infinity, maxHeight: .infinity, alignment: .topLeading)
51
+ }
52
+ }
53
+ }
54
+
55
+ private struct RedBoxBody: ViewModifier {
56
+ @ViewBuilder
57
+ func body(content: Content) -> some View {
58
+ let base = content.lineLimit(nil).fixedSize(horizontal: false, vertical: true)
59
+ if #available(iOS 26.0, *) {
60
+ base.lineHeight(.tight)
61
+ } else {
62
+ base
63
+ }
64
+ }
65
+ }
66
+
67
+ public struct FullSizeZStack<Content: View>: View {
68
+ let kind: WidgetsKind
69
+ let content: Content
70
+
71
+ init(kind: WidgetsKind = .widget, @ViewBuilder _ content: () -> Content) {
72
+ self.kind = kind
73
+ self.content = content()
74
+ }
75
+
76
+ public var body: some View {
77
+ if #available(iOS 17.0, *), kind == .widget {
78
+ ZStack { content }.containerRelativeFrame([.horizontal, .vertical])
79
+ } else {
80
+ ZStack { content }.frame(maxWidth: .infinity)
81
+ }
82
+ }
83
+ }
@@ -20,6 +20,14 @@ func parseTimeline(identifier: String, name: String, family: WidgetFamily) -> [W
20
20
  return entries.compactMap(\.self)
21
21
  }
22
22
 
23
+ func createRedBox(message: String, stack: String? = nil) -> [String: Any] {
24
+ var props: [String: Any] = ["message": message]
25
+ if let stack {
26
+ props["stack"] = stack
27
+ }
28
+ return ["type": "RedBoxView", "props": props]
29
+ }
30
+
23
31
  func evaluateLayout(
24
32
  layout: String,
25
33
  props: [String: Any],
@@ -32,6 +40,10 @@ func evaluateLayout(
32
40
  let result = context.objectForKeyedSubscript("__expoWidgetRender")?.call(
33
41
  withArguments: [props, environment]
34
42
  )
43
+ if let exception = context.exception {
44
+ print("[ExpoWidgets] Layout evaluation failed: \(exception)")
45
+ return createRedBox(message: exception.toString())
46
+ }
35
47
  return result?.toObject() as? [String: Any]
36
48
  }
37
49
 
@@ -49,6 +61,12 @@ func getLiveActivityNodes(forName name: String, props: String = "{}", environmen
49
61
  let result = context.objectForKeyedSubscript("__expoWidgetRender")?.call(
50
62
  withArguments: [propsDict, environment]
51
63
  )
64
+
65
+ if let exception = context.exception {
66
+ print("[ExpoWidgets] Layout evaluation failed: \(exception)")
67
+ return ["banner": createRedBox(message: exception.toString())]
68
+ }
69
+
52
70
  return result?.toObject() as? [String: Any] ?? [:]
53
71
  }
54
72
 
@@ -6,12 +6,6 @@ func createWidgetContext(layout: String) -> JSContext? {
6
6
  return nil
7
7
  }
8
8
 
9
- context.exceptionHandler = { _, exception in
10
- if let exception {
11
- print("[ExpoWidgets] Layout evaluation failed: \(exception)")
12
- }
13
- }
14
-
15
9
  // Inject ExpoUI bundle
16
10
  guard let bundleURL = Bundle.main.url(forResource: "ExpoWidgets", withExtension: "bundle"),
17
11
  let bundle = Bundle(url: bundleURL),
package/package.json CHANGED
@@ -1,19 +1,9 @@
1
1
  {
2
2
  "name": "expo-widgets",
3
- "version": "56.0.0",
3
+ "version": "56.0.2",
4
4
  "description": "Widgets.",
5
5
  "main": "build/index.js",
6
6
  "types": "build/index.d.ts",
7
- "scripts": {
8
- "build": "expo-module build",
9
- "build:plugin": "expo-module build plugin",
10
- "build:bundle": "node ./scripts/build-bundle.mjs",
11
- "clean": "expo-module clean",
12
- "lint": "expo-module lint",
13
- "test": "expo-module test",
14
- "prepublishOnly": "expo-module prepublishOnly",
15
- "expo-module": "expo-module"
16
- },
17
7
  "keywords": [
18
8
  "react-native",
19
9
  "expo",
@@ -31,21 +21,31 @@
31
21
  "license": "MIT",
32
22
  "homepage": "https://docs.expo.dev/versions/latest/sdk/widgets/",
33
23
  "dependencies": {
34
- "@expo/plist": "0.6.0",
35
- "@expo/ui": "56.0.0"
24
+ "@expo/plist": "^0.6.0",
25
+ "@expo/ui": "~56.0.1"
36
26
  },
37
27
  "devDependencies": {
38
28
  "@expo/spawn-async": "^1.7.2",
39
29
  "@types/node": "^22.14.0",
40
30
  "@types/react": "~19.2.0",
41
- "expo-module-scripts": "56.0.0",
42
31
  "react-native": "0.85.2",
43
- "resolve-workspace-root": "^2.0.0"
32
+ "resolve-workspace-root": "^2.0.0",
33
+ "expo": "56.0.0-preview.3",
34
+ "expo-module-scripts": "56.0.1"
44
35
  },
45
36
  "peerDependencies": {
46
- "expo": "56.0.0-preview.0",
37
+ "expo": "*",
47
38
  "react": "*",
48
39
  "react-native": "*"
49
40
  },
50
- "gitHead": "6dcd9ce9d615d25df78597f60520492e35e02efb"
51
- }
41
+ "gitHead": "71ec800b2fa6133d22d69b70945132e22f1b7ae8",
42
+ "scripts": {
43
+ "build": "expo-module build",
44
+ "build:plugin": "expo-module build plugin",
45
+ "build:bundle": "node ./scripts/build-bundle.mjs",
46
+ "clean": "expo-module clean",
47
+ "lint": "expo-module lint",
48
+ "test": "expo-module test",
49
+ "expo-module": "expo-module"
50
+ }
51
+ }
@@ -0,0 +1 @@
1
+ {"root":["./src/index.ts","./src/withappgroupentitlements.ts","./src/withappinfoplist.ts","./src/witheasconfig.ts","./src/withioswarning.ts","./src/withpodslinking.ts","./src/withpushnotifications.ts","./src/withwidgetsourcefiles.ts","./src/types/widgetconfig.type.ts","./src/types/widgetfamily.type.ts","./src/xcode/addbuildphases.ts","./src/xcode/addpbxgroup.ts","./src/xcode/addproductfile.ts","./src/xcode/addtargetdependency.ts","./src/xcode/addtopbxnativetargetsection.ts","./src/xcode/addtopbxprojectsection.ts","./src/xcode/addxcconfigurationlist.ts","./src/xcode/withtargetxcodeproject.ts"],"version":"5.9.2"}
File without changes
File without changes
File without changes