Dynamic Widgets
Experimental Feature
Dynamic widgets are experimental. Please report any issues you find.
Dynamic Widgets let your widget react to the current device state on iOS. Declare them in app.json with a stable id and an explicit entry, then default-export the widget from that file.
That means your widget can react to:
env.widgetFamilyenv.colorSchemeenv.localeenv.widgetRenderingModeenv.showsWidgetContainerBackgroundenv.configurationwhen you also add widget parameters
When you change app.json, run Expo Prebuild or Voltra Apply so the updated widget configuration is available on device. If you change only the widget JS, reopen the app in development and the widget updates automatically.
How to use it
- Add an iOS widget declaration to
app.jsonwith anid, anentry, and any widget metadata you need. - Default-export the widget function or component from the module named by
entry. - Use
initialStatePathif you want a pre-rendered first view. - Re-run Expo Prebuild or Voltra Apply after updating
app.json. - Keep iOS and Android widget declarations separate; the same
idcan exist on both platforms because each platform is configured separately.
Example plugin config:
If you want user-editable values, add appIntent too. See Configurable Widgets.
Notes
- There is no
exportfield in app.json for Dynamic Widgets. - The default-exported function or component name does not need to match the widget
id. - Use a real device to verify release rendering.
initialStatePathgives the widget a pre-rendered first view.
