Skip to main content

Interface: Widget

Properties​

name​

• name: string

Name of the widget which will be used to reference it in code


minWidth​

• minWidth: `${number}dp`


minHeight​

• minHeight: `${number}dp`


label​

• Optional label: string

Label that will be shown in widget picker


description​

• Optional description: string

Description that will be shown in widget picker


targetCellWidth​

• Optional targetCellWidth: number


targetCellHeight​

• Optional targetCellHeight: number


maxResizeWidth​

• Optional maxResizeWidth: `${number}dp`


maxResizeHeight​

• Optional maxResizeHeight: `${number}dp`


previewImage​

• Optional previewImage: `./${string}` | `../${string}`


resizeMode​

• Optional resizeMode: "none" | "horizontal" | "vertical" | "horizontal|vertical"


widgetFeatures​

• Optional widgetFeatures: "reconfigurable" | "reconfigurable|configuration_optional"

Whether the widget can be configured. 'configurable' means that the widget is configurable, and a configuration activity will be open when the widget is added on home screen. 'reconfigurable|configuration_optional' will make the widget configurable, but will not open the configuration activity when added on home screen, and the configuration can be changed by holding the widget and selecting configure. The widget will not be configurable if widgetFeatures is not provided


widgetCategory​

• Optional widgetCategory: "home_screen" | "keyguard" | "home_screen|keyguard" | "not_keyguard"

Which surfaces the widget may be placed on.

Android shows third-party widgets on the lock screen from Android 16 QPR2, and on some tablets from Android 15 QPR1. Widgets are eligible by default, but a host that filters on the declared category only offers widgets that name it, so 'home_screen|keyguard' opts in explicitly.

'not_keyguard' opts a widget out of the lock screen.

Default

"home_screen"

updatePeriodMillis​

• Optional updatePeriodMillis: number

How often the widget should be updated, in milliseconds.

Default is 0 (no automatic updates)

Minimum is 1.800.000 (30 minutes == 30 * 60 * 1000).


packageName​

• Optional packageName: string

Custom Java package name for the widget's AppWidgetProvider.

It must start with the actual apps package name.

Can be used if introducing react-native-android-widget in existing app that already has widgets in a different package that the default one.

Must not end with "."

Default

"<app-package-name>.widget"