Skip to content

[Bug]: Android widget picker shows the app icon instead of a preview for Subscription usage #15158

Description

@tris203

Before submitting

  • I searched existing issues and did not find a duplicate.
  • I included enough detail to reproduce or investigate the problem.

Area

Mobile

Steps to reproduce

  1. Install T3 Code on Android 12 or later.
  2. Long-press the home screen, open Widgets, and find T3 Code.
  3. Expand the Subscription usage entry.

Expected behavior

The picker shows what the widget looks like.

Actual behavior

The picker shows the app icon centred on a blank 4×3 tile. expo-widgets generates the <appwidget-provider> XML with no previewImage or previewLayout, so the launcher falls back to the icon.

Impact

Cosmetic. Users can't tell what the widget shows before adding it.

Version or commit

main at 18b2132

Environment

Pixel emulator, Android 16, expo-widgets 58.0.11.

Options

Approach Effort Trade-off
previewImage (a PNG) One image plus one attribute Doesn't follow light/dark or Material You colours; soft at other sizes
previewLayout (static XML) A few XML resources plus a config plugin that adds the attribute to the generated provider XML Themed and scalable, but a hand-kept copy of the widget's look; Android 12+ only
Generated previews (Android 15+) Kotlin changes inside expo-widgets (it builds on Glance but doesn't implement the preview hook) Renders the real widget with sample data, so no duplicate; Android 15+ only and still needs one of the above as a fallback

I have a working previewLayout prototype and can open a PR if that direction is wanted.

Screenshots, recordings, or supporting files

Widget picker today:

before.png

Activity

  1. juliusmarminge commented on Oct 3, 2026

    @juliusmarminge
    Member

    Note

    Grok responding on behalf of Julius.

    Triage

    Thanks @tris203 for the screenshot and for tracing this to the provider XML. I confirmed it on current main (18b21325): the Subscription usage entry shows the app icon on a 4×3 tile because the picker has no widget preview. This is separate from the open PR #15142, which is about the placed widget staying on "Loading widget".

    What happens

    On Android 12+ the widget picker uses previewLayout, and on older versions it uses previewImage. With neither set, the launcher draws the app icon across the widget's cell span. The 4×3 span comes from targetCellWidth / targetCellHeight on the Subscription usage widget in apps/mobile/app.config.ts.

    expo-widgets 58.0.11 (the version in apps/mobile/package.json) writes res/xml/subscription_usage_info.xml from createWidgetInfoXml. That element sets minWidth, minHeight, the target cells, updatePeriodMillis, initialLayout, description, resizeMode, and widgetCategory, but not previewLayout or previewImage, and WidgetConfig.android has no fields for them. ExpoWidgetsPeekWidget only overrides sizeMode and provideRoot, so there's no Android 15 generated preview either.

    android:initialLayout is always @layout/expo_widgets_initial_layout, a centered "Loading widget" label shown as the first frame after placement. The initialLayout path in the app config (./src/widgets/SubscriptionUsage.android.tsx) is the JS layout the registry embeds so the real card can render before the app runs; it isn't copied onto previewLayout.

    This gap is Android-only: Agent Activity isn't an Android widget (android: null), and the iOS gallery uses the SwiftUI layout. Since minSdkVersion is 24, previewLayout alone would still leave Android 7–11 showing the icon.

    Likely fix area

    The three options in the report trade off differently:

    • previewImage: one static PNG that also covers pre-Android 12 launchers and needs no Glance changes, but it won't follow light/dark or Material You and softens at other cell sizes.
    • previewLayout: a hand-written RemoteViews layout that scales and can be themed on Android 12+ (and serves as the fallback on 15+), but it's a separate copy of the look in SubscriptionUsage.android.tsx. Because expo-widgets rewrites the provider XML on every prebuild, a local config plugin would need to add the attribute after that write. Same-type mods run last-registered first, which is the ordering the comment above widgetsPlugin in app.config.ts already relies on.
    • Generated previews: render the real widget with sample props, but the hook (providePreview on the Glance widget) lives inside expo-widgets, it's Android 15+ only, and it still needs one of the above for older launchers.

    A maintainer will decide on the fix direction. Thanks for offering your previewLayout prototype; it'll be useful once a direction is chosen.

  2. added
    bugSomething is broken or behaving incorrectly.
    via-triageFiled through npx t3 triage
    on Oct 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething is broken or behaving incorrectly.via-triageFiled through npx t3 triage

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions