expo-widgets 58.0.16 → 58.0.17

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 (59) hide show
  1. package/CHANGELOG.md +9 -0
  2. package/android/build.gradle +2 -2
  3. package/android/src/main/AndroidManifest.xml +6 -1
  4. package/android/src/main/java/expo/modules/widgets/ExpoWidgetEmittableTree.kt +7 -7
  5. package/android/src/main/java/expo/modules/widgets/ExpoWidgetsPeekWidget.kt +1 -1
  6. package/android/src/main/java/expo/modules/widgets/WidgetInteractionAction.kt +34 -4
  7. package/android/src/main/java/expo/modules/widgets/WidgetsEvents.kt +8 -4
  8. package/android/src/main/java/expo/modules/widgets/WidgetsModule.kt +45 -0
  9. package/android/src/main/java/expo/modules/widgets/notifications/CustomNotification.kt +28 -0
  10. package/android/src/main/java/expo/modules/widgets/notifications/CustomNotificationBuilder.kt +116 -0
  11. package/android/src/main/java/expo/modules/widgets/notifications/CustomNotificationExceptions.kt +50 -0
  12. package/android/src/main/java/expo/modules/widgets/notifications/CustomNotificationFactory.kt +36 -0
  13. package/android/src/main/java/expo/modules/widgets/notifications/CustomNotificationOptions.kt +86 -0
  14. package/android/src/main/java/expo/modules/widgets/notifications/CustomNotificationRenderer.kt +44 -0
  15. package/android/src/main/java/expo/modules/widgets/notifications/CustomNotificationState.kt +65 -0
  16. package/android/src/main/java/expo/modules/widgets/notifications/CustomNotifications.kt +107 -0
  17. package/android/src/main/java/expo/modules/widgets/notifications/ExpoWidgetsNotificationReceiver.kt +67 -0
  18. package/android/src/main/res/values/expo_widgets_notifications.xml +4 -0
  19. package/build/CustomNotifications.d.ts +128 -0
  20. package/build/CustomNotifications.js +162 -0
  21. package/build/CustomNotifications.js.map +1 -0
  22. package/build/CustomNotifications.types.d.ts +124 -0
  23. package/build/CustomNotifications.types.js +3 -0
  24. package/build/CustomNotifications.types.js.map +1 -0
  25. package/build/ExpoWidgets.d.ts +3 -0
  26. package/build/ExpoWidgets.js +26 -0
  27. package/build/ExpoWidgets.js.map +1 -1
  28. package/build/ExpoWidgets.native.d.ts +5 -0
  29. package/build/ExpoWidgets.native.js.map +1 -1
  30. package/build/Widgets.d.ts +14 -0
  31. package/build/Widgets.js +14 -0
  32. package/build/Widgets.js.map +1 -1
  33. package/build/Widgets.types.d.ts +24 -0
  34. package/build/index.d.ts +2 -0
  35. package/build/index.js +1 -0
  36. package/build/index.js.map +1 -1
  37. package/bundle/decorator.ts +13 -0
  38. package/bundle/index.ts +19 -2
  39. package/bundle/layout-registry-stub.ts +19 -0
  40. package/ios/ExpoWidgets.podspec +5 -7
  41. package/package.json +4 -4
  42. package/plugin/build/android/withAndroidNotificationPermission.d.ts +6 -0
  43. package/plugin/build/android/withAndroidNotificationPermission.js +31 -0
  44. package/plugin/build/android/withAndroidNotificationPermission.js.map +1 -0
  45. package/plugin/build/android/withAndroidWidgets.d.ts +4 -2
  46. package/plugin/build/android/withAndroidWidgets.js +6 -1
  47. package/plugin/build/android/withAndroidWidgets.js.map +1 -1
  48. package/plugin/build/withWidgets.js +1 -0
  49. package/plugin/build/withWidgets.js.map +1 -1
  50. package/plugin/src/android/withAndroidNotificationPermission.ts +22 -0
  51. package/plugin/src/android/withAndroidWidgets.ts +11 -1
  52. package/plugin/src/withWidgets.ts +2 -2
  53. package/src/CustomNotifications.ts +213 -0
  54. package/src/CustomNotifications.types.ts +138 -0
  55. package/src/ExpoWidgets.native.ts +8 -0
  56. package/src/ExpoWidgets.ts +41 -0
  57. package/src/Widgets.ts +14 -0
  58. package/src/Widgets.types.ts +24 -0
  59. package/src/index.ts +8 -0
@@ -1,4 +1,5 @@
1
1
  import type { EventSubscription } from 'expo';
2
+ import type { NativeCustomNotification, NativeCustomNotificationFactory } from './CustomNotifications.types';
2
3
  import type { ExpoWidgetsEvents, NativeLiveActivity, NativeLiveActivityFactory, NativeWidgetObject } from './Widgets.types';
3
4
  declare const ExpoWidgetsModule: {
4
5
  widgetsDirectory: string;
@@ -6,6 +7,8 @@ declare const ExpoWidgetsModule: {
6
7
  Widget: typeof NativeWidgetObject;
7
8
  LiveActivityFactory: typeof NativeLiveActivityFactory;
8
9
  LiveActivity: typeof NativeLiveActivity;
10
+ CustomNotificationFactory: typeof NativeCustomNotificationFactory;
11
+ CustomNotification: typeof NativeCustomNotification;
9
12
  addListener<EventName extends keyof ExpoWidgetsEvents>(_eventName: EventName, _listener: ExpoWidgetsEvents[EventName]): EventSubscription;
10
13
  };
11
14
  export default ExpoWidgetsModule;
@@ -35,12 +35,38 @@ class LiveActivityFactoryStub {
35
35
  return [];
36
36
  }
37
37
  }
38
+ class CustomNotificationStub {
39
+ getId() {
40
+ return '';
41
+ }
42
+ async getProps() {
43
+ return {};
44
+ }
45
+ async update(_props, _options) {}
46
+ async cancel() {}
47
+ }
48
+ class CustomNotificationFactoryStub {
49
+ // eslint-disable-next-line @typescript-eslint/no-useless-constructor
50
+ constructor(_name, _layout){}
51
+ async post(_id, _props, _options) {
52
+ return new CustomNotificationStub();
53
+ }
54
+ async get(_id) {
55
+ return null;
56
+ }
57
+ async getActive() {
58
+ return [];
59
+ }
60
+ async cancelAll() {}
61
+ }
38
62
  const ExpoWidgetsModule = {
39
63
  widgetsDirectory: '',
40
64
  reloadAllWidgets () {},
41
65
  Widget: WidgetStub,
42
66
  LiveActivityFactory: LiveActivityFactoryStub,
43
67
  LiveActivity: LiveActivityStub,
68
+ CustomNotificationFactory: CustomNotificationFactoryStub,
69
+ CustomNotification: CustomNotificationStub,
44
70
  addListener (_eventName, _listener) {
45
71
  return noopSubscription;
46
72
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["ExpoWidgets.ts"],"sourcesContent":[null],"names":["noopSubscription","remove","WidgetStub","_name","_layout","_initialProps","reload","updateSnapshot","_props","updateTimeline","_entries","getTimeline","setConfigurationParameterEnum","_parameterName","_options","LiveActivityStub","getId","update","end","_dismissalPolicy","_afterDate","_state","_contentDate","getPushToken","addListener","_eventName","_listener","LiveActivityFactoryStub","start","_url","getInstances","ExpoWidgetsModule","widgetsDirectory","reloadAllWidgets","Widget","LiveActivityFactory","LiveActivity"],"mappings":"AAWA,MAAMA,mBAAsC;IAAEC,WAAU;AAAE;AAE1D,MAAMC;IACJ,qEAAqE;IACrE,YAAYC,KAAa,EAAEC,OAAe,EAAEC,aAAmC,CAAE,CAAC;IAClFC,SAAe,CAAC;IAChBC,eAAeC,MAA2B,EAAQ,CAAC;IACnDC,eAAeC,QAA6B,EAAQ,CAAC;IACrD,MAAMC,cAA4C;QAChD,OAAO,EAAE;IACX;IACAC,8BACEC,cAAsB,EACtBC,QAAoC,EAC9B,CAAC;AACX;AAEA,MAAMC;IACJC,QAAgB;QACd,OAAO;IACT;IACA,MAAMC,OAAOT,MAAe,EAAiB,CAAC;IAC9C,MAAMU,IACJC,gBAAyB,EACzBC,UAAmB,EACnBC,MAAe,EACfC,YAAqB,EACN,CAAC;IAClB,MAAMC,eAAuC;QAC3C,OAAO;IACT;IACAC,YAAYC,UAAkB,EAAEC,SAAuC,EAAqB;QAC1F,OAAO1B;IACT;AACF;AAEA,MAAM2B;IACJ,qEAAqE;IACrE,YAAYxB,KAAa,EAAEC,OAAe,CAAE,CAAC;IAC7CwB,MAAMpB,MAAe,EAAEqB,IAAa,EAAsB;QACxD,OAAO,IAAId;IACb;IACAe,eAAqC;QACnC,OAAO,EAAE;IACX;AACF;AAEA,MAAMC,oBAAoB;IACxBC,kBAAkB;IAClBC,qBAA0B;IAC1BC,QAAQhC;IACRiC,qBAAqBR;IACrBS,cAAcrB;IACdS,aACEC,UAAqB,EACrBC,SAAuC;QAEvC,OAAO1B;IACT;AACF;AAEA,eAAe+B,kBAAkB"}
1
+ {"version":3,"sources":["ExpoWidgets.ts"],"sourcesContent":[null],"names":["noopSubscription","remove","WidgetStub","_name","_layout","_initialProps","reload","updateSnapshot","_props","updateTimeline","_entries","getTimeline","setConfigurationParameterEnum","_parameterName","_options","LiveActivityStub","getId","update","end","_dismissalPolicy","_afterDate","_state","_contentDate","getPushToken","addListener","_eventName","_listener","LiveActivityFactoryStub","start","_url","getInstances","CustomNotificationStub","getProps","cancel","CustomNotificationFactoryStub","post","_id","get","getActive","cancelAll","ExpoWidgetsModule","widgetsDirectory","reloadAllWidgets","Widget","LiveActivityFactory","LiveActivity","CustomNotificationFactory","CustomNotification"],"mappings":"AAgBA,MAAMA,mBAAsC;IAAEC,WAAU;AAAE;AAE1D,MAAMC;IACJ,qEAAqE;IACrE,YAAYC,KAAa,EAAEC,OAAe,EAAEC,aAAmC,CAAE,CAAC;IAClFC,SAAe,CAAC;IAChBC,eAAeC,MAA2B,EAAQ,CAAC;IACnDC,eAAeC,QAA6B,EAAQ,CAAC;IACrD,MAAMC,cAA4C;QAChD,OAAO,EAAE;IACX;IACAC,8BACEC,cAAsB,EACtBC,QAAoC,EAC9B,CAAC;AACX;AAEA,MAAMC;IACJC,QAAgB;QACd,OAAO;IACT;IACA,MAAMC,OAAOT,MAAe,EAAiB,CAAC;IAC9C,MAAMU,IACJC,gBAAyB,EACzBC,UAAmB,EACnBC,MAAe,EACfC,YAAqB,EACN,CAAC;IAClB,MAAMC,eAAuC;QAC3C,OAAO;IACT;IACAC,YAAYC,UAAkB,EAAEC,SAAuC,EAAqB;QAC1F,OAAO1B;IACT;AACF;AAEA,MAAM2B;IACJ,qEAAqE;IACrE,YAAYxB,KAAa,EAAEC,OAAe,CAAE,CAAC;IAC7CwB,MAAMpB,MAAe,EAAEqB,IAAa,EAAsB;QACxD,OAAO,IAAId;IACb;IACAe,eAAqC;QACnC,OAAO,EAAE;IACX;AACF;AAEA,MAAMC;IACJf,QAAgB;QACd,OAAO;IACT;IACA,MAAMgB,WAAyC;QAC7C,OAAO,CAAC;IACV;IACA,MAAMf,OACJT,MAA2B,EAC3BM,QAAyC,EAC1B,CAAC;IAClB,MAAMmB,SAAwB,CAAC;AACjC;AAEA,MAAMC;IACJ,qEAAqE;IACrE,YAAY/B,KAAa,EAAEC,OAAe,CAAE,CAAC;IAC7C,MAAM+B,KACJC,GAAW,EACX5B,MAA2B,EAC3BM,QAAyC,EACN;QACnC,OAAO,IAAIiB;IACb;IACA,MAAMM,IAAID,GAAW,EAA4C;QAC/D,OAAO;IACT;IACA,MAAME,YAAiD;QACrD,OAAO,EAAE;IACX;IACA,MAAMC,YAA2B,CAAC;AACpC;AAEA,MAAMC,oBAAoB;IACxBC,kBAAkB;IAClBC,qBAA0B;IAC1BC,QAAQzC;IACR0C,qBAAqBjB;IACrBkB,cAAc9B;IACd+B,2BACEZ;IACFa,oBAAoBhB;IACpBP,aACEC,UAAqB,EACrBC,SAAuC;QAEvC,OAAO1B;IACT;AACF;AAEA,eAAewC,kBAAkB"}
@@ -1,11 +1,16 @@
1
1
  import { NativeModule } from 'expo';
2
+ import type { NativeCustomNotification, NativeCustomNotificationFactory } from './CustomNotifications.types';
2
3
  import type { ExpoWidgetsEvents, NativeLiveActivity, NativeLiveActivityFactory, NativeWidgetObject } from './Widgets.types';
3
4
  declare class ExpoWidgetsModule extends NativeModule<ExpoWidgetsEvents> {
4
5
  widgetsDirectory: string;
5
6
  reloadAllWidgets(): void;
6
7
  readonly Widget: typeof NativeWidgetObject;
8
+ /** iOS only. */
7
9
  readonly LiveActivityFactory: typeof NativeLiveActivityFactory;
8
10
  readonly LiveActivity: typeof NativeLiveActivity;
11
+ /** Android only. */
12
+ readonly CustomNotificationFactory: typeof NativeCustomNotificationFactory;
13
+ readonly CustomNotification: typeof NativeCustomNotification;
9
14
  }
10
15
  declare const _default: ExpoWidgetsModule;
11
16
  export default _default;
@@ -1 +1 @@
1
- {"version":3,"sources":["ExpoWidgets.native.ts"],"sourcesContent":[null],"names":["NativeModule","requireNativeModule"],"mappings":"AAAA,SAASA,YAAY,EAAEC,mBAAmB,QAAQ,OAAO;AAiBzD,eAAeA,oBAAuC,eAAe"}
1
+ {"version":3,"sources":["ExpoWidgets.native.ts"],"sourcesContent":[null],"names":["NativeModule","requireNativeModule"],"mappings":"AAAA,SAASA,YAAY,EAAEC,mBAAmB,QAAQ,OAAO;AAyBzD,eAAeA,oBAAuC,eAAe"}
@@ -14,6 +14,7 @@ export declare class Widget<PropsType extends object = object, ConfigurationType
14
14
  /**
15
15
  * Schedules a series of updates for the widget's content and reloads the widget.
16
16
  * @param entries Timeline entries, each specifying a date and the props to display at that time.
17
+ * @platform ios
17
18
  */
18
19
  updateTimeline(entries: WidgetTimelineEntry<PropsType>[]): void;
19
20
  /**
@@ -23,16 +24,19 @@ export declare class Widget<PropsType extends object = object, ConfigurationType
23
24
  updateSnapshot(props: PropsType): void;
24
25
  /**
25
26
  * Returns the current timeline entries for the widget, including past and future entries.
27
+ * @platform ios
26
28
  */
27
29
  getTimeline(): Promise<WidgetTimelineEntry<PropsType>[]>;
28
30
  /**
29
31
  * Replaces the runtime options for a dynamic enum configuration parameter.
30
32
  * The app config values remain the fallback when no runtime options are set.
33
+ * @platform ios
31
34
  */
32
35
  setConfigurationParameterEnum(parameterName: keyof ConfigurationType & string, options?: WidgetConfigurationEnum[]): void;
33
36
  }
34
37
  /**
35
38
  * Represents a Live Activity instance. Provides methods to update its content and end it.
39
+ * @platform ios
36
40
  */
37
41
  export declare class LiveActivity<T extends object = object> {
38
42
  /** @hidden */
@@ -40,12 +44,14 @@ export declare class LiveActivity<T extends object = object> {
40
44
  constructor(nativeLiveActivity: NativeLiveActivity);
41
45
  /**
42
46
  * Returns the stable ActivityKit identifier for this Live Activity.
47
+ * @platform ios
43
48
  */
44
49
  getId(): string;
45
50
  /**
46
51
  * Updates the Live Activity's content. The UI reflects the new properties immediately.
47
52
  * @param props The updated content properties.
48
53
  * @param staleDate When set, the system may de-emphasize the activity after this date if content has not been refreshed.
54
+ * @platform ios
49
55
  */
50
56
  update(props: T, staleDate?: Date): Promise<void>;
51
57
  /**
@@ -54,11 +60,13 @@ export declare class LiveActivity<T extends object = object> {
54
60
  * Can be `'default'`, `'immediate'`, or `after(date)`.
55
61
  * @param props Final content properties to update after the activity ends.
56
62
  * @param contentDate The time the data in the payload was generated. If this is older than a previous update or push payload, the system ignores this update.
63
+ * @platform ios
57
64
  */
58
65
  end(dismissalPolicy?: LiveActivityDismissalPolicy, props?: T, contentDate?: Date): Promise<void>;
59
66
  /**
60
67
  * Returns the push token for this Live Activity, used to send push notification updates via APNs.
61
68
  * Returns `null` if push notifications are not enabled or the token is not yet available.
69
+ * @platform ios
62
70
  */
63
71
  getPushToken(): Promise<string | null>;
64
72
  /**
@@ -66,11 +74,13 @@ export declare class LiveActivity<T extends object = object> {
66
74
  * The token can be used to send content updates to this specific activity via APNs.
67
75
  * @param listener Callback invoked when a new push token is available.
68
76
  * @returns An event subscription that can be used to remove the listener.
77
+ * @platform ios
69
78
  */
70
79
  addPushTokenListener(listener: (event: PushTokenEvent) => void): EventSubscription;
71
80
  }
72
81
  /**
73
82
  * Manages Live Activity instances of a specific type. Use it to start new activities and retrieve currently active ones.
83
+ * @platform ios
74
84
  */
75
85
  export declare class LiveActivityFactory<T extends object = object> {
76
86
  /** @hidden */
@@ -82,10 +92,12 @@ export declare class LiveActivityFactory<T extends object = object> {
82
92
  * @param url An optional URL to associate with the Live Activity, used for deep linking.
83
93
  * @param staleDate When set, the system may de-emphasize the activity after this date if content has not been refreshed.
84
94
  * @returns The new Live Activity instance.
95
+ * @platform ios
85
96
  */
86
97
  start(props: T, url?: string, staleDate?: Date): LiveActivity<T>;
87
98
  /**
88
99
  * Returns all currently active instances of this Live Activity type.
100
+ * @platform ios
89
101
  */
90
102
  getInstances(): LiveActivity<T>[];
91
103
  }
@@ -108,6 +120,7 @@ export declare function createWidget<PropsType extends object = object, Configur
108
120
  * Creates a Live Activity Factory for managing Live Activities of a specific type.
109
121
  * @param name The Live Activity name. Must match the `'name'` field in your widget configuration in the app config.
110
122
  * @param liveActivity The Live Activity component, marked with the `'widget'` directive.
123
+ * @platform ios
111
124
  */
112
125
  export declare function createLiveActivity<T extends object = object>(name: string, liveActivity: LiveActivityComponent<T>): LiveActivityFactory<T>;
113
126
  /**
@@ -121,6 +134,7 @@ export declare function addUserInteractionListener(listener: ExpoWidgetsEvents['
121
134
  * This token can be used to start live activities remotely via APNs.
122
135
  * @param listener Callback function to handle push-to-start token events.
123
136
  * @return An event subscription that can be used to remove the listener.
137
+ * @platform ios
124
138
  */
125
139
  export declare function addPushToStartTokenListener(listener: ExpoWidgetsEvents['onExpoWidgetsPushToStartTokenReceived']): EventSubscription;
126
140
  /**
package/build/Widgets.js CHANGED
@@ -15,6 +15,7 @@ import ExpoWidgetsModule from './ExpoWidgets';
15
15
  /**
16
16
  * Schedules a series of updates for the widget's content and reloads the widget.
17
17
  * @param entries Timeline entries, each specifying a date and the props to display at that time.
18
+ * @platform ios
18
19
  */ updateTimeline(entries) {
19
20
  if (Platform.OS === 'android') {
20
21
  return;
@@ -41,6 +42,7 @@ import ExpoWidgetsModule from './ExpoWidgets';
41
42
  }
42
43
  /**
43
44
  * Returns the current timeline entries for the widget, including past and future entries.
45
+ * @platform ios
44
46
  */ async getTimeline() {
45
47
  return (await this.nativeWidgetObject.getTimeline()).map((entry)=>({
46
48
  date: new Date(entry.timestamp),
@@ -50,12 +52,14 @@ import ExpoWidgetsModule from './ExpoWidgets';
50
52
  /**
51
53
  * Replaces the runtime options for a dynamic enum configuration parameter.
52
54
  * The app config values remain the fallback when no runtime options are set.
55
+ * @platform ios
53
56
  */ setConfigurationParameterEnum(parameterName, options) {
54
57
  this.nativeWidgetObject.setConfigurationParameterEnum(parameterName, options);
55
58
  }
56
59
  }
57
60
  /**
58
61
  * Represents a Live Activity instance. Provides methods to update its content and end it.
62
+ * @platform ios
59
63
  */ export class LiveActivity {
60
64
  /** @hidden */ nativeLiveActivity;
61
65
  constructor(nativeLiveActivity){
@@ -63,6 +67,7 @@ import ExpoWidgetsModule from './ExpoWidgets';
63
67
  }
64
68
  /**
65
69
  * Returns the stable ActivityKit identifier for this Live Activity.
70
+ * @platform ios
66
71
  */ getId() {
67
72
  return this.nativeLiveActivity.getId();
68
73
  }
@@ -70,6 +75,7 @@ import ExpoWidgetsModule from './ExpoWidgets';
70
75
  * Updates the Live Activity's content. The UI reflects the new properties immediately.
71
76
  * @param props The updated content properties.
72
77
  * @param staleDate When set, the system may de-emphasize the activity after this date if content has not been refreshed.
78
+ * @platform ios
73
79
  */ update(props, staleDate) {
74
80
  return this.nativeLiveActivity.update(JSON.stringify(props), staleDate?.getTime());
75
81
  }
@@ -79,6 +85,7 @@ import ExpoWidgetsModule from './ExpoWidgets';
79
85
  * Can be `'default'`, `'immediate'`, or `after(date)`.
80
86
  * @param props Final content properties to update after the activity ends.
81
87
  * @param contentDate The time the data in the payload was generated. If this is older than a previous update or push payload, the system ignores this update.
88
+ * @platform ios
82
89
  */ end(dismissalPolicy, props, contentDate) {
83
90
  const serializedProps = props ? JSON.stringify(props) : undefined;
84
91
  if (typeof dismissalPolicy === 'object' && dismissalPolicy !== null && 'after' in dismissalPolicy) {
@@ -89,6 +96,7 @@ import ExpoWidgetsModule from './ExpoWidgets';
89
96
  /**
90
97
  * Returns the push token for this Live Activity, used to send push notification updates via APNs.
91
98
  * Returns `null` if push notifications are not enabled or the token is not yet available.
99
+ * @platform ios
92
100
  */ getPushToken() {
93
101
  return this.nativeLiveActivity.getPushToken();
94
102
  }
@@ -97,12 +105,14 @@ import ExpoWidgetsModule from './ExpoWidgets';
97
105
  * The token can be used to send content updates to this specific activity via APNs.
98
106
  * @param listener Callback invoked when a new push token is available.
99
107
  * @returns An event subscription that can be used to remove the listener.
108
+ * @platform ios
100
109
  */ addPushTokenListener(listener) {
101
110
  return this.nativeLiveActivity.addListener('onExpoWidgetsTokenReceived', listener);
102
111
  }
103
112
  }
104
113
  /**
105
114
  * Manages Live Activity instances of a specific type. Use it to start new activities and retrieve currently active ones.
115
+ * @platform ios
106
116
  */ export class LiveActivityFactory {
107
117
  /** @hidden */ nativeLiveActivityFactory;
108
118
  constructor(name, layout){
@@ -114,11 +124,13 @@ import ExpoWidgetsModule from './ExpoWidgets';
114
124
  * @param url An optional URL to associate with the Live Activity, used for deep linking.
115
125
  * @param staleDate When set, the system may de-emphasize the activity after this date if content has not been refreshed.
116
126
  * @returns The new Live Activity instance.
127
+ * @platform ios
117
128
  */ start(props, url, staleDate) {
118
129
  return new LiveActivity(this.nativeLiveActivityFactory.start(JSON.stringify(props), url, staleDate?.getTime()));
119
130
  }
120
131
  /**
121
132
  * Returns all currently active instances of this Live Activity type.
133
+ * @platform ios
122
134
  */ getInstances() {
123
135
  return this.nativeLiveActivityFactory.getInstances().map((instance)=>new LiveActivity(instance));
124
136
  }
@@ -144,6 +156,7 @@ import ExpoWidgetsModule from './ExpoWidgets';
144
156
  * Creates a Live Activity Factory for managing Live Activities of a specific type.
145
157
  * @param name The Live Activity name. Must match the `'name'` field in your widget configuration in the app config.
146
158
  * @param liveActivity The Live Activity component, marked with the `'widget'` directive.
159
+ * @platform ios
147
160
  */ export function createLiveActivity(name, liveActivity) {
148
161
  return new LiveActivityFactory(name, liveActivity);
149
162
  }
@@ -159,6 +172,7 @@ import ExpoWidgetsModule from './ExpoWidgets';
159
172
  * This token can be used to start live activities remotely via APNs.
160
173
  * @param listener Callback function to handle push-to-start token events.
161
174
  * @return An event subscription that can be used to remove the listener.
175
+ * @platform ios
162
176
  */ export function addPushToStartTokenListener(listener) {
163
177
  return ExpoWidgetsModule.addListener('onExpoWidgetsPushToStartTokenReceived', listener);
164
178
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["Widgets.ts"],"sourcesContent":[null],"names":["Platform","ExpoWidgetsModule","Widget","nativeWidgetObject","name","layout","initialProps","reload","updateTimeline","entries","OS","map","entry","timestamp","date","getTime","props","updateSnapshot","Date","now","getTimeline","setConfigurationParameterEnum","parameterName","options","LiveActivity","nativeLiveActivity","getId","update","staleDate","JSON","stringify","end","dismissalPolicy","contentDate","serializedProps","undefined","after","getPushToken","addPushTokenListener","listener","addListener","LiveActivityFactory","nativeLiveActivityFactory","start","url","getInstances","instance","createWidget","widget","createLiveActivity","liveActivity","addUserInteractionListener","addPushToStartTokenListener","widgetsDirectory"],"mappings":"AACA,S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K,CAACd,KAAKC,SAAS,CAACd,QAAQ4B,KAAKhB,WAAWb;IAEhF;IAEA;;GAEC,GACD8B,eAAe;QACb,OAAO,IAAI,CAACH,yBAAyB,CAClCG,YAAY,GACZlC,GAAG,CAAC,CAACmC,WAAa,IAAItB,aAAgBsB;IAC3C;AACF;AAEA;;;;CAIC,GACD,OAAO,SAASV,MAAMtB,IAAU;IAC9B,OAAO;QAAEsB,OAAOtB;IAAK;AACvB;AAEA;;;;;CAKC,GACD,OAAO,SAASiC,aAId3C,IAAY,EACZ4C,MAA8F,EAC9F1C,YAAwB;IAExB,OAAO,IAAIJ,OAAqCE,MAAM4C,QAAQ1C;AAChE;AAEA;;;;CAIC,GACD,OAAO,SAAS2C,mBACd7C,IAAY,EACZ8C,YAAsC;IAEtC,OAAO,IAAIT,oBAAuBrC,MAAM8C;AAC1C;AAEA;;;;CAIC,GACD,OAAO,SAASC,2BACdZ,QAA2D;IAE3D,OAAOtC,kBAAkBuC,WAAW,CAAC,gCAAgCD;AACvE;AAEA;;;;;CAKC,GACD,OAAO,SAASa,4BACdb,QAAoE;IAEpE,OAAOtC,kBAAkBuC,WAAW,CAAC,yCAAyCD;AAChF;AAEA;;;CAGC,GACD,OAAO,MAAMc,mBAAmBpD,kBAAkBoD,gBAAgB,CAAC"}
1
+ {"version":3,"sources":["Widgets.ts"],"sourcesContent":[null],"names":["Platform","ExpoWidgetsModule","Widget","nativeWidgetObject","name","layout","initialProps","reload","updateTimeline","entries","OS","map","entry","timestamp","date","getTime","props","updateSnapshot","Date","now","getTimeline","setConfigurationParameterEnum","parameterName","options","LiveActivity","nativeLiveActivity","getId","update","staleDate","JSON","stringify","end","dismissalPolicy","contentDate","serializedProps","undefined","after","getPushToken","addPushTokenListener","listener","addListener","LiveActivityFactory","nativeLiveActivityFactory","start","url","getInstances","instance","createWidget","widget","createLiveActivity","liveActivity","addUserInteractionListener","addPushToStartTokenListener","widgetsDirectory"],"mappings":"AACA,SAASA,QAAQ,QAAQ,eAAe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AKC,SAAS,CAACd,QAAQ4B,KAAKhB,WAAWb;IAEhF;IAEA;;;GAGC,GACD8B,eAAe;QACb,OAAO,IAAI,CAACH,yBAAyB,CAClCG,YAAY,GACZlC,GAAG,CAAC,CAACmC,WAAa,IAAItB,aAAgBsB;IAC3C;AACF;AAEA;;;;CAIC,GACD,OAAO,SAASV,MAAMtB,IAAU;IAC9B,OAAO;QAAEsB,OAAOtB;IAAK;AACvB;AAEA;;;;;CAKC,GACD,OAAO,SAASiC,aAId3C,IAAY,EACZ4C,MAA8F,EAC9F1C,YAAwB;IAExB,OAAO,IAAIJ,OAAqCE,MAAM4C,QAAQ1C;AAChE;AAEA;;;;;CAKC,GACD,OAAO,SAAS2C,mBACd7C,IAAY,EACZ8C,YAAsC;IAEtC,OAAO,IAAIT,oBAAuBrC,MAAM8C;AAC1C;AAEA;;;;CAIC,GACD,OAAO,SAASC,2BACdZ,QAA2D;IAE3D,OAAOtC,kBAAkBuC,WAAW,CAAC,gCAAgCD;AACvE;AAEA;;;;;;CAMC,GACD,OAAO,SAASa,4BACdb,QAAoE;IAEpE,OAAOtC,kBAAkBuC,WAAW,CAAC,yCAAyCD;AAChF;AAEA;;;CAGC,GACD,OAAO,MAAMc,mBAAmBpD,kBAAkBoD,gBAAgB,CAAC"}
@@ -6,6 +6,7 @@ import type { after } from './Widgets';
6
6
  * - `fullColor` — Home screen widgets (default).
7
7
  * - `accented` — Tinted widgets (iOS 18+) and watchOS.
8
8
  * - `vibrant` — Lock screen widgets.
9
+ * @platform ios
9
10
  */
10
11
  export type WidgetRenderingMode = 'fullColor' | 'accented' | 'vibrant';
11
12
  /**
@@ -88,9 +89,13 @@ export type WidgetEnvironment<T extends object | undefined = undefined> = {
88
89
  */
89
90
  configuration: T;
90
91
  };
92
+ /**
93
+ * @platform ios
94
+ */
91
95
  export type LiveActivityEnvironment = {
92
96
  /**
93
97
  * The color scheme of the activity's environment.
98
+ * @platform ios
94
99
  */
95
100
  colorScheme: 'light' | 'dark';
96
101
  /**
@@ -128,6 +133,9 @@ export type LiveActivityEnvironment = {
128
133
  */
129
134
  levelOfDetail?: LevelOfDetail;
130
135
  };
136
+ /**
137
+ * @platform ios
138
+ */
131
139
  export type WidgetTimelineEntry<T extends object = object> = {
132
140
  /**
133
141
  * Date when widget should update.
@@ -159,6 +167,7 @@ export type ExpoTimelineEntry = {
159
167
  };
160
168
  /**
161
169
  * Defines the layout sections for an iOS Live Activity.
170
+ * @platform ios
162
171
  */
163
172
  export type LiveActivityLayout = {
164
173
  /**
@@ -200,6 +209,7 @@ export type LiveActivityLayout = {
200
209
  };
201
210
  /**
202
211
  * A function that returns the layout for a Live Activity.
212
+ * @platform ios
203
213
  */
204
214
  export type LiveActivityComponent<T extends object = object> = (props: T, environment: LiveActivityEnvironment) => LiveActivityLayout;
205
215
  /**
@@ -214,6 +224,11 @@ export type UserInteractionEvent = {
214
224
  * Button/toggle that was pressed.
215
225
  */
216
226
  target: string;
227
+ /**
228
+ * The key of the custom notification that contains the button. Absent for widget interactions.
229
+ * @platform android
230
+ */
231
+ notificationId?: string;
217
232
  /**
218
233
  * Timestamp of the event.
219
234
  */
@@ -225,6 +240,7 @@ export type UserInteractionEvent = {
225
240
  };
226
241
  /**
227
242
  * Event emitted when a push token is received for a live activity.
243
+ * @platform ios
228
244
  */
229
245
  export type PushTokenEvent = {
230
246
  /**
@@ -238,6 +254,7 @@ export type PushTokenEvent = {
238
254
  };
239
255
  /**
240
256
  * Event emitted when a push-to-start token is received.
257
+ * @platform ios
241
258
  */
242
259
  export type PushToStartTokenEvent = {
243
260
  /**
@@ -250,20 +267,27 @@ export type PushToStartTokenEvent = {
250
267
  * - `'default'` - The system’s default dismissal policy for the Live Activity.
251
268
  * - `'immediate'` - The system immediately removes the Live Activity that ended.
252
269
  * - `after(date)` - The system removes the Live Activity that ended at the specified time within a four-hour window.
270
+ * @platform ios
253
271
  */
254
272
  export type LiveActivityDismissalPolicy = 'default' | 'immediate' | ReturnType<typeof after>;
273
+ /** @hidden */
255
274
  export type ExpoWidgetsEvents = {
256
275
  /**
257
276
  * Function that is invoked when user interacts with a widget.
258
277
  * @param event Interaction event details.
278
+ * @platform ios
259
279
  */
260
280
  onExpoWidgetsUserInteraction: (event: UserInteractionEvent) => void;
261
281
  /**
262
282
  * Function that is invoked when a push-to-start token is received.
263
283
  * @param event Token event details.
284
+ * @platform ios
264
285
  */
265
286
  onExpoWidgetsPushToStartTokenReceived: (event: PushToStartTokenEvent) => void;
266
287
  };
288
+ /**
289
+ * @platform ios
290
+ */
267
291
  export type LiveActivityEvents = {
268
292
  /**
269
293
  * Function that is invoked when a push token is received for a live activity.
package/build/index.d.ts CHANGED
@@ -1,2 +1,4 @@
1
+ export * from './CustomNotifications';
2
+ export type { CustomNotificationComponent, CustomNotificationEnvironment, CustomNotificationLayout, CustomNotificationOptions, CustomNotificationUpdateOptions, } from './CustomNotifications.types';
1
3
  export * from './Widgets';
2
4
  export type { ExpoWidgetsEvents, LevelOfDetail, LiveActivityComponent, LiveActivityDismissalPolicy, LiveActivityEnvironment, LiveActivityEvents, LiveActivityLayout, PushTokenEvent, PushToStartTokenEvent, UserInteractionEvent, WidgetConfigurationEnum, WidgetEnvironment, WidgetFamily, WidgetRenderingMode, WidgetTimelineEntry, } from './Widgets.types';
package/build/index.js CHANGED
@@ -1,3 +1,4 @@
1
+ export * from './CustomNotifications';
1
2
  export * from './Widgets';
2
3
 
3
4
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["index.ts"],"sourcesContent":[null],"names":[],"mappings":"AAAA,cAAc,YAAY"}
1
+ {"version":3,"sources":["index.ts"],"sourcesContent":[null],"names":[],"mappings":"AAAA,cAAc,wBAAwB;AAQtC,cAAc,YAAY"}
@@ -32,6 +32,15 @@ function decorateNode(
32
32
  return node.map((child) => decorateNode(child, context));
33
33
  }
34
34
 
35
+ if (isSectionMap(node)) {
36
+ return Object.fromEntries(
37
+ Object.entries(node).map(([section, child]) => [
38
+ section,
39
+ decorateNode(child, { ...context, nearestParentKey: section }),
40
+ ])
41
+ );
42
+ }
43
+
35
44
  if (!isReactElementNode(node)) {
36
45
  return node;
37
46
  }
@@ -58,6 +67,10 @@ function isReactElementNode(node: unknown): node is ReactElementNode {
58
67
  return Boolean(node) && typeof node === 'object' && 'type' in node && 'props' in node;
59
68
  }
60
69
 
70
+ function isSectionMap(node: unknown): node is Record<string, unknown> {
71
+ return Boolean(node) && typeof node === 'object' && !isReactElementNode(node);
72
+ }
73
+
61
74
  function buildButtonTargetId(index: number, parentKey: string | null) {
62
75
  const baseTarget = `__expo_widgets_target_${index}`;
63
76
 
package/bundle/index.ts CHANGED
@@ -48,9 +48,16 @@ function normalizeWidgetTree(node: unknown, position: string | number = 0): unkn
48
48
  };
49
49
  }
50
50
  if (node && typeof node === 'object') {
51
- // Live Activity layouts return a map of section names to roots.
51
+ // Live Activities and notifications return section maps. Native renderers need each root
52
+ // to be an element, even when a section returns an array of children.
52
53
  return Object.fromEntries(
53
- Object.entries(node).map(([section, child]) => [section, normalizeWidgetTree(child, section)])
54
+ Object.entries(node).map(([section, child]) => [
55
+ section,
56
+ normalizeWidgetTree(
57
+ Array.isArray(child) ? jsxRuntime.jsx(React.Fragment, { children: child }) : child,
58
+ section
59
+ ),
60
+ ])
54
61
  );
55
62
  }
56
63
  return node;
@@ -77,6 +84,16 @@ const __expoWidgetHandlePress = function (
77
84
  const { target, ...renderEnvironment } = environment;
78
85
 
79
86
  function findAndCallOnPress(node?: Dictionary): Dictionary | undefined {
87
+ if (node && typeof node === 'object' && !('type' in node)) {
88
+ for (const section of Object.values(node)) {
89
+ const result = findAndCallOnPress(section as Dictionary);
90
+ if (result) {
91
+ return result;
92
+ }
93
+ }
94
+ return undefined;
95
+ }
96
+
80
97
  const props = node?.props as {
81
98
  onButtonPress?: () => Dictionary;
82
99
  onButtonPressed?: () => Dictionary;
@@ -33,6 +33,25 @@ export function createLiveActivity() {
33
33
  return noopLiveActivityFactory;
34
34
  }
35
35
 
36
+ const noopCustomNotificationFactory = {
37
+ post() {
38
+ return Promise.resolve({});
39
+ },
40
+ get() {
41
+ return Promise.resolve(null);
42
+ },
43
+ getActive() {
44
+ return Promise.resolve([]);
45
+ },
46
+ cancelAll() {
47
+ return Promise.resolve();
48
+ },
49
+ };
50
+
51
+ export function createCustomNotification() {
52
+ return noopCustomNotificationFactory;
53
+ }
54
+
36
55
  export function addUserInteractionListener() {
37
56
  return { remove() {} };
38
57
  }
@@ -36,12 +36,9 @@ Pod::Spec.new do |s|
36
36
  :name => 'Build ExpoWidgets Bundle',
37
37
  :script => project_root_env_var + 'bash -l -c "\"$PODS_TARGET_SRCROOT/../scripts/xcode-build-bundle.sh\""',
38
38
  :execution_position => :before_compile,
39
- # NOTE(@krystofwoldrich): Ideally we would specify `__dir__/**/*`, but Xcode doesn't support patterns
40
- :input_files => ["#{__dir__}/../package.json"],
41
- :output_files => [
42
- "#{__dir__}/../bundle/build/ExpoWidgets.bundle",
43
- "#{__dir__}/../bundle/build/ExpoWidgetsLayoutRegistry.json",
44
- ],
39
+ # NOTE: The bundle depends on JS sources that Xcode cannot track through input files (this
40
+ # package, `@expo/ui`, and the app's own widget layouts), so the phase declares no inputs or
41
+ # outputs.
45
42
  }
46
43
  copy_bundle_script = {
47
44
  :name => 'Prepare ExpoWidgets Resources',
@@ -64,7 +61,8 @@ Pod::Spec.new do |s|
64
61
  }
65
62
  # :always_out_of_date is only available in CocoaPods 1.13.0 and later
66
63
  if Gem::Version.new(Pod::VERSION) >= Gem::Version.new('1.13.0')
67
- # always run the script without warning
64
+ # always run the scripts without warning
65
+ build_bundle_script[:always_out_of_date] = "1"
68
66
  copy_bundle_script[:always_out_of_date] = "1"
69
67
  end
70
68
  s.script_phases = [build_bundle_script, copy_bundle_script]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "expo-widgets",
3
- "version": "58.0.16",
3
+ "version": "58.0.17",
4
4
  "description": "Widgets.",
5
5
  "keywords": [
6
6
  "expo",
@@ -28,15 +28,15 @@
28
28
  },
29
29
  "dependencies": {
30
30
  "@expo/plist": "^0.10.1",
31
- "@expo/ui": "~58.0.16"
31
+ "@expo/ui": "~58.0.17"
32
32
  },
33
33
  "devDependencies": {
34
- "@expo/internal-scripts": "58.0.1",
34
+ "@expo/internal-scripts": "58.0.2",
35
35
  "@expo/spawn-async": "^1.8.0",
36
36
  "@types/jest": "^30.0.0",
37
37
  "@types/node": "^22.14.0",
38
38
  "@types/react": "~19.3.0",
39
- "expo": "58.0.8",
39
+ "expo": "58.0.10",
40
40
  "react-native": "0.88.0-rc.4",
41
41
  "resolve-workspace-root": "^2.0.0"
42
42
  },
@@ -0,0 +1,6 @@
1
+ import { ConfigPlugin } from 'expo/config-plugins';
2
+ type NotificationPermissionProps = {
3
+ enablePushNotifications: boolean;
4
+ };
5
+ declare const withAndroidNotificationPermission: ConfigPlugin<NotificationPermissionProps>;
6
+ export default withAndroidNotificationPermission;
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ Object.defineProperty(exports, "default", {
6
+ enumerable: true,
7
+ get: function() {
8
+ return _default;
9
+ }
10
+ });
11
+ function _configplugins() {
12
+ const data = require("expo/config-plugins");
13
+ _configplugins = function() {
14
+ return data;
15
+ };
16
+ return data;
17
+ }
18
+ const withAndroidNotificationPermission = (config, props)=>{
19
+ if (!props.enablePushNotifications) {
20
+ return config;
21
+ }
22
+ return (0, _configplugins().withAndroidManifest)(config, (config)=>{
23
+ _configplugins().AndroidConfig.Permissions.ensurePermissions(config.modResults, [
24
+ 'android.permission.POST_NOTIFICATIONS'
25
+ ]);
26
+ return config;
27
+ });
28
+ };
29
+ const _default = withAndroidNotificationPermission;
30
+
31
+ //# sourceMappingURL=withAndroidNotificationPermission.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["android/withAndroidNotificationPermission.ts"],"sourcesContent":[null],"names":["withAndroidNotificationPermission","config","props","enablePushNotifications","withAndroidManifest","AndroidConfig","Permissions","ensurePermissions","modResults"],"mappings":";;;;+BAqBA;;;eAAA;;;;yBArBiE;;;;;;AAMjE,MAAMA,oCAA+E,CACnFC,QACAC;IAEA,IAAI,CAACA,MAAMC,uBAAuB,EAAE;QAClC,OAAOF;IACT;IACA,OAAOG,IAAAA,oCAAmB,EAACH,QAAQ,CAACA;QAClCI,8BAAa,CAACC,WAAW,CAACC,iBAAiB,CAACN,OAAOO,UAAU,EAAE;YAC7D;SACD;QACD,OAAOP;IACT;AACF;MAEA,WAAeD"}
@@ -1,6 +1,8 @@
1
1
  import { ConfigPlugin } from 'expo/config-plugins';
2
2
  import { WidgetConfig } from '../types/WidgetConfig.type';
3
- declare const withAndroidWidgets: ConfigPlugin<{
3
+ type AndroidWidgetsProps = {
4
+ enablePushNotifications?: boolean;
4
5
  widgets: WidgetConfig[];
5
- }>;
6
+ };
7
+ declare const withAndroidWidgets: ConfigPlugin<AndroidWidgetsProps>;
6
8
  export default withAndroidWidgets;
@@ -8,6 +8,7 @@ Object.defineProperty(exports, "default", {
8
8
  return _default;
9
9
  }
10
10
  });
11
+ const _withAndroidNotificationPermission = /*#__PURE__*/ _interop_require_default(require("./withAndroidNotificationPermission"));
11
12
  const _withAndroidWidgetFiles = /*#__PURE__*/ _interop_require_default(require("./withAndroidWidgetFiles"));
12
13
  const _withAndroidWidgetManifest = /*#__PURE__*/ _interop_require_default(require("./withAndroidWidgetManifest"));
13
14
  function _interop_require_default(obj) {
@@ -15,7 +16,11 @@ function _interop_require_default(obj) {
15
16
  default: obj
16
17
  };
17
18
  }
18
- const withAndroidWidgets = (config, { widgets })=>{
19
+ const withAndroidWidgets = (config, props)=>{
20
+ const { widgets } = props;
21
+ config = (0, _withAndroidNotificationPermission.default)(config, {
22
+ enablePushNotifications: props.enablePushNotifications ?? false
23
+ });
19
24
  if (widgets.length === 0) {
20
25
  return config;
21
26
  }