### Install React Native Android Widget with npm Source: https://saleksovski.github.io/react-native-android-widget/docs Use this command to install the library using npm. ```bash npm install --save react-native-android-widget ``` -------------------------------- ### Install React Native Android Widget with yarn Source: https://saleksovski.github.io/react-native-android-widget/docs Use this command to install the library using yarn. ```bash yarn add react-native-android-widget ``` -------------------------------- ### Combined Accessibility Example Source: https://saleksovski.github.io/react-native-android-widget/docs/tutorial/make-widget-accessible This example demonstrates combining accessibilityLabels for the root widget, interactive icons, and list items, providing comprehensive screen reader support. ```typescript export function EmailWidget() { return ( ); } ``` -------------------------------- ### Widget Configuration Component Example Source: https://saleksovski.github.io/react-native-android-widget/docs/api/register-widget-configuration-screen This component defines the UI for configuring a widget. It receives `widgetInfo`, `setResult`, and `renderWidget` as props. ```typescript import React from 'react'; import type { WidgetConfigurationScreenProps } from 'react-native-android-widget'; import { ConfigurableWidget } from './ConfigurableWidget'; export function WidgetConfigurationScreen({ widgetInfo, setResult, renderWidget, }: WidgetConfigurationScreenProps) { // Here we can define the UI for configuring the widget } ``` -------------------------------- ### ClickActionData for OPEN_URI Source: https://saleksovski.github.io/react-native-android-widget/docs/public-api/interfaces/TextWidgetProps When using OPEN_URI, the clickActionData must include a URI. This example shows the expected format for the data. ```typescript { uri: 'some-uri' } ``` -------------------------------- ### Request Widget Update Example Source: https://saleksovski.github.io/react-native-android-widget/docs/api/request-widget-update Use this snippet to update a widget on the Android home screen. It takes a widget name and a render function. The render function can return a single widget or an object with light and dark themes. An optional callback handles cases where the widget is not found. ```typescript import * as React from 'react'; import { Button, StyleSheet, View, Text } from 'react-native'; import { requestWidgetUpdate } from 'react-native-android-widget'; import { CounterWidget } from './CounterWidget'; export function CounterScreen() { const [count, setCount] = React.useState(0); React.useEffect(() => { requestWidgetUpdate({ widgetName: 'Counter', renderWidget: () => , // or // renderWidget: () => ({ // light: , // dark: , // }), widgetNotFound: () => { // Called if no widget is present on the home screen } }); }, [count]); return ( {count}