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 Android. Declare them in app.json with a stable id and an explicit entry, then default-export the widget from that file.
Your widget can react to:
env.widgetFamilyenv.colorSchemeenv.localeenv.configurationAndroidDynamicColorstokens, which resolve to the current Material You palette natively
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 Android 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 Android and iOS widget declarations separate; the same
idcan exist on both platforms because each platform is configured separately.
Example plugin config:
If you need user-controlled values, add appIntent.parameters and update them in-app with setWidgetConfiguration(widgetId, key, value).
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.
